Title: [91410] trunk/Source/WebCore
Revision
91410
Author
[email protected]
Date
2011-07-20 15:00:29 -0700 (Wed, 20 Jul 2011)

Log Message

Pass -webkit-flex() values on to RenderStyle
https://bugs.webkit.org/show_bug.cgi?id=64038

Reviewed by Eric Seidel.

No new tests, this just copies data to RenderStyle, which we can
then access when doing layout.  Tests will come with the layout
changes.

* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyLength::applyValue):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91409 => 91410)


--- trunk/Source/WebCore/ChangeLog	2011-07-20 21:56:05 UTC (rev 91409)
+++ trunk/Source/WebCore/ChangeLog	2011-07-20 22:00:29 UTC (rev 91410)
@@ -1,3 +1,18 @@
+2011-07-20  Tony Chang  <[email protected]>
+
+        Pass -webkit-flex() values on to RenderStyle
+        https://bugs.webkit.org/show_bug.cgi?id=64038
+
+        Reviewed by Eric Seidel.
+
+        No new tests, this just copies data to RenderStyle, which we can
+        then access when doing layout.  Tests will come with the layout
+        changes.
+
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyLength::applyValue):
+        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+
 2011-07-20  Daniel Bates  <[email protected]>
 
         Attempt to fix the GTK build after changeset 91396 <http://trac.webkit.org/changeset/91396>

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (91409 => 91410)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-07-20 21:56:05 UTC (rev 91409)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2011-07-20 22:00:29 UTC (rev 91410)
@@ -26,6 +26,7 @@
 #include "CSSStyleApplyProperty.h"
 
 #include "CSSCursorImageValue.h"
+#include "CSSFlexValue.h"
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSStyleSelector.h"
 #include "CSSValueList.h"
@@ -213,11 +214,13 @@
 enum LengthMinIntrinsic {MinIntrinsicDisabled = 0, MinIntrinsicEnabled = 1};
 enum LengthNone {NoneDisabled = 0, NoneEnabled = 1};
 enum LengthUndefined {UndefinedDisabled = 0, UndefinedEnabled = 1};
+enum LengthFlexDirection {FlexDirectionDisabled = 0, FlexWidth = 1, FlexHeight};
 template <LengthAuto autoEnabled = AutoDisabled,
           LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
           LengthMinIntrinsic minIntrinsicEnabled = MinIntrinsicDisabled,
           LengthNone noneEnabled = NoneDisabled,
-          LengthUndefined noneUndefined = UndefinedDisabled>
+          LengthUndefined noneUndefined = UndefinedDisabled,
+          LengthFlexDirection flexDirection = FlexDirectionDisabled>
 class ApplyPropertyLength : public ApplyPropertyDefaultBase<Length> {
 public:
     ApplyPropertyLength(GetterFunction getter, SetterFunction setter, InitialFunction initial)
@@ -228,8 +231,26 @@
 private:
     virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
     {
+#if ENABLE(CSS3_FLEXBOX)
+        if (!value->isPrimitiveValue()) {
+            if (!flexDirection || !value->isFlexValue())
+                return;
+
+            CSSFlexValue* flexValue = static_cast<CSSFlexValue*>(value);
+            value = flexValue->preferredSize();
+
+            if (flexDirection == FlexWidth) {
+                selector->style()->setFlexboxWidthPositiveFlex(flexValue->positiveFlex());
+                selector->style()->setFlexboxWidthNegativeFlex(flexValue->negativeFlex());
+            } else if (flexDirection == FlexHeight) {
+                selector->style()->setFlexboxHeightPositiveFlex(flexValue->positiveFlex());
+                selector->style()->setFlexboxHeightNegativeFlex(flexValue->negativeFlex());
+            }
+        }
+#else
         if (!value->isPrimitiveValue())
             return;
+#endif
 
         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone)
@@ -749,8 +770,8 @@
     setPropertyHandler(CSSPropertyBottom, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset));
     setPropertyHandler(CSSPropertyLeft, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset));
 
-    setPropertyHandler(CSSPropertyWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize));
-    setPropertyHandler(CSSPropertyHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize));
+    setPropertyHandler(CSSPropertyWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>(&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize));
+    setPropertyHandler(CSSPropertyHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>(&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize));
 
     setPropertyHandler(CSSPropertyTextIndent, new ApplyPropertyLength<>(&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent));
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to