Title: [93528] trunk
Revision
93528
Author
[email protected]
Date
2011-08-22 12:08:36 -0700 (Mon, 22 Aug 2011)

Log Message

Add CSS parsing of -webkit-flex-order
https://bugs.webkit.org/show_bug.cgi?id=65384

Source/WebCore:

The property is an int described here:
http://dev.w3.org/csswg/css3-flexbox/#flex-order

Doesn't do anything yet, just hooking it up.

Reviewed by Ojan Vafai.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPropertyNames.in:
* css/CSSStyleApplyProperty.cpp:
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::flexOrder):
(WebCore::InheritedFlags::setFlexOrder):
(WebCore::InheritedFlags::initialFlexOrder):
* rendering/style/StyleFlexibleBoxData.cpp:
(WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
(WebCore::StyleFlexibleBoxData::operator==):
* rendering/style/StyleFlexibleBoxData.h:

LayoutTests:

Reviewed by Ojan Vafai.

* css3/flexbox/css-properties-expected.txt:
* css3/flexbox/css-properties.html:
* css3/flexbox/script-tests/css-properties.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (93527 => 93528)


--- trunk/LayoutTests/ChangeLog	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/LayoutTests/ChangeLog	2011-08-22 19:08:36 UTC (rev 93528)
@@ -1,3 +1,14 @@
+2011-08-22  Tony Chang  <[email protected]>
+
+        Add CSS parsing of -webkit-flex-order
+        https://bugs.webkit.org/show_bug.cgi?id=65384
+
+        Reviewed by Ojan Vafai.
+
+        * css3/flexbox/css-properties-expected.txt:
+        * css3/flexbox/css-properties.html:
+        * css3/flexbox/script-tests/css-properties.js:
+
 2011-08-22  Nate Chapin  <[email protected]>
 
         Test for https://bugs.webkit.org/show_bug.cgi?id=64741.

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


--- trunk/LayoutTests/css3/flexbox/css-properties-expected.txt	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/LayoutTests/css3/flexbox/css-properties-expected.txt	2011-08-22 19:08:36 UTC (rev 93528)
@@ -8,6 +8,13 @@
 PASS div.style.display is "-webkit-inline-flexbox"
 PASS div.style.display is "-webkit-inline-flexbox"
 PASS div.style.display is "block"
+PASS flexitem.style.webkitFlexOrder is ""
+PASS flexitem.style.webkitFlexOrder is "2"
+PASS flexitem.style.webkitFlexOrder is "-1"
+PASS flexitem.style.webkitFlexOrder is "0"
+PASS flexitem.style.webkitFlexOrder is "0"
+PASS flexitem.style.webkitFlexOrder is "0"
+PASS flexitem.style.webkitFlexOrder is ""
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/css3/flexbox/css-properties.html (93527 => 93528)


--- trunk/LayoutTests/css3/flexbox/css-properties.html	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/LayoutTests/css3/flexbox/css-properties.html	2011-08-22 19:08:36 UTC (rev 93528)
@@ -6,6 +6,9 @@
 </head>
 <body>
 <p id="description"></p>
+<div id="flexbox">
+    <div id="flexitem"></div>
+</div>
 <div id="console"></div>
 <script src=""
 <script src=""

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


--- trunk/LayoutTests/css3/flexbox/script-tests/css-properties.js	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/LayoutTests/css3/flexbox/script-tests/css-properties.js	2011-08-22 19:08:36 UTC (rev 93528)
@@ -1,6 +1,6 @@
 description('Tests being able to set the display to -webkit-flexbox and -webkit-inline-flexbox.');
 
-var div = document.createElement('div');
+var div = document.getElementById("flexbox");
 
 div.style.display = '-webkit-flexbox';
 shouldBeEqualToString('div.style.display', '-webkit-flexbox');
@@ -17,4 +17,26 @@
 div.style.display = 'block';
 shouldBeEqualToString('div.style.display', 'block');
 
+var flexitem = document.getElementById("flexitem");
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '');
+
+flexitem.style.webkitFlexOrder = 2;
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '2');
+
+flexitem.style.webkitFlexOrder = -1;
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '-1');
+
+flexitem.style.webkitFlexOrder = 0;
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '0');
+
+// -webkit-flex-order must be an integer.
+flexitem.style.webkitFlexOrder = 1.5;
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '0');
+
+flexitem.style.webkitFlexOrder = "test";
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '0');
+
+flexitem.style.webkitFlexOrder = '';
+shouldBeEqualToString('flexitem.style.webkitFlexOrder', '');
+
 successfullyParsed = true;

