Title: [151549] trunk
Revision
151549
Author
[email protected]
Date
2013-06-13 08:37:10 -0700 (Thu, 13 Jun 2013)

Log Message

Setting overflow:hidden on position:absolute does not repaint hidden content
https://bugs.webkit.org/show_bug.cgi?id=116994

Patch by Yuki Sekiguchi <[email protected]> on 2013-06-13
Reviewed by Simon Fraser.

Source/WebCore:

Since a container which has overflow clip of RenderBox which has self painting layer doesn't have a rect of the RenderBox as visual overflow,
the container should not clip request repainting rect of the RenderBox.

Test: fast/repaint/change-overflow-and-display-of-relative.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::shouldUseClipForRepaint): If this has self painting layer, we should not clip for repaint.
* rendering/RenderLayerModelObject.h:

LayoutTests:

* fast/repaint/change-overflow-and-display-of-relative-expected.txt: Added.
* fast/repaint/change-overflow-and-display-of-relative.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151548 => 151549)


--- trunk/LayoutTests/ChangeLog	2013-06-13 15:29:50 UTC (rev 151548)
+++ trunk/LayoutTests/ChangeLog	2013-06-13 15:37:10 UTC (rev 151549)
@@ -1,3 +1,13 @@
+2013-06-13  Yuki Sekiguchi  <[email protected]>
+
+        Setting overflow:hidden on position:absolute does not repaint hidden content
+        https://bugs.webkit.org/show_bug.cgi?id=116994
+
+        Reviewed by Simon Fraser.
+
+        * fast/repaint/change-overflow-and-display-of-relative-expected.txt: Added.
+        * fast/repaint/change-overflow-and-display-of-relative.html: Added.
+
 2013-06-13  Mihai Tica  <[email protected]>
 
         [CSS Background Blending] Gradients don't blend with any of the layers behind.

Added: trunk/LayoutTests/fast/repaint/change-overflow-and-display-of-relative-expected.txt (0 => 151549)


--- trunk/LayoutTests/fast/repaint/change-overflow-and-display-of-relative-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/change-overflow-and-display-of-relative-expected.txt	2013-06-13 15:37:10 UTC (rev 151549)
@@ -0,0 +1,10 @@
+(repaint rects
+  (rect 8 8 784 40)
+  (rect 8 8 784 200)
+)
+(repaint rects
+  (rect 8 8 784 40)
+  (rect 8 8 784 200)
+  (rect 8 8 784 40)
+)
+

Added: trunk/LayoutTests/fast/repaint/change-overflow-and-display-of-relative.html (0 => 151549)


--- trunk/LayoutTests/fast/repaint/change-overflow-and-display-of-relative.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/change-overflow-and-display-of-relative.html	2013-06-13 15:37:10 UTC (rev 151549)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html><head>
+<style>
+.patient {
+    overflow: hidden;
+    height: 40px;
+    background-color: blue;
+}
+.patient > div {
+   display: none;
+   position: relative;
+}
+</style>
+</head>
+<body>
+<!-- There should not be a red rect. -->
+<div class="patient" id="overflow">
+    <div></div>
+    <div id="display" style="height: 200px; background-color: red;"></div>
+</div>
+<script src=""
+<script>
+    window._onload_ = function() {
+        var overflow = document.getElementById("overflow");
+        var display = document.getElementById("display");
+
+        repaintTest = function() {
+            overflow.style.overflow = "visible";
+            display.style.display = "block";
+        }
+        runRepaintTest();
+
+        function rewrite() {
+            repaintTest = function() {
+                overflow.style.overflow = "hidden";
+                display.style.display = "none";
+            }
+            runRepaintTest();
+        }
+        if (window.testRunner && window.internals)
+            rewrite();
+        else
+            setTimeout(rewrite, 100);
+    };
+</script>
+</body></html>

Modified: trunk/Source/WebCore/ChangeLog (151548 => 151549)


--- trunk/Source/WebCore/ChangeLog	2013-06-13 15:29:50 UTC (rev 151548)
+++ trunk/Source/WebCore/ChangeLog	2013-06-13 15:37:10 UTC (rev 151549)
@@ -1,3 +1,21 @@
+2013-06-13  Yuki Sekiguchi  <[email protected]>
+
+        Setting overflow:hidden on position:absolute does not repaint hidden content
+        https://bugs.webkit.org/show_bug.cgi?id=116994
+
+        Reviewed by Simon Fraser.
+
+        Since a container which has overflow clip of RenderBox which has self painting layer doesn't have a rect of the RenderBox as visual overflow,
+        the container should not clip request repainting rect of the RenderBox.
+
+        Test: fast/repaint/change-overflow-and-display-of-relative.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeRectForRepaint):
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::shouldUseClipForRepaint): If this has self painting layer, we should not clip for repaint.
+        * rendering/RenderLayerModelObject.h:
+
 2013-06-13  Mihai Tica  <[email protected]>
 
         [CSS Background Blending] Gradients don't blend with any of the layers behind.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (151548 => 151549)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-06-13 15:29:50 UTC (rev 151548)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-06-13 15:37:10 UTC (rev 151549)
@@ -2021,7 +2021,7 @@
     // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout,
     // its controlClipRect will be wrong. For overflow clip we use the values cached by the layer.
     rect.setLocation(topLeft);
-    if (o->hasOverflowClip()) {
+    if (shouldUseClipForRepaint(o)) {
         RenderBox* containerBox = toRenderBox(o);
         containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
         if (rect.isEmpty())

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (151548 => 151549)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2013-06-13 15:29:50 UTC (rev 151548)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2013-06-13 15:37:10 UTC (rev 151549)
@@ -73,6 +73,16 @@
     return m_layer && m_layer->isSelfPaintingLayer();
 }
 
+// If this has a self painting layer, visual overflow rects of the container doesn't contain this rect.
+// If hasOverflowClip() of the container is changed, the container requests repainting visual overflow rects.
+// Since the overflow rects doesn't contain this rect, the container doesn't request repainting this rect.
+// Therefore, this should request repainting overflowed portion.
+bool RenderLayerModelObject::shouldUseClipForRepaint(RenderObject* container) const
+{
+    ASSERT(container == this->container());
+    return !hasSelfPaintingLayer() && container->hasOverflowClip();
+}
+    
 void RenderLayerModelObject::willBeDestroyed()
 {
     if (isPositioned()) {

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.h (151548 => 151549)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.h	2013-06-13 15:29:50 UTC (rev 151548)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.h	2013-06-13 15:37:10 UTC (rev 151549)
@@ -56,6 +56,8 @@
 protected:
     void ensureLayer();
 
+    bool shouldUseClipForRepaint(RenderObject* container) const;
+
     virtual void willBeDestroyed() OVERRIDE;
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to