Title: [102837] trunk
Revision
102837
Author
[email protected]
Date
2011-12-14 15:39:24 -0800 (Wed, 14 Dec 2011)

Log Message

Implement flexDirection and flexWrap and make flexFlow a proper shorthand.
https://bugs.webkit.org/show_bug.cgi?id=74542

Reviewed by Tony Chang.

Source/WebCore:

In a followup patch, I'll cleanup all the *Flow methods in RenderFlexibleBox.

Existing tests cover all the rendering behaviors, so only need to test
the css property parsing.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::getPropertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator EFlexDirection):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyLonghand.cpp:
(WebCore::initShorthandMap):
* css/CSSPropertyNames.in:
* css/CSSStyleApplyProperty.cpp:
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::sizesToIntrinsicLogicalWidth):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::isColumnFlow):
(WebCore::RenderFlexibleBox::isLeftToRightFlow):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
(WebCore::RenderFlexibleBox::alignChildren):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::flexDirection):
(WebCore::InheritedFlags::isColumnFlexDirection):
(WebCore::InheritedFlags::setFlexDirection):
(WebCore::InheritedFlags::initialFlexDirection):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleFlexibleBoxData.cpp:
(WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
(WebCore::StyleFlexibleBoxData::operator==):
* rendering/style/StyleFlexibleBoxData.h:

LayoutTests:

* css3/flexbox/css-properties-expected.txt:
* css3/flexbox/script-tests/css-properties.js:
(testFlexFlowValue):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (102836 => 102837)


--- trunk/LayoutTests/ChangeLog	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/LayoutTests/ChangeLog	2011-12-14 23:39:24 UTC (rev 102837)
@@ -1,3 +1,14 @@
+2011-12-14  Ojan Vafai  <[email protected]>
+
+        Implement flexDirection and flexWrap and make flexFlow a proper shorthand.
+        https://bugs.webkit.org/show_bug.cgi?id=74542
+
+        Reviewed by Tony Chang.
+
+        * css3/flexbox/css-properties-expected.txt:
+        * css3/flexbox/script-tests/css-properties.js:
+        (testFlexFlowValue):
+
 2011-12-14  Ryosuke Niwa  <[email protected]>
 
         NodeChildList shouldn't be in NodeListNodeData

Modified: trunk/LayoutTests/css3/flexbox/css-properties-expected.txt (102836 => 102837)


--- trunk/LayoutTests/css3/flexbox/css-properties-expected.txt	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/LayoutTests/css3/flexbox/css-properties-expected.txt	2011-12-14 23:39:24 UTC (rev 102837)
@@ -43,53 +43,120 @@
 PASS window.getComputedStyle(flexbox, null).webkitFlexAlign is "baseline"
 PASS flexbox.style.webkitFlexAlign is ""
 PASS window.getComputedStyle(flexbox, null).webkitFlexAlign is "stretch"
+PASS flexbox.style.webkitFlexDirection is ""
+PASS window.getComputedStyle(flexbox, null).webkitFlexDirection is "row"
+PASS flexbox.style.webkitFlexDirection is ""
+PASS flexbox.style.webkitFlexDirection is "row"
+PASS window.getComputedStyle(flexbox, null).webkitFlexDirection is "row"
+PASS flexbox.style.webkitFlexDirection is "row-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexDirection is "row-reverse"
+PASS flexbox.style.webkitFlexDirection is "column"
+PASS window.getComputedStyle(flexbox, null).webkitFlexDirection is "column"
+PASS flexbox.style.webkitFlexDirection is "column-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexDirection is "column-reverse"
+PASS flexbox.style.webkitFlexWrap is ""
+PASS window.getComputedStyle(flexbox, null).webkitFlexWrap is "nowrap"
+PASS flexbox.style.webkitFlexWrap is ""
+PASS flexbox.style.webkitFlexWrap is "nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexWrap is "nowrap"
+PASS flexbox.style.webkitFlexWrap is "wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexWrap is "wrap"
+PASS flexbox.style.webkitFlexWrap is "wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexWrap is "wrap-reverse"
 PASS flexbox.style.webkitFlexFlow is ""
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
 PASS flexbox.style.webkitFlexFlow is ""
 PASS flexbox.style.webkitFlexFlow is ""
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
-PASS flexbox.style.webkitFlexFlow is "row nowrap"
+PASS flexbox.style.webkitFlexFlow is ""
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
-PASS flexbox.style.webkitFlexFlow is "row wrap"
+PASS flexbox.style.webkitFlexFlow is "nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
+PASS flexbox.style.webkitFlexFlow is "nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
+PASS flexbox.style.webkitFlexFlow is "wrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap"
-PASS flexbox.style.webkitFlexFlow is "row wrap-reverse"
+PASS flexbox.style.webkitFlexFlow is "wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap"
+PASS flexbox.style.webkitFlexFlow is "wrap-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap-reverse"
+PASS flexbox.style.webkitFlexFlow is "wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap-reverse"
 PASS flexbox.style.webkitFlexFlow is "row"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
+PASS flexbox.style.webkitFlexFlow is "row"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
 PASS flexbox.style.webkitFlexFlow is "row nowrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
+PASS flexbox.style.webkitFlexFlow is "row nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
 PASS flexbox.style.webkitFlexFlow is "row wrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap"
+PASS flexbox.style.webkitFlexFlow is "row wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap"
 PASS flexbox.style.webkitFlexFlow is "row wrap-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap-reverse"
+PASS flexbox.style.webkitFlexFlow is "row wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row wrap-reverse"
 PASS flexbox.style.webkitFlexFlow is "row-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse nowrap"
+PASS flexbox.style.webkitFlexFlow is "row-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse nowrap"
 PASS flexbox.style.webkitFlexFlow is "row-reverse nowrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse nowrap"
+PASS flexbox.style.webkitFlexFlow is "row-reverse nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse nowrap"
 PASS flexbox.style.webkitFlexFlow is "row-reverse wrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse wrap"
+PASS flexbox.style.webkitFlexFlow is "row-reverse wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse wrap"
 PASS flexbox.style.webkitFlexFlow is "row-reverse wrap-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse wrap-reverse"
+PASS flexbox.style.webkitFlexFlow is "row-reverse wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse wrap-reverse"
 PASS flexbox.style.webkitFlexFlow is "column"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column nowrap"
+PASS flexbox.style.webkitFlexFlow is "column"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column nowrap"
 PASS flexbox.style.webkitFlexFlow is "column nowrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column nowrap"
+PASS flexbox.style.webkitFlexFlow is "column nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column nowrap"
 PASS flexbox.style.webkitFlexFlow is "column wrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column wrap"
+PASS flexbox.style.webkitFlexFlow is "column wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column wrap"
 PASS flexbox.style.webkitFlexFlow is "column wrap-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column wrap-reverse"
+PASS flexbox.style.webkitFlexFlow is "column wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column wrap-reverse"
 PASS flexbox.style.webkitFlexFlow is "column-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse nowrap"
+PASS flexbox.style.webkitFlexFlow is "column-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse nowrap"
 PASS flexbox.style.webkitFlexFlow is "column-reverse nowrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse nowrap"
+PASS flexbox.style.webkitFlexFlow is "column-reverse nowrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse nowrap"
 PASS flexbox.style.webkitFlexFlow is "column-reverse wrap"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse wrap"
+PASS flexbox.style.webkitFlexFlow is "column-reverse wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse wrap"
 PASS flexbox.style.webkitFlexFlow is "column-reverse wrap-reverse"
 PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse wrap-reverse"
+PASS flexbox.style.webkitFlexFlow is "column-reverse wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column-reverse wrap-reverse"
 PASS flexbox.style.webkitFlexFlow is ""
 PASS flexbox.style.webkitFlexFlow is ""
 PASS flexbox.style.webkitFlexFlow is ""
 PASS flexbox.style.webkitFlexFlow is ""
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row nowrap"
+PASS flexbox.style.webkitFlexFlow is "column"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column nowrap"
+PASS flexbox.style.webkitFlexFlow is "column wrap"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "column wrap"
+PASS flexbox.style.webkitFlexFlow is "row-reverse wrap-reverse"
+PASS window.getComputedStyle(flexbox, null).webkitFlexFlow is "row-reverse wrap-reverse"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/css3/flexbox/script-tests/css-properties.js (102836 => 102837)


--- trunk/LayoutTests/css3/flexbox/script-tests/css-properties.js	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/LayoutTests/css3/flexbox/script-tests/css-properties.js	2011-12-14 23:39:24 UTC (rev 102837)
@@ -100,34 +100,91 @@
 shouldBeEqualToString('flexbox.style.webkitFlexAlign', '');
 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexAlign', 'stretch');
 
+shouldBeEqualToString('flexbox.style.webkitFlexDirection', '');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexDirection', 'row');
+
+flexbox.style.webkitFlexDirection = 'foo';
+shouldBeEqualToString('flexbox.style.webkitFlexDirection', '');
+
+flexbox.style.webkitFlexDirection = 'row';
+shouldBeEqualToString('flexbox.style.webkitFlexDirection', 'row');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexDirection', 'row');
+
+flexbox.style.webkitFlexDirection = 'row-reverse';
+shouldBeEqualToString('flexbox.style.webkitFlexDirection', 'row-reverse');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexDirection', 'row-reverse');
+
+flexbox.style.webkitFlexDirection = 'column';
+shouldBeEqualToString('flexbox.style.webkitFlexDirection', 'column');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexDirection', 'column');
+
+flexbox.style.webkitFlexDirection = 'column-reverse';
+shouldBeEqualToString('flexbox.style.webkitFlexDirection', 'column-reverse');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexDirection', 'column-reverse');
+
+shouldBeEqualToString('flexbox.style.webkitFlexWrap', '');
+// The initial value is 'stretch'.
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexWrap', 'nowrap');
+
+flexbox.style.webkitFlexWrap = 'foo';
+shouldBeEqualToString('flexbox.style.webkitFlexWrap', '');
+
+flexbox.style.webkitFlexWrap = 'nowrap';
+shouldBeEqualToString('flexbox.style.webkitFlexWrap', 'nowrap');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexWrap', 'nowrap');
+
+flexbox.style.webkitFlexWrap = 'wrap';
+shouldBeEqualToString('flexbox.style.webkitFlexWrap', 'wrap');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexWrap', 'wrap');
+
+flexbox.style.webkitFlexWrap = 'wrap-reverse';
+shouldBeEqualToString('flexbox.style.webkitFlexWrap', 'wrap-reverse');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexWrap', 'wrap-reverse');
+
+flexbox.style.webkitFlexFlow = '';
 shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
 shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', 'row nowrap');
 
 flexbox.style.webkitFlexFlow = 'foo';
 shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
 
-var flows = ['', 'row', 'row-reverse', 'column', 'column-reverse'];
+function testFlexFlowValue(value, expected, expectedComputed)
+{
+    flexbox.style.webkitFlexFlow = value;
+    shouldBeEqualToString('flexbox.style.webkitFlexFlow', expected.replace(/^ /, '').replace(/ $/, ''));
+    shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', expectedComputed);
+}
+
+var directions = ['', 'row', 'row-reverse', 'column', 'column-reverse'];
 var wraps = ['', 'nowrap', 'wrap', 'wrap-reverse'];
-flows.forEach(function(flow) {
+directions.forEach(function(direction) {
     wraps.forEach(function(wrap) {
-        flexbox.style.webkitFlexFlow = flow + ' ' + wrap;
-        shouldBeEqualToString('flexbox.style.webkitFlexFlow', (flow + ' ' + wrap).replace(/^ /, '').replace(/ $/, ''));
-        if (!flow)
-            flow = 'row';
-        if (!wrap)
-            wrap = 'nowrap';
-        shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', flow + ' ' + wrap);
+        var expectedComputed = (direction || 'row') + ' ' + (wrap || 'nowrap');
+        var expected = direction + ' ' + wrap;
+        testFlexFlowValue(direction + ' ' + wrap, expected, expectedComputed);
+        testFlexFlowValue(wrap + ' ' + direction, expected, expectedComputed);
     });
 });
 
 flexbox.style.webkitFlexFlow = '';
+shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
 flexbox.style.webkitFlexFlow = 'wrap wrap-reverse';
 shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
-flexbox.style.webkitFlexFlow = 'wrap-reverse column';
-shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
-flexbox.style.webkitFlexFlow = 'wrap row';
-shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
 flexbox.style.webkitFlexFlow = 'column row';
 shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
 
+flexbox.style.webkitFlexFlow = '';
+shouldBeEqualToString('flexbox.style.webkitFlexFlow', '');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', 'row nowrap');
+flexbox.style.webkitFlexDirection = 'column';
+shouldBeEqualToString('flexbox.style.webkitFlexFlow', 'column');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', 'column nowrap');
+flexbox.style.webkitFlexWrap = 'wrap';
+shouldBeEqualToString('flexbox.style.webkitFlexFlow', 'column wrap');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', 'column wrap');
+flexbox.style.webkitFlexFlow = 'row-reverse wrap-reverse';
+shouldBeEqualToString('flexbox.style.webkitFlexFlow', 'row-reverse wrap-reverse');
+shouldBeEqualToString('window.getComputedStyle(flexbox, null).webkitFlexFlow', 'row-reverse wrap-reverse');
+
+
 successfullyParsed = true;

Modified: trunk/Source/WebCore/ChangeLog (102836 => 102837)


--- trunk/Source/WebCore/ChangeLog	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/ChangeLog	2011-12-14 23:39:24 UTC (rev 102837)
@@ -1,3 +1,51 @@
+2011-12-14  Ojan Vafai  <[email protected]>
+
+        Implement flexDirection and flexWrap and make flexFlow a proper shorthand.
+        https://bugs.webkit.org/show_bug.cgi?id=74542
+
+        Reviewed by Tony Chang.
+
+        In a followup patch, I'll cleanup all the *Flow methods in RenderFlexibleBox.
+
+        Existing tests cover all the rendering behaviors, so only need to test
+        the css property parsing.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSMutableStyleDeclaration.cpp:
+        (WebCore::CSSMutableStyleDeclaration::getPropertyValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator EFlexDirection):
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyLonghand.cpp:
+        (WebCore::initShorthandMap):
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::sizesToIntrinsicLogicalWidth):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::isColumnFlow):
+        (WebCore::RenderFlexibleBox::isLeftToRightFlow):
+        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
+        (WebCore::RenderFlexibleBox::alignChildren):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::flexDirection):
+        (WebCore::InheritedFlags::isColumnFlexDirection):
+        (WebCore::InheritedFlags::setFlexDirection):
+        (WebCore::InheritedFlags::initialFlexDirection):
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleFlexibleBoxData.cpp:
+        (WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
+        (WebCore::StyleFlexibleBoxData::operator==):
+        * rendering/style/StyleFlexibleBoxData.h:
+
 2011-12-13  Jon Lee  <[email protected]>
 
         Enable notifications on Mac.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -218,7 +218,9 @@
     CSSPropertyWebkitFlexOrder,
     CSSPropertyWebkitFlexPack,
     CSSPropertyWebkitFlexAlign,
+    CSSPropertyWebkitFlexDirection,
     CSSPropertyWebkitFlexFlow,
+    CSSPropertyWebkitFlexWrap,
     CSSPropertyWebkitFontSmoothing,
 #if ENABLE(CSS_GRID_LAYOUT)
     CSSPropertyWebkitGridColumns,
@@ -1484,9 +1486,13 @@
             return cssValuePool->createValue(style->flexPack());
         case CSSPropertyWebkitFlexAlign:
             return cssValuePool->createValue(style->flexAlign());
+        case CSSPropertyWebkitFlexDirection:
+            return cssValuePool->createValue(style->flexDirection());
+        case CSSPropertyWebkitFlexWrap:
+            return cssValuePool->createValue(style->flexWrap());
         case CSSPropertyWebkitFlexFlow: {
             RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-            list->append(cssValuePool->createValue(style->flexFlow()));
+            list->append(cssValuePool->createValue(style->flexDirection()));
             list->append(cssValuePool->createValue(style->flexWrap()));
             return list.release();
         }

Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -286,6 +286,10 @@
                                         CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
             return get4Values(properties);
         }