Modified: trunk/Source/WebCore/ChangeLog (93527 => 93528)


--- trunk/Source/WebCore/ChangeLog	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/ChangeLog	2011-08-22 19:08:36 UTC (rev 93528)
@@ -1,3 +1,33 @@
+2011-08-22  Tony Chang  <[email protected]>
+
+        Add CSS parsing of -webkit-flex-order
+        https://bugs.webkit.org/show_bug.cgi?id=65384
+
+        The property is an int described here:
+        http://dev.w3.org/csswg/css3-flexbox/#flex-order
+
+        Doesn't do anything yet, just hooking it up.
+
+        Reviewed by Ojan Vafai.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::flexOrder):
+        (WebCore::InheritedFlags::setFlexOrder):
+        (WebCore::InheritedFlags::initialFlexOrder):
+        * rendering/style/StyleFlexibleBoxData.cpp:
+        (WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
+        (WebCore::StyleFlexibleBoxData::operator==):
+        * rendering/style/StyleFlexibleBoxData.h:
+
 2011-08-22  Adrienne Walker  <[email protected]>
 
         [chromium] Fix nullptr deref when switching composited tabs

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (93527 => 93528)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-08-22 19:08:36 UTC (rev 93528)
@@ -199,6 +199,9 @@
 #if ENABLE(DASHBOARD_SUPPORT)
     CSSPropertyWebkitDashboardRegion,
 #endif
+#if ENABLE(CSS3_FLEXBOX)
+    CSSPropertyWebkitFlexOrder,
+#endif
     CSSPropertyWebkitFontSmoothing,
     CSSPropertyWebkitHighlight,
     CSSPropertyWebkitHyphenateCharacter,
@@ -1099,6 +1102,10 @@
             return primitiveValueCache->createValue(style->display());
         case CSSPropertyEmptyCells:
             return primitiveValueCache->createValue(style->emptyCells());
+#if ENABLE(CSS3_FLEXBOX)
+        case CSSPropertyWebkitFlexOrder:
+            return primitiveValueCache->createValue(style->flexOrder(), CSSPrimitiveValue::CSS_NUMBER);
+#endif
         case CSSPropertyFloat:
             return primitiveValueCache->createValue(style->floating());
         case CSSPropertyFontFamily: {

Modified: trunk/Source/WebCore/css/CSSParser.cpp (93527 => 93528)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-08-22 19:08:36 UTC (rev 93528)
@@ -1536,6 +1536,11 @@
     case CSSPropertyWebkitColorCorrection:
         validPrimitive = id == CSSValueSrgb || id == CSSValueDefault;
         break;
+#if ENABLE(CSS3_FLEXBOX)
+    case CSSPropertyWebkitFlexOrder:
+        validPrimitive = validUnit(value, FInteger, true);
+        break;
+#endif
     case CSSPropertyWebkitMarquee: {
         const int properties[5] = { CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement,
                                     CSSPropertyWebkitMarqueeRepetition,

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (93527 => 93528)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2011-08-22 19:08:36 UTC (rev 93528)
@@ -242,6 +242,9 @@
 -webkit-column-span
 -webkit-column-width
 -webkit-columns
+#if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX
+-webkit-flex-order
+#endif
 -webkit-font-size-delta
 -webkit-highlight
 -webkit-hyphenate-character

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (93527 => 93528)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-08-22 19:08:36 UTC (rev 93528)
@@ -889,6 +889,10 @@
     setPropertyHandler(CSSPropertyCounterIncrement, new ApplyPropertyCounter<Increment>());
     setPropertyHandler(CSSPropertyCounterReset, new ApplyPropertyCounter<Reset>());
 
+#if ENABLE(CSS3_FLEXBOX)
+    setPropertyHandler(CSSPropertyWebkitFlexOrder, new ApplyPropertyDefault<int>(&RenderStyle::flexOrder, &RenderStyle::setFlexOrder, &RenderStyle::initialFlexOrder));
+#endif
+
     setPropertyHandler(CSSPropertyFontStyle, new ApplyPropertyFont<FontItalic>(&FontDescription::italic, &FontDescription::setItalic, FontItalicOff));
     setPropertyHandler(CSSPropertyFontVariant, new ApplyPropertyFont<FontSmallCaps>(&FontDescription::smallCaps, &FontDescription::setSmallCaps, FontSmallCapsOff));
     setPropertyHandler(CSSPropertyTextRendering, new ApplyPropertyFont<TextRenderingMode>(&FontDescription::textRenderingMode, &FontDescription::setTextRenderingMode, AutoTextRendering));

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (93527 => 93528)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-08-22 19:08:36 UTC (rev 93528)
@@ -5110,6 +5110,9 @@
     case CSSPropertyCounterReset:
     case CSSPropertyLetterSpacing:
     case CSSPropertyWordSpacing:
+#if ENABLE(CSS3_FLEXBOX)
+    case CSSPropertyWebkitFlexOrder:
+#endif
     case CSSPropertyFontStyle:
     case CSSPropertyFontVariant:
     case CSSPropertyTextRendering:

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (93527 => 93528)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-08-22 19:08:36 UTC (rev 93528)
@@ -676,6 +676,7 @@
     float flexboxWidthNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_widthNegativeFlex; }
     float flexboxHeightPositiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightPositiveFlex; }
     float flexboxHeightNegativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_heightNegativeFlex; }
+    int flexOrder() const { return rareNonInheritedData->m_flexibleBox->m_flexOrder; }
 #endif
 
     const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
@@ -1060,6 +1061,7 @@
     void setFlexboxWidthNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_widthNegativeFlex, f); }
     void setFlexboxHeightPositiveFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightPositiveFlex, f); }
     void setFlexboxHeightNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_heightNegativeFlex, f); }
