Title: [138312] trunk
Revision
138312
Author
[email protected]
Date
2012-12-20 15:54:53 -0800 (Thu, 20 Dec 2012)

Log Message

[flexbox] Fix handling of very large flex grow/shrink values
https://bugs.webkit.org/show_bug.cgi?id=105579

Reviewed by Tony Chang.

Source/WebCore: 

Add isfinite to childSize calculation in RenderFlexibleBox::
resolveFlexibleLengths to avoid overflow.

Covered by css3/flexbox/flex-algorithm.html.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::resolveFlexibleLengths):
Check if value is finite before adding to childSize.

LayoutTests: 

Update expectations for element with very large flex grow value.

* css3/flexbox/flex-algorithm.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138311 => 138312)


--- trunk/LayoutTests/ChangeLog	2012-12-20 23:51:39 UTC (rev 138311)
+++ trunk/LayoutTests/ChangeLog	2012-12-20 23:54:53 UTC (rev 138312)
@@ -1,3 +1,14 @@
+2012-12-20  Emil A Eklund  <[email protected]>
+
+        [flexbox] Fix handling of very large flex grow/shrink values
+        https://bugs.webkit.org/show_bug.cgi?id=105579
+
+        Reviewed by Tony Chang.
+
+        Update expectations for element with very large flex grow value.
+
+        * css3/flexbox/flex-algorithm.html:
+
 2012-12-20  Simon Fraser  <[email protected]>
 
         Remove an incorrect WK2 result, and two there were identical to the WK1 results.

Modified: trunk/LayoutTests/css3/flexbox/flex-algorithm.html (138311 => 138312)


--- trunk/LayoutTests/css3/flexbox/flex-algorithm.html	2012-12-20 23:51:39 UTC (rev 138311)
+++ trunk/LayoutTests/css3/flexbox/flex-algorithm.html	2012-12-20 23:54:53 UTC (rev 138312)
@@ -128,7 +128,7 @@
 </div>
 
 <div class="flexbox">
-  <div data-expected-width="0" style="-webkit-flex: 100000000000000000000000000000000000000 0 600px; -moz-flex: 100000000000000000000000000000000000000 0 600px"></div>
+  <div data-expected-width="600" style="-webkit-flex: 100000000000000000000000000000000000000 0 600px; -moz-flex: 100000000000000000000000000000000000000 0 600px"></div>
   <div data-expected-width="600" style="-webkit-flex: 0 100000000000000000000000000000000000000 600px; -moz-flex: 0 100000000000000000000000000000000000000 600px"></div>
   <div data-expected-width="33554428" style="-webkit-flex: 1 1 100000000000000000000000000000000000000px; -moz-flex: 1 1 100000000000000000000000000000000000000px"></div>
 </div>

Modified: trunk/Source/WebCore/ChangeLog (138311 => 138312)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 23:51:39 UTC (rev 138311)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 23:54:53 UTC (rev 138312)
@@ -1,3 +1,19 @@
+2012-12-20  Emil A Eklund  <[email protected]>
+
+        [flexbox] Fix handling of very large flex grow/shrink values
+        https://bugs.webkit.org/show_bug.cgi?id=105579
+
+        Reviewed by Tony Chang.
+
+        Add isfinite to childSize calculation in RenderFlexibleBox::
+        resolveFlexibleLengths to avoid overflow.
+
+        Covered by css3/flexbox/flex-algorithm.html.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
+        Check if value is finite before adding to childSize.
+
 2012-12-20  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r138265.

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (138311 => 138312)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-12-20 23:51:39 UTC (rev 138311)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-12-20 23:54:53 UTC (rev 138312)
@@ -968,10 +968,13 @@
         else {
             LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child);
             LayoutUnit childSize = preferredChildSize;
+            double extraSpace = 0;
             if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && isfinite(totalFlexGrow))
-                childSize += roundedLayoutUnit(availableFreeSpace * child->style()->flexGrow() / totalFlexGrow);
+                extraSpace = availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
             else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && isfinite(totalWeightedFlexShrink))
-                childSize += roundedLayoutUnit(availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink);
+                extraSpace = availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink;
+            if (isfinite(extraSpace))
+                childSize += roundedLayoutUnit(extraSpace);
 
             LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize);
             childSizes.append(adjustedChildSize);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to