+        case CSSPropertyWebkitFlexFlow: {
+            const int properties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap };
+            return getShorthandValue(properties);
+        }
         case CSSPropertyFont:
             return fontValue();
         case CSSPropertyMargin: {

Modified: trunk/Source/WebCore/css/CSSParser.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -1620,25 +1620,12 @@
     case CSSPropertyWebkitFlexAlign:
         validPrimitive = id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueBaseline || id == CSSValueStretch;
         break;
-    case CSSPropertyWebkitFlexFlow:
-        // FIXME: Use parseShorthand once we add flex-direction and flex-wrap.
-        // [ row | row-reverse | column | column-reverse ] || [ nowrap | wrap | wrap-reverse ]?
+    case CSSPropertyWebkitFlexDirection:
         validPrimitive = id == CSSValueRow || id == CSSValueRowReverse || id == CSSValueColumn || id == CSSValueColumnReverse;
-        if (!validPrimitive)
-            validPrimitive = id == CSSValueNowrap || id == CSSValueWrap || id == CSSValueWrapReverse;
-        else if (validPrimitive && num == 2) {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-            list->append(cssValuePool()->createIdentifierValue(id));
-
-            value = m_valueList->next();
-            if (value->id != CSSValueNowrap && value->id != CSSValueWrap && value->id != CSSValueWrapReverse)
-                return false;
-
-            list->append(cssValuePool()->createIdentifierValue(value->id));
-            addProperty(propId, list, important);
-            return true;
-        }
         break;
+    case CSSPropertyWebkitFlexWrap:
+        validPrimitive = id == CSSValueNowrap || id == CSSValueWrap || id == CSSValueWrapReverse;
+        break;
     case CSSPropertyWebkitMarquee: {
         const int properties[5] = { CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement,
                                     CSSPropertyWebkitMarqueeRepetition,
@@ -2133,6 +2120,11 @@
                                     CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
         return parse4Values(propId, properties, important);
     }
+    case CSSPropertyWebkitFlexFlow:
+    {
+        const int properties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap };
+        return parseShorthand(propId, properties, 2, important);
+    }
     case CSSPropertyFont:
         // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]?
         // 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (102836 => 102837)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2011-12-14 23:39:24 UTC (rev 102837)
@@ -1200,7 +1200,7 @@
     }
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexFlow e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_IDENT;
@@ -1220,7 +1220,7 @@
     }
 }
 
