Title: [141290] trunk
Revision
141290
Author
t...@chromium.org
Date
2013-01-30 11:21:26 -0800 (Wed, 30 Jan 2013)

Log Message

REGRESSION(r136324): Flexbox should relayout flex children when width changes
https://bugs.webkit.org/show_bug.cgi?id=108231

Reviewed by Ojan Vafai.

Source/WebCore:

If the width of a block changes, we need to set relayoutChildren = true
to relayout the children. This broke when we optimized the layout calls
in layoutAndPlaceChildren.

Test: css3/flexbox/width-change-and-relayout-children.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock): Also reorder the code to match RenderBlock.
The bug fix is to use updateLogicalWidthAndColumnWidth() and its return value to set
relayoutChildren = true.

LayoutTests:

* css3/flexbox/width-change-and-relayout-children-expected.txt: Added.
* css3/flexbox/width-change-and-relayout-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141289 => 141290)


--- trunk/LayoutTests/ChangeLog	2013-01-30 19:19:34 UTC (rev 141289)
+++ trunk/LayoutTests/ChangeLog	2013-01-30 19:21:26 UTC (rev 141290)
@@ -1,3 +1,13 @@
+2013-01-30  Tony Chang  <t...@chromium.org>
+
+        REGRESSION(r136324): Flexbox should relayout flex children when width changes
+        https://bugs.webkit.org/show_bug.cgi?id=108231
+
+        Reviewed by Ojan Vafai.
+
+        * css3/flexbox/width-change-and-relayout-children-expected.txt: Added.
+        * css3/flexbox/width-change-and-relayout-children.html: Added.
+
 2013-01-30  Florin Malita  <fmal...@chromium.org>
 
         [Chromium] Unreviewed gardening.

Added: trunk/LayoutTests/css3/flexbox/width-change-and-relayout-children-expected.txt (0 => 141290)


--- trunk/LayoutTests/css3/flexbox/width-change-and-relayout-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/width-change-and-relayout-children-expected.txt	2013-01-30 19:21:26 UTC (rev 141290)
@@ -0,0 +1,2 @@
+This div should be 200px wide.
+PASS

Added: trunk/LayoutTests/css3/flexbox/width-change-and-relayout-children.html (0 => 141290)


--- trunk/LayoutTests/css3/flexbox/width-change-and-relayout-children.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/width-change-and-relayout-children.html	2013-01-30 19:21:26 UTC (rev 141290)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="" rel="stylesheet">
+<style>
+.flexitem {
+    width: 100%;
+    height: 3em;
+    min-height: 3em;
+}
+.child {
+    background-color: salmon;
+}
+</style>
+<script src=""
+</head>
+<body>
+<div id="container" style="width: 100px" data-expected-width="200">
+<div class="flexbox column" data-expected-width="200">
+    <div class="flexitem" data-expected-width="200">
+        <div class="child" data-expected-width="200">This div should be 200px wide.</div>
+    </div>
+</div>
+</div>
+<script>
+var container = document.getElementById('container');
+container.offsetWidth;
+container.style.width = "200px";
+window._onload_ = function()
+{
+    checkLayout("#container");
+};
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (141289 => 141290)


--- trunk/Source/WebCore/ChangeLog	2013-01-30 19:19:34 UTC (rev 141289)
+++ trunk/Source/WebCore/ChangeLog	2013-01-30 19:21:26 UTC (rev 141290)
@@ -1,3 +1,21 @@
+2013-01-30  Tony Chang  <t...@chromium.org>
+
+        REGRESSION(r136324): Flexbox should relayout flex children when width changes
+        https://bugs.webkit.org/show_bug.cgi?id=108231
+
+        Reviewed by Ojan Vafai.
+
+        If the width of a block changes, we need to set relayoutChildren = true
+        to relayout the children. This broke when we optimized the layout calls
+        in layoutAndPlaceChildren.
+
+        Test: css3/flexbox/width-change-and-relayout-children.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutBlock): Also reorder the code to match RenderBlock.
+        The bug fix is to use updateLogicalWidthAndColumnWidth() and its return value to set
+        relayoutChildren = true.
+
 2013-01-30  Tim Horton  <timothy_hor...@apple.com>
 
         GraphicsContext3DCG needs to copy image data in paintToCanvas

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (141289 => 141290)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2013-01-30 19:19:34 UTC (rev 141289)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2013-01-30 19:21:26 UTC (rev 141290)
@@ -296,6 +296,15 @@
         return;
 
     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
+
+    if (updateLogicalWidthAndColumnWidth())
+        relayoutChildren = true;
+
+    m_overflow.clear();
+
+    LayoutUnit previousHeight = logicalHeight();
+    setLogicalHeight(0);
+
     LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
 
     if (inRenderFlowThread()) {
@@ -305,13 +314,7 @@
     }
     updateRegionsAndExclusionsLogicalSize();
 
-    LayoutSize previousSize = size();
-
-    setLogicalHeight(0);
-    updateLogicalWidth();
-
     m_numberOfInFlowChildrenOnFirstLine = -1;
-    m_overflow.clear();
 
     RenderBlock::startDelayUpdateScrollInfo();
 
@@ -330,7 +333,7 @@
 
     RenderBlock::finishDelayUpdateScrollInfo();
 
-    if (size() != previousSize)
+    if (logicalHeight() != previousHeight)
         relayoutChildren = true;
 
     layoutPositionedObjects(relayoutChildren || isRoot());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to