+    void setFlexOrder(int o) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexOrder, o); }
 #endif
     void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
     void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
@@ -1314,6 +1316,7 @@
     static float initialFlexboxWidthNegativeFlex() { return 0; }
     static float initialFlexboxHeightPositiveFlex() { return 0; }
     static float initialFlexboxHeightNegativeFlex() { return 0; }
+    static int initialFlexOrder() { return 1; }
     static int initialMarqueeLoopCount() { return -1; }
     static int initialMarqueeSpeed() { return 85; }
     static Length initialMarqueeIncrement() { return Length(6, Fixed); }

Modified: trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp (93527 => 93528)


--- trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp	2011-08-22 19:08:36 UTC (rev 93528)
@@ -37,6 +37,7 @@
     , m_widthNegativeFlex(RenderStyle::initialFlexboxWidthNegativeFlex())
     , m_heightPositiveFlex(RenderStyle::initialFlexboxHeightPositiveFlex())
     , m_heightNegativeFlex(RenderStyle::initialFlexboxHeightNegativeFlex())
+    , m_flexOrder(RenderStyle::initialFlexOrder())
 {
 }
 
@@ -46,13 +47,15 @@
     , m_widthNegativeFlex(o.m_widthNegativeFlex)
     , m_heightPositiveFlex(o.m_heightPositiveFlex)
     , m_heightNegativeFlex(o.m_heightNegativeFlex)
+    , m_flexOrder(o.m_flexOrder)
 {
 }
 
 bool StyleFlexibleBoxData::operator==(const StyleFlexibleBoxData& o) const
 {
     return m_widthPositiveFlex == o.m_widthPositiveFlex && m_widthNegativeFlex == o.m_widthNegativeFlex
-        && m_heightPositiveFlex == o.m_heightPositiveFlex && m_heightNegativeFlex == o.m_heightNegativeFlex;
+        && m_heightPositiveFlex == o.m_heightPositiveFlex && m_heightNegativeFlex == o.m_heightNegativeFlex
+        && m_flexOrder == o.m_flexOrder;
 }
 
 }

Modified: trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h (93527 => 93528)


--- trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h	2011-08-22 19:03:59 UTC (rev 93527)
+++ trunk/Source/WebCore/rendering/style/StyleFlexibleBoxData.h	2011-08-22 19:08:36 UTC (rev 93528)
@@ -49,6 +49,8 @@
     float m_heightPositiveFlex;
     float m_heightNegativeFlex;
 
+    int m_flexOrder;
+
 private:
     StyleFlexibleBoxData();
     StyleFlexibleBoxData(const StyleFlexibleBoxData&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to