-template<> inline CSSPrimitiveValue::operator EFlexFlow() const
+template<> inline CSSPrimitiveValue::operator EFlexDirection() const
 {
     switch (m_value.ident) {
     case CSSValueRow:

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -559,7 +559,9 @@
     case CSSPropertyWebkitFlexOrder:
     case CSSPropertyWebkitFlexPack:
     case CSSPropertyWebkitFlexAlign:
+    case CSSPropertyWebkitFlexDirection:
     case CSSPropertyWebkitFlexFlow:
+    case CSSPropertyWebkitFlexWrap:
     case CSSPropertyWebkitFontSizeDelta:
 #if ENABLE(CSS_GRID_LAYOUT)
     case CSSPropertyWebkitGridColumns:

Modified: trunk/Source/WebCore/css/CSSPropertyLonghand.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSPropertyLonghand.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSPropertyLonghand.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -91,6 +91,9 @@
     static const int borderSpacingProperties[] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing };
     SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyBorderSpacing, borderSpacingProperties);
 
+    static const int flexFlowProperties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap };
+    SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitFlexFlow, flexFlowProperties);
+
     static const int listStyleProperties[] = {
         CSSPropertyListStyleImage,
         CSSPropertyListStylePosition,

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (102836 => 102837)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2011-12-14 23:39:24 UTC (rev 102837)
@@ -254,9 +254,11 @@
 -webkit-filter
 #endif
 -webkit-flex-align
+-webkit-flex-direction
 -webkit-flex-flow
 -webkit-flex-order
 -webkit-flex-pack
+-webkit-flex-wrap
 -webkit-font-size-delta
 -webkit-highlight
 -webkit-hyphenate-character

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -1336,38 +1336,6 @@
     }
 };
 
