Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSProperty.cpp

Issue 1419813004: Remove the "horizontal-bt" value from -webkit-writing-mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add static_assert to ensure TransformedWritingMode matches to WritingMode Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingM ode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& short hand) 50 static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingM ode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& short hand)
51 { 51 {
52 if (direction == LTR) { 52 if (direction == LTR) {
53 if (writingMode == TopToBottomWritingMode) { 53 if (writingMode == TopToBottomWritingMode) {
54 // The common case. The logical and physical box sides match. 54 // The common case. The logical and physical box sides match.
55 // Left = Start, Right = End, Before = Top, After = Bottom 55 // Left = Start, Right = End, Before = Top, After = Bottom
56 return shorthand.properties()[logicalSide]; 56 return shorthand.properties()[logicalSide];
57 } 57 }
58 58
59 if (writingMode == BottomToTopWritingMode) {
60 // Start = Left, End = Right, Before = Bottom, After = Top.
61 switch (logicalSide) {
62 case StartSide:
63 return shorthand.properties()[LeftSide];
64 case EndSide:
65 return shorthand.properties()[RightSide];
66 case BeforeSide:
67 return shorthand.properties()[BottomSide];
68 default:
69 return shorthand.properties()[TopSide];
70 }
71 }
72
73 if (writingMode == LeftToRightWritingMode) { 59 if (writingMode == LeftToRightWritingMode) {
74 // Start = Top, End = Bottom, Before = Left, After = Right. 60 // Start = Top, End = Bottom, Before = Left, After = Right.
75 switch (logicalSide) { 61 switch (logicalSide) {
76 case StartSide: 62 case StartSide:
77 return shorthand.properties()[TopSide]; 63 return shorthand.properties()[TopSide];
78 case EndSide: 64 case EndSide:
79 return shorthand.properties()[BottomSide]; 65 return shorthand.properties()[BottomSide];
80 case BeforeSide: 66 case BeforeSide:
81 return shorthand.properties()[LeftSide]; 67 return shorthand.properties()[LeftSide];
82 default: 68 default:
(...skipping 21 matching lines...) Expand all
104 return shorthand.properties()[RightSide]; 90 return shorthand.properties()[RightSide];
105 case EndSide: 91 case EndSide:
106 return shorthand.properties()[LeftSide]; 92 return shorthand.properties()[LeftSide];
107 case BeforeSide: 93 case BeforeSide:
108 return shorthand.properties()[TopSide]; 94 return shorthand.properties()[TopSide];
109 default: 95 default:
110 return shorthand.properties()[BottomSide]; 96 return shorthand.properties()[BottomSide];
111 } 97 }
112 } 98 }
113 99
114 if (writingMode == BottomToTopWritingMode) {
115 // Start = Right, End = Left, Before = Bottom, After = Top
116 switch (logicalSide) {
117 case StartSide:
118 return shorthand.properties()[RightSide];
119 case EndSide:
120 return shorthand.properties()[LeftSide];
121 case BeforeSide:
122 return shorthand.properties()[BottomSide];
123 default:
124 return shorthand.properties()[TopSide];
125 }
126 }
127
128 if (writingMode == LeftToRightWritingMode) { 100 if (writingMode == LeftToRightWritingMode) {
129 // Start = Bottom, End = Top, Before = Left, After = Right 101 // Start = Bottom, End = Top, Before = Left, After = Right
130 switch (logicalSide) { 102 switch (logicalSide) {
131 case StartSide: 103 case StartSide:
132 return shorthand.properties()[BottomSide]; 104 return shorthand.properties()[BottomSide];
133 case EndSide: 105 case EndSide:
134 return shorthand.properties()[TopSide]; 106 return shorthand.properties()[TopSide];
135 case BeforeSide: 107 case BeforeSide:
136 return shorthand.properties()[LeftSide]; 108 return shorthand.properties()[LeftSide];
137 default: 109 default:
(...skipping 11 matching lines...) Expand all
149 return shorthand.properties()[RightSide]; 121 return shorthand.properties()[RightSide];
150 default: 122 default:
151 return shorthand.properties()[LeftSide]; 123 return shorthand.properties()[LeftSide];
152 } 124 }
153 } 125 }
154 126
155 enum LogicalExtent { LogicalWidth, LogicalHeight }; 127 enum LogicalExtent { LogicalWidth, LogicalHeight };
156 128
157 static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalE xtent logicalSide, const CSSPropertyID* properties) 129 static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalE xtent logicalSide, const CSSPropertyID* properties)
158 { 130 {
159 if (writingMode == TopToBottomWritingMode || writingMode == BottomToTopWriti ngMode) 131 if (isHorizontalWritingMode(writingMode))
160 return properties[logicalSide]; 132 return properties[logicalSide];
161 return logicalSide == LogicalWidth ? properties[1] : properties[0]; 133 return logicalSide == LogicalWidth ? properties[1] : properties[0];
162 } 134 }
163 135
164 static const StylePropertyShorthand& borderDirections() 136 static const StylePropertyShorthand& borderDirections()
165 { 137 {
166 static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSProper tyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft }; 138 static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSProper tyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
167 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (CSSPropertyBo rder, properties, WTF_ARRAY_LENGTH(properties))); 139 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (CSSPropertyBo rder, properties, WTF_ARRAY_LENGTH(properties)));
168 return borderDirections; 140 return borderDirections;
169 } 141 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // affected by all property. 236 // affected by all property.
265 return propertyID != CSSPropertyUnicodeBidi && propertyID != CSSPropertyDire ction; 237 return propertyID != CSSPropertyUnicodeBidi && propertyID != CSSPropertyDire ction;
266 } 238 }
267 239
268 bool CSSProperty::operator==(const CSSProperty& other) const 240 bool CSSProperty::operator==(const CSSProperty& other) const
269 { 241 {
270 return m_value->equals(*other.m_value) && isImportant() == other.isImportant (); 242 return m_value->equals(*other.m_value) && isImportant() == other.isImportant ();
271 } 243 }
272 244
273 } // namespace blink 245 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h ('k') | third_party/WebKit/Source/core/css/CSSValueKeywords.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698