Title: [132395] trunk
Revision
132395
Author
[email protected]
Date
2012-10-24 13:46:45 -0700 (Wed, 24 Oct 2012)

Log Message

Setting width of a flexitem causes the adjacent flex item to be displayed poorly.
https://bugs.webkit.org/show_bug.cgi?id=99925

Reviewed by Ojan Vafai.

Source/WebCore:

Make sure that we always repaint when moving a child. This is similar to what RenderDeprecatedFlexibleBox does.

Test: css3/flexbox/repaint-during-resize-no-flex.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::setFlowAwareLocationForChild): Move logic for repaining into the helper method
for setting the location of a child.
(WebCore::RenderFlexibleBox::layoutColumnReverse): Remove code for repaint since it's now in setFlowAwareLocationForChild.
(WebCore::RenderFlexibleBox::adjustAlignmentForChild): Remove code for repaint since it's now in setFlowAwareLocationForChild.

LayoutTests:

Add a repaint test.  The render tree should be cross platform, but due to
slight color differences in the grey overlay, the png can't be shared.

* css3/flexbox/repaint-during-resize-no-flex-expected.txt: Added.
* css3/flexbox/repaint-during-resize-no-flex.html: Added.
* platform/chromium-linux/css3/flexbox/repaint-during-resize-no-flex-expected.png: Added.
* platform/chromium/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (132394 => 132395)


--- trunk/LayoutTests/ChangeLog	2012-10-24 20:36:02 UTC (rev 132394)
+++ trunk/LayoutTests/ChangeLog	2012-10-24 20:46:45 UTC (rev 132395)
@@ -1,3 +1,18 @@
+2012-10-24  Tony Chang  <[email protected]>
+
+        Setting width of a flexitem causes the adjacent flex item to be displayed poorly.
+        https://bugs.webkit.org/show_bug.cgi?id=99925
+
+        Reviewed by Ojan Vafai.
+
+        Add a repaint test.  The render tree should be cross platform, but due to
+        slight color differences in the grey overlay, the png can't be shared.
+
+        * css3/flexbox/repaint-during-resize-no-flex-expected.txt: Added.
+        * css3/flexbox/repaint-during-resize-no-flex.html: Added.
+        * platform/chromium-linux/css3/flexbox/repaint-during-resize-no-flex-expected.png: Added.
+        * platform/chromium/TestExpectations:
+
 2012-10-24  Simon Fraser  <[email protected]>
 
         Fix CALayer hiearchy when combining tiling with preserve-3d

Added: trunk/LayoutTests/css3/flexbox/repaint-during-resize-no-flex-expected.txt (0 => 132395)