-class ApplyPropertyFlexFlow {
-public:
-    static void applyInheritValue(CSSStyleSelector*) { }
-
-    static void applyInitialValue(CSSStyleSelector* selector)
-    {
-        selector->style()->setFlexFlow(RenderStyle::initialFlexFlow());
-        selector->style()->setFlexWrap(RenderStyle::initialFlexWrap());
-    }
-
-    static void applyValue(CSSStyleSelector* selector, CSSValue* value)
-    {
-        if (value->isPrimitiveValue()) {
-            selector->style()->setFlexFlow(*static_cast<CSSPrimitiveValue*>(value));
-            return;
-        }
-        if (value->isValueList()) {
-            CSSValueList* list = static_cast<CSSValueList*>(value);
-            if (list->length() != 2)
-                return;
-
-            selector->style()->setFlexFlow(*static_cast<CSSPrimitiveValue*>(list->itemWithoutBoundsCheck(0)));
-            selector->style()->setFlexWrap(*static_cast<CSSPrimitiveValue*>(list->itemWithoutBoundsCheck(1)));
-        }
-    }
-
-    static PropertyHandler createHandler()
-    {
-        return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
-    }
-};
-
 class ApplyPropertyDisplay {
 private:
     static inline bool isValidDisplayValue(CSSStyleSelector* selector, EDisplay displayPropertyValue)
@@ -1553,7 +1521,9 @@
     setPropertyHandler(CSSPropertyWebkitFlexOrder, ApplyPropertyDefault<int, &RenderStyle::flexOrder, int, &RenderStyle::setFlexOrder, int, &RenderStyle::initialFlexOrder>::createHandler());
     setPropertyHandler(CSSPropertyWebkitFlexPack, ApplyPropertyDefault<EFlexPack, &RenderStyle::flexPack, EFlexPack, &RenderStyle::setFlexPack, EFlexPack, &RenderStyle::initialFlexPack>::createHandler());
     setPropertyHandler(CSSPropertyWebkitFlexAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexAlign, EFlexAlign, &RenderStyle::setFlexAlign, EFlexAlign, &RenderStyle::initialFlexAlign>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyFlexFlow::createHandler());
+    setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitFlexFlow, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap>::createHandler());
 
     setPropertyHandler(CSSPropertyFontStyle, ApplyPropertyFont<FontItalic, &FontDescription::italic, &FontDescription::setItalic, FontItalicOff>::createHandler());
     setPropertyHandler(CSSPropertyFontVariant, ApplyPropertyFont<FontSmallCaps, &FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff>::createHandler());

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (102836 => 102837)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -3801,7 +3801,9 @@
     case CSSPropertyWebkitFlexOrder:
     case CSSPropertyWebkitFlexPack:
     case CSSPropertyWebkitFlexAlign:
