| OLD | NEW |
| 1 /** | 1 /** |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; | 48 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide }; |
| 49 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; | 49 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide }; |
| 50 | 50 |
| 51 static CSSPropertyID resolveToPhysicalProperty( | 51 static CSSPropertyID resolveToPhysicalProperty( |
| 52 TextDirection direction, | 52 TextDirection direction, |
| 53 WritingMode writingMode, | 53 WritingMode writingMode, |
| 54 LogicalBoxSide logicalSide, | 54 LogicalBoxSide logicalSide, |
| 55 const StylePropertyShorthand& shorthand) { | 55 const StylePropertyShorthand& shorthand) { |
| 56 if (direction == TextDirection::Ltr) { | 56 if (direction == TextDirection::Ltr) { |
| 57 if (writingMode == TopToBottomWritingMode) { | 57 if (isHorizontalWritingMode(writingMode)) { |
| 58 // The common case. The logical and physical box sides match. | 58 // The common case. The logical and physical box sides match. |
| 59 // Left = Start, Right = End, Before = Top, After = Bottom | 59 // Left = Start, Right = End, Before = Top, After = Bottom |
| 60 return shorthand.properties()[logicalSide]; | 60 return shorthand.properties()[logicalSide]; |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (writingMode == LeftToRightWritingMode) { | 63 if (isFlippedLinesWritingMode(writingMode)) { |
| 64 // Start = Top, End = Bottom, Before = Left, After = Right. | 64 // Start = Top, End = Bottom, Before = Left, After = Right. |
| 65 switch (logicalSide) { | 65 switch (logicalSide) { |
| 66 case StartSide: | 66 case StartSide: |
| 67 return shorthand.properties()[TopSide]; | 67 return shorthand.properties()[TopSide]; |
| 68 case EndSide: | 68 case EndSide: |
| 69 return shorthand.properties()[BottomSide]; | 69 return shorthand.properties()[BottomSide]; |
| 70 case BeforeSide: | 70 case BeforeSide: |
| 71 return shorthand.properties()[LeftSide]; | 71 return shorthand.properties()[LeftSide]; |
| 72 default: | 72 default: |
| 73 return shorthand.properties()[RightSide]; | 73 return shorthand.properties()[RightSide]; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Start = Top, End = Bottom, Before = Right, After = Left | 77 // Start = Top, End = Bottom, Before = Right, After = Left |
| 78 switch (logicalSide) { | 78 switch (logicalSide) { |
| 79 case StartSide: | 79 case StartSide: |
| 80 return shorthand.properties()[TopSide]; | 80 return shorthand.properties()[TopSide]; |
| 81 case EndSide: | 81 case EndSide: |
| 82 return shorthand.properties()[BottomSide]; | 82 return shorthand.properties()[BottomSide]; |
| 83 case BeforeSide: | 83 case BeforeSide: |
| 84 return shorthand.properties()[RightSide]; | 84 return shorthand.properties()[RightSide]; |
| 85 default: | 85 default: |
| 86 return shorthand.properties()[LeftSide]; | 86 return shorthand.properties()[LeftSide]; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 if (writingMode == TopToBottomWritingMode) { | 90 if (isHorizontalWritingMode(writingMode)) { |
| 91 // Start = Right, End = Left, Before = Top, After = Bottom | 91 // Start = Right, End = Left, Before = Top, After = Bottom |
| 92 switch (logicalSide) { | 92 switch (logicalSide) { |
| 93 case StartSide: | 93 case StartSide: |
| 94 return shorthand.properties()[RightSide]; | 94 return shorthand.properties()[RightSide]; |
| 95 case EndSide: | 95 case EndSide: |
| 96 return shorthand.properties()[LeftSide]; | 96 return shorthand.properties()[LeftSide]; |
| 97 case BeforeSide: | 97 case BeforeSide: |
| 98 return shorthand.properties()[TopSide]; | 98 return shorthand.properties()[TopSide]; |
| 99 default: | 99 default: |
| 100 return shorthand.properties()[BottomSide]; | 100 return shorthand.properties()[BottomSide]; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 if (writingMode == LeftToRightWritingMode) { | 104 if (isFlippedLinesWritingMode(writingMode)) { |
| 105 // Start = Bottom, End = Top, Before = Left, After = Right | 105 // Start = Bottom, End = Top, Before = Left, After = Right |
| 106 switch (logicalSide) { | 106 switch (logicalSide) { |
| 107 case StartSide: | 107 case StartSide: |
| 108 return shorthand.properties()[BottomSide]; | 108 return shorthand.properties()[BottomSide]; |
| 109 case EndSide: | 109 case EndSide: |
| 110 return shorthand.properties()[TopSide]; | 110 return shorthand.properties()[TopSide]; |
| 111 case BeforeSide: | 111 case BeforeSide: |
| 112 return shorthand.properties()[LeftSide]; | 112 return shorthand.properties()[LeftSide]; |
| 113 default: | 113 default: |
| 114 return shorthand.properties()[RightSide]; | 114 return shorthand.properties()[RightSide]; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return propertyID != CSSPropertyUnicodeBidi && | 281 return propertyID != CSSPropertyUnicodeBidi && |
| 282 propertyID != CSSPropertyDirection; | 282 propertyID != CSSPropertyDirection; |
| 283 } | 283 } |
| 284 | 284 |
| 285 bool CSSProperty::operator==(const CSSProperty& other) const { | 285 bool CSSProperty::operator==(const CSSProperty& other) const { |
| 286 return m_value->equals(*other.m_value) && | 286 return m_value->equals(*other.m_value) && |
| 287 isImportant() == other.isImportant(); | 287 isImportant() == other.isImportant(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace blink | 290 } // namespace blink |
| OLD | NEW |