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

Unified Diff: sky/engine/core/css/CSSProperty.cpp

Issue 689743002: First past at removing writing mode. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/css/CSSProperties.in ('k') | sky/engine/core/css/CSSValueKeywords.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/CSSProperty.cpp
diff --git a/sky/engine/core/css/CSSProperty.cpp b/sky/engine/core/css/CSSProperty.cpp
index 518dc9b11323f2906052628ce1383bb29c8b8b5a..0051debe58fc91f7ff138622e98f94c0ae466b3c 100644
--- a/sky/engine/core/css/CSSProperty.cpp
+++ b/sky/engine/core/css/CSSProperty.cpp
@@ -55,118 +55,34 @@ void CSSProperty::wrapValueInCommaSeparatedList()
enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide };
-static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& shorthand)
+static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& shorthand)
{
if (direction == LTR) {
- if (writingMode == TopToBottomWritingMode) {
- // The common case. The logical and physical box sides match.
- // Left = Start, Right = End, Before = Top, After = Bottom
- return shorthand.properties()[logicalSide];
- }
-
- if (writingMode == BottomToTopWritingMode) {
- // Start = Left, End = Right, Before = Bottom, After = Top.
- switch (logicalSide) {
- case StartSide:
- return shorthand.properties()[LeftSide];
- case EndSide:
- return shorthand.properties()[RightSide];
- case BeforeSide:
- return shorthand.properties()[BottomSide];
- default:
- return shorthand.properties()[TopSide];
- }
- }
-
- if (writingMode == LeftToRightWritingMode) {
- // Start = Top, End = Bottom, Before = Left, After = Right.
- switch (logicalSide) {
- case StartSide:
- return shorthand.properties()[TopSide];
- case EndSide:
- return shorthand.properties()[BottomSide];
- case BeforeSide:
- return shorthand.properties()[LeftSide];
- default:
- return shorthand.properties()[RightSide];
- }
- }
-
- // Start = Top, End = Bottom, Before = Right, After = Left
- switch (logicalSide) {
- case StartSide:
- return shorthand.properties()[TopSide];
- case EndSide:
- return shorthand.properties()[BottomSide];
- case BeforeSide:
- return shorthand.properties()[RightSide];
- default:
- return shorthand.properties()[LeftSide];
- }
- }
-
- if (writingMode == TopToBottomWritingMode) {
- // Start = Right, End = Left, Before = Top, After = Bottom
- switch (logicalSide) {
- case StartSide:
- return shorthand.properties()[RightSide];
- case EndSide:
- return shorthand.properties()[LeftSide];
- case BeforeSide:
- return shorthand.properties()[TopSide];
- default:
- return shorthand.properties()[BottomSide];
- }
- }
-
- if (writingMode == BottomToTopWritingMode) {
- // Start = Right, End = Left, Before = Bottom, After = Top
- switch (logicalSide) {
- case StartSide:
- return shorthand.properties()[RightSide];
- case EndSide:
- return shorthand.properties()[LeftSide];
- case BeforeSide:
- return shorthand.properties()[BottomSide];
- default:
- return shorthand.properties()[TopSide];
- }
- }
-
- if (writingMode == LeftToRightWritingMode) {
- // Start = Bottom, End = Top, Before = Left, After = Right
- switch (logicalSide) {
- case StartSide:
- return shorthand.properties()[BottomSide];
- case EndSide:
- return shorthand.properties()[TopSide];
- case BeforeSide:
- return shorthand.properties()[LeftSide];
- default:
- return shorthand.properties()[RightSide];
- }
+ // The common case. The logical and physical box sides match.
+ // Left = Start, Right = End, Before = Top, After = Bottom
+ return shorthand.properties()[logicalSide];
}
- // Start = Bottom, End = Top, Before = Right, After = Left
+ // FIXME(sky): Remove this. We no longer have logical properties beyond RTL.
+ // Start = Right, End = Left, Before = Top, After = Bottom
switch (logicalSide) {
case StartSide:
- return shorthand.properties()[BottomSide];
+ return shorthand.properties()[RightSide];
case EndSide:
- return shorthand.properties()[TopSide];
+ return shorthand.properties()[LeftSide];
case BeforeSide:
- return shorthand.properties()[RightSide];
+ return shorthand.properties()[TopSide];
default:
- return shorthand.properties()[LeftSide];
+ return shorthand.properties()[BottomSide];
}
}
enum LogicalExtent { LogicalWidth, LogicalHeight };
-static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalExtent logicalSide, const CSSPropertyID* properties)
+static CSSPropertyID resolveToPhysicalProperty(WritingMode, LogicalExtent logicalSide, const CSSPropertyID* properties)
{
- if (writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode)
- return properties[logicalSide];
- return logicalSide == LogicalWidth ? properties[1] : properties[0];
+ // FIXME(sky): Remove
+ return properties[logicalSide];
}
static const StylePropertyShorthand& borderDirections()
« no previous file with comments | « sky/engine/core/css/CSSProperties.in ('k') | sky/engine/core/css/CSSValueKeywords.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698