+    case CSSPropertyWebkitFlexDirection:
     case CSSPropertyWebkitFlexFlow:
+    case CSSPropertyWebkitFlexWrap:
     case CSSPropertyFontStyle:
     case CSSPropertyFontVariant:
     case CSSPropertyTextRendering:

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (102836 => 102837)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -1795,7 +1795,7 @@
     // Flexible box items should shrink wrap, so we lay them out at their intrinsic widths.
     // In the case of columns that have a stretch alignment, we go ahead and layout at the
     // stretched size to avoid an extra layout when applying alignment.
-    if (parent()->isFlexibleBox() && (!parent()->style()->isColumnFlexFlow() || style()->flexAlign() != AlignStretch))
+    if (parent()->isFlexibleBox() && (!parent()->style()->isColumnFlexDirection() || style()->flexAlign() != AlignStretch))
         return true;
 
     // Flexible horizontal boxes lay out children at their intrinsic widths.  Also vertical boxes

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (102836 => 102837)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -203,7 +203,7 @@
 
 bool RenderFlexibleBox::isColumnFlow() const
 {
-    return style()->isColumnFlexFlow();
+    return style()->isColumnFlexDirection();
 }
 
 bool RenderFlexibleBox::isHorizontalFlow() const
@@ -217,7 +217,7 @@
 {
     if (isColumnFlow())
         return style()->writingMode() == TopToBottomWritingMode || style()->writingMode() == LeftToRightWritingMode;
-    return style()->isLeftToRightDirection() ^ (style()->flexFlow() == FlowRowReverse);
+    return style()->isLeftToRightDirection() ^ (style()->flexDirection() == FlowRowReverse);
 }
 
 Length RenderFlexibleBox::mainAxisLengthForChild(RenderBox* child) const
