Title: [106704] trunk
Revision
106704
Author
[email protected]
Date
2012-02-03 16:10:18 -0800 (Fri, 03 Feb 2012)

Log Message

positive and negative flex values are not being cleared on style changes
https://bugs.webkit.org/show_bug.cgi?id=77771

Reviewed by Ojan Vafai.

Source/WebCore:

If the width or height was a flex() value, but is no longer a flex
value, we weren't clearing the positive and negative flex values in
RenderStyle.

Test: css3/flexbox/flex-no-flex.html

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

LayoutTests:

* css3/flexbox/flex-no-flex-expected.txt: Added.
* css3/flexbox/flex-no-flex.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106703 => 106704)


--- trunk/LayoutTests/ChangeLog	2012-02-04 00:01:12 UTC (rev 106703)
+++ trunk/LayoutTests/ChangeLog	2012-02-04 00:10:18 UTC (rev 106704)
@@ -1,3 +1,13 @@
+2012-02-03  Tony Chang  <[email protected]>
+
+        positive and negative flex values are not being cleared on style changes
+        https://bugs.webkit.org/show_bug.cgi?id=77771
+
+        Reviewed by Ojan Vafai.
+
+        * css3/flexbox/flex-no-flex-expected.txt: Added.
+        * css3/flexbox/flex-no-flex.html: Added.
+
 2012-02-03  Mihnea Ovidenie  <[email protected]>
 
         Crash in RenderFlowThread::setRegionBoxesRegionStyle

Added: trunk/LayoutTests/css3/flexbox/flex-no-flex-expected.txt (0 => 106704)


--- trunk/LayoutTests/css3/flexbox/flex-no-flex-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/flex-no-flex-expected.txt	2012-02-04 00:10:18 UTC (rev 106704)
@@ -0,0 +1,2 @@
+PASS
+PASS

Added: trunk/LayoutTests/css3/flexbox/flex-no-flex.html (0 => 106704)


--- trunk/LayoutTests/css3/flexbox/flex-no-flex.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/flex-no-flex.html	2012-02-04 00:10:18 UTC (rev 106704)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<style>
+body {
+    margin: 0;
+}
+.flexbox {
+    display: -webkit-flexbox;
+    background-color: #aaa;
+    position: relative;
+}
+.flexbox :nth-child(1) {
+    background-color: blue;
+}
+.flexbox :nth-child(2) {
+    background-color: green;
+}
+
+.row {
+    width: 200px;
+    height: 200px;
+}
+.row div {
+    width: -webkit-flex(1);
+}
+.noflex .row :nth-child(1) {
+    width: 50px;
+}
+
+.column {
+    -webkit-flex-direction: column;
+    width: 200px;
+    height: 200px;
+}
+.column div {
+    height: -webkit-flex(1);
+}
+.noflex .column :nth-child(1) {
+    height: 50px;
+}
+
+</style>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function runTest()
+{
+    document.body.className = "noflex";
+    checkFlexBoxen();
+}
+</script>
+<script src=""
+<body _onload_="runTest()">
+
+<div class="flexbox row">
+    <div data-expected-width="50"></div>
+    <div data-expected-width="150"></div>
+</div>
+
+<div class="flexbox column">
+    <div data-expected-height="50"></div>
+    <div data-expected-height="150"></div>
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (106703 => 106704)


--- trunk/Source/WebCore/ChangeLog	2012-02-04 00:01:12 UTC (rev 106703)
+++ trunk/Source/WebCore/ChangeLog	2012-02-04 00:10:18 UTC (rev 106704)
@@ -1,3 +1,19 @@
+2012-02-03  Tony Chang  <[email protected]>
+
+        positive and negative flex values are not being cleared on style changes
+        https://bugs.webkit.org/show_bug.cgi?id=77771
+
+        Reviewed by Ojan Vafai.
+
+        If the width or height was a flex() value, but is no longer a flex
+        value, we weren't clearing the positive and negative flex values in
+        RenderStyle.
+
+        Test: css3/flexbox/flex-no-flex.html
+
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyLength::applyValue):
+
 2012-02-03  James Robinson  <[email protected]>
 
         [chromium] Defer makeContextCurrent in compositor until first frame

Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (106703 => 106704)


--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-02-04 00:01:12 UTC (rev 106703)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp	2012-02-04 00:10:18 UTC (rev 106704)
@@ -349,6 +349,8 @@
     static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); }
     static void applyValue(CSSStyleSelector* selector, CSSValue* value)
     {
+        float positiveFlex = 0;
+        float negativeFlex = 0;
         if (!value->isPrimitiveValue()) {
             if (!flexDirection || !value->isFlexValue())
                 return;
@@ -356,15 +358,18 @@
             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());
-            }
+            positiveFlex = flexValue->positiveFlex();
+            negativeFlex = flexValue->negativeFlex();
         }
 
+        if (flexDirection == FlexWidth) {
+            selector->style()->setFlexboxWidthPositiveFlex(positiveFlex);
+            selector->style()->setFlexboxWidthNegativeFlex(negativeFlex);
+        } else if (flexDirection == FlexHeight) {
+            selector->style()->setFlexboxHeightPositiveFlex(positiveFlex);
+            selector->style()->setFlexboxHeightNegativeFlex(negativeFlex);
+        }
+
         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
         if (noneEnabled && primitiveValue->getIdent() == CSSValueNone)
             if (noneUndefined)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to