--- trunk/LayoutTests/css3/flexbox/repaint-during-resize-no-flex-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/repaint-during-resize-no-flex-expected.txt	2012-10-24 20:46:45 UTC (rev 132395)
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x90
+  RenderBlock {HTML} at (0,0) size 800x90
+    RenderBody {BODY} at (0,0) size 800x90
+      RenderFlexibleBox {DIV} at (0,0) size 800x90 [bgcolor=#333333]
+        RenderBlock {DIV} at (20,20) size 50x50 [bgcolor=#EEEEEE]
+        RenderBlock {DIV} at (110,20) size 10x50 [bgcolor=#EEEEEE]
+        RenderBlock {DIV} at (160,20) size 10x50 [bgcolor=#EEEEEE]

Added: trunk/LayoutTests/css3/flexbox/repaint-during-resize-no-flex.html (0 => 132395)


--- trunk/LayoutTests/css3/flexbox/repaint-during-resize-no-flex.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/repaint-during-resize-no-flex.html	2012-10-24 20:46:45 UTC (rev 132395)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<style>
+body {
+    margin: 0;
+}
+.flexbox {
+    background: #333;
+}
+.flex-item {
+    height: 50px;
+    margin: 20px;
+    background: #eee;
+    width: 10px;
+}
+
+.width {
+    width:50px;
+}
+</style>
+</head>
+<body>
+<div class="flexbox">
+    <div id="flex-item-1" class="flex-item"></div>
+    <div class="flex-item"></div>
+    <div class="flex-item"></div>
+</div>
+<script>
+function resizeFlexItem() {
+    var div = document.getElementById("flex-item-1");
+    div.classList.add("width");
+    if (window.testRunner)
+        testRunner.notifyDone();
+};
+window._onload_ = function() {
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.display();
+    } else {
+        document.body.appendChild(document.createTextNode(
+            "Tests to make sure that when changing the size of one flex item changes the "
+            + "location of another flex item, we properly repaint. The repaint rect should "
+            + "include the three flex items."));
+    }
+    setTimeout(resizeFlexItem, 0);
+};
+</script>
+</body></html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (132394 => 132395)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-10-24 20:36:02 UTC (rev 132394)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-10-24 20:46:45 UTC (rev 132395)
@@ -4040,6 +4040,8 @@
 
 webkit.org/b/99873 platform/chromium/virtual/gpu/fast/canvas/webgl/array-bounds-clamping.html [ Text ]
 
+webkit.org/b/99925 [ Win Mac ] css3/flexbox/repaint-during-resize-no-flex.html [ Missing ImageOnlyFailure ]
+
 # These tests are failing already and because of virtual test suite for deferred
 # image decoding they need to be suppressed again.
 webkit.org/b/94240 platform/chromium/virtual/deferred/fast/images/animated-gif-restored-from-bfcache.html [ Failure ]

Added: trunk/LayoutTests/platform/chromium-linux/css3/flexbox/repaint-during-resize-no-flex-expected.png (0 => 132395)


--- trunk/LayoutTests/platform/chromium-linux/css3/flexbox/repaint-during-resize-no-flex-expected.png	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/css3/flexbox/repaint-during-resize-no-flex-expected.png	2012-10-24 20:46:45 UTC (rev 132395)
@@ -0,0 +1,7 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksumb5618ce5dc0933395c818af3e68b04b7\xF6e
+
+\xD8IDATx\x9C\xED\xD8\xC1
+\x82@EQ1405P4M-\xF4bn\xBCq\x9E\xB3%d\xDE\xF2\xE6/c\x8C\x9D\xE7\xECw#\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b \xB6~\xF2\xF3u]Վо\xEFS\xDE=\xCF\xF3\xCD\xD7\xDF\\xB5m\xDBז\xC0\xFFp\xC1\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x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xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4^\xE75\xEB\xE0,ًIEND\xAEB`\x82
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (132394 => 132395)


--- trunk/Source/WebCore/ChangeLog	2012-10-24 20:36:02 UTC (rev 132394)
+++ trunk/Source/WebCore/ChangeLog	2012-10-24 20:46:45 UTC (rev 132395)
@@ -1,3 +1,20 @@
+2012-10-24  Tony Chang  <[email protected]>
+
+        Setting width of a flexitem causes the adjacent flex item to be displayed poorly.
+        https://bugs.webkit.org/show_bug.cgi?id=99925
+
+        Reviewed by Ojan Vafai.
+
+        Make sure that we always repaint when moving a child. This is similar to what RenderDeprecatedFlexibleBox does.
+
+        Test: css3/flexbox/repaint-during-resize-no-flex.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild): Move logic for repaining into the helper method
+        for setting the location of a child.
+        (WebCore::RenderFlexibleBox::layoutColumnReverse): Remove code for repaint since it's now in setFlowAwareLocationForChild.
+        (WebCore::RenderFlexibleBox::adjustAlignmentForChild): Remove code for repaint since it's now in setFlowAwareLocationForChild.
+
 2012-10-24  Simon Fraser  <[email protected]>
 
         Fix CALayer hiearchy when combining tiling with preserve-3d

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (132394 => 132395)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-10-24 20:36:02 UTC (rev 132394)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-10-24 20:46:45 UTC (rev 132395)
@@ -661,10 +661,21 @@
 
 void RenderFlexibleBox::setFlowAwareLocationForChild(RenderBox* child, const LayoutPoint& location)
 {
+    LayoutRect oldFrameRect = child->frameRect();
+
     if (isHorizontalFlow())
         child->setLocation(location);
     else
         child->setLocation(location.transposedPoint());
+
+    // If the child moved, we have to repaint it as well as any floating/positioned
+    // descendants. An exception is if we need a layout. In this case, we know we're going to
+    // repaint ourselves (and the child) anyway.
+    // FIXME: In some cases, we might overpaint as we move a child multiple times. We could reduce
+    // overpainting by keeping track of the original position of a child and running this check on
+    // the final position.
+    if (!selfNeedsLayout() && child->checkForRepaintDuringLayout())
+        child->repaintDuringLayoutIfMoved(oldFrameRect);
 }
 
 LayoutUnit RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const
@@ -1142,10 +1153,7 @@
         }
         mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForChild(child);
 
-        LayoutRect oldRect = child->frameRect();
         setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)));
-        if (!selfNeedsLayout() && child->checkForRepaintDuringLayout())
-            child->repaintDuringLayoutIfMoved(oldRect);
 
         mainAxisOffset -= flowAwareMarginStartForChild(child);
 
@@ -1216,14 +1224,7 @@
         return;
     }
 
-    LayoutRect oldRect = child->frameRect();
     setFlowAwareLocationForChild(child, flowAwareLocationForChild(child) + LayoutSize(0, delta));
-
-    // If the child moved, we have to repaint it as well as any floating/positioned
-    // descendants. An exception is if we need a layout. In this case, we know we're going to
-    // repaint ourselves (and the child) anyway.
-    if (!selfNeedsLayout() && child->checkForRepaintDuringLayout())
-        child->repaintDuringLayoutIfMoved(oldRect);
 }
 
 void RenderFlexibleBox::alignChildren(OrderIterator& iterator, const WTF::Vector<LineContext>& lineContexts)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to