@@ -636,7 +636,7 @@
             setLogicalHeight(mainAxisOffset);
     }
 
-    if (style()->flexFlow() == FlowColumnReverse) {
+    if (style()->flexDirection() == FlowColumnReverse) {
         // We have to do an extra pass for column-reverse to reposition the flex items since the start depends
         // on the height of the flexbox, which we only know after we've positioned all the flex items.
         computeLogicalHeight();
@@ -687,7 +687,7 @@
     LayoutUnit crossExtent = crossAxisExtent();
 
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-        // direction:rtl + flex-flow:column means the cross-axis direction is flipped.
+        // direction:rtl + flex-direction:column means the cross-axis direction is flipped.
         if (!style()->isLeftToRightDirection() && isColumnFlow()) {
             LayoutPoint location = flowAwareLocationForChild(child);
             location.setY(crossExtent - crossAxisExtentForChild(child) - location.y());

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (102836 => 102837)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-12-14 23:39:24 UTC (rev 102837)
@@ -725,8 +725,8 @@
     int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; }
     EFlexPack flexPack() const { return static_cast<EFlexPack>(rareNonInheritedData->m_flexibleBox->m_flexPack); }
     EFlexAlign flexAlign() const { return static_cast<EFlexAlign>(rareNonInheritedData->m_flexibleBox->m_flexAlign); }
-    EFlexFlow flexFlow() const { return static_cast<EFlexFlow>(rareNonInheritedData->m_flexibleBox->m_flexFlow); }
-    bool isColumnFlexFlow() const { return flexFlow() == FlowColumn || flexFlow() == FlowColumnReverse; }
+    EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
+    bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
     EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
 
 #if ENABLE(CSS_GRID_LAYOUT)
@@ -1147,7 +1147,7 @@
     void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); }
     void setFlexPack(EFlexPack p) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexPack, p); }
     void setFlexAlign(EFlexAlign a) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexAlign, a); }
-    void setFlexFlow(EFlexFlow flow) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexFlow, flow); }
+    void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
     void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
 #if ENABLE(CSS_GRID_LAYOUT)
     void setGridColumns(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); }
@@ -1471,7 +1471,7 @@
     static int initialFlexOrder() { return 0; }
     static EFlexPack initialFlexPack() { return PackStart; }
     static EFlexAlign initialFlexAlign() { return AlignStretch; }
-    static EFlexFlow initialFlexFlow() { return FlowRow; }
+    static EFlexDirection initialFlexDirection() { return FlowRow; }
     static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
     static int initialMarqueeLoopCount() { return -1; }
     static int initialMarqueeSpeed() { return 85; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (102836 => 102837)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2011-12-14 23:39:24 UTC (rev 102837)
@@ -177,7 +177,7 @@
 
 enum EFlexPack { PackStart, PackEnd, PackCenter, PackJustify };
 enum EFlexAlign { AlignStart, AlignEnd, AlignCenter, AlignStretch, AlignBaseline };
-enum EFlexFlow { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse };
+enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse };
 enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse };
 
 enum ETextSecurity {

Modified: trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp (102836 => 102837)


--- trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp	2011-12-14 23:39:24 UTC (rev 102837)
@@ -38,7 +38,7 @@
     , m_flexOrder(RenderStyle::initialFlexOrder())
     , m_flexPack(RenderStyle::initialFlexPack())
     , m_flexAlign(RenderStyle::initialFlexAlign())
-    , m_flexFlow(RenderStyle::initialFlexFlow())
+    , m_flexDirection(RenderStyle::initialFlexDirection())
     , m_flexWrap(RenderStyle::initialFlexWrap())
 {
 }
@@ -52,7 +52,7 @@
     , m_flexOrder(o.m_flexOrder)
     , m_flexPack(o.m_flexPack)
     , m_flexAlign(o.m_flexAlign)
-    , m_flexFlow(o.m_flexFlow)
+    , m_flexDirection(o.m_flexDirection)
     , m_flexWrap(o.m_flexWrap)
 {
 }
@@ -62,7 +62,7 @@
     return m_widthPositiveFlex == o.m_widthPositiveFlex && m_widthNegativeFlex == o.m_widthNegativeFlex
         && m_heightPositiveFlex == o.m_heightPositiveFlex && m_heightNegativeFlex == o.m_heightNegativeFlex
         && m_flexOrder == o.m_flexOrder && m_flexPack == o.m_flexPack && m_flexAlign == o.m_flexAlign
-        && m_flexFlow == o.m_flexFlow && m_flexWrap == o.m_flexWrap;
+        && m_flexDirection == o.m_flexDirection && m_flexWrap == o.m_flexWrap;
 }
 
 }

Modified: trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h (102836 => 102837)


--- trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h	2011-12-14 23:32:57 UTC (rev 102836)
+++ trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h	2011-12-14 23:39:24 UTC (rev 102837)
@@ -51,7 +51,7 @@
 
     unsigned m_flexPack : 2; // EFlexPack
     unsigned m_flexAlign : 3; // EFlexAlign
-    unsigned m_flexFlow : 2; // EFlexFlow
+    unsigned m_flexDirection : 2; // EFlexDirection
     unsigned m_flexWrap : 2; // EFlexWrap
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to