Title: [151761] trunk
Revision
151761
Author
[email protected]
Date
2013-06-19 18:06:22 -0700 (Wed, 19 Jun 2013)

Log Message

Incomplete repaint of input elements in writing-mode overflow
https://bugs.webkit.org/show_bug.cgi?id=110246

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

Source/WebCore:

We calculate repaint rect using unflipped rect.
However, RenderBox::applyCachedClipAndScrollOffsetForRepaint() which is called from repaint rect calculation
wants that its argument rect is flipped.
The reason is:
- paintRect.move(-scrolledContentOffset()); cannot scroll if the rect is unflipped.
- It cannot clip using intersect.
Passing unflipped rect to applyCachedClipAndScrollOffsetForRepaint() cause invalid clipping.
Therefore, this patch flipped the rect at the first part of the function and unflipped it at the last part of the function.

Scroll bar rect is absolute rect, so it is flipped rect.
RenderLayer::invalidateScrollbarRect() pass the rect to repaintRectangle() which expects an argument rect is unflipped.
This cause part of overlapping scroll bar doesn't fade out.
Therefore, this patch flipped the rect and pass it to repaintRectangle().

Tests: fast/repaint/horizontal-bt-overflow-child.html
       fast/repaint/horizontal-bt-overflow-parent.html
       fast/repaint/horizontal-bt-overflow-same.html
       fast/repaint/vertical-overflow-child.html
       fast/repaint/vertical-overflow-parent.html
       fast/repaint/vertical-overflow-same.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::invalidateScrollbarRect):

LayoutTests:

* fast/repaint/horizontal-bt-overflow-child-expected.txt: Added.
* fast/repaint/horizontal-bt-overflow-child.html: Added.
* fast/repaint/horizontal-bt-overflow-parent-expected.txt: Added.
* fast/repaint/horizontal-bt-overflow-parent.html: Added.
* fast/repaint/horizontal-bt-overflow-same-expected.txt: Added.
* fast/repaint/horizontal-bt-overflow-same.html: Added.
* fast/repaint/vertical-overflow-child-expected.txt: Added.
* fast/repaint/vertical-overflow-child.html: Added.
* fast/repaint/vertical-overflow-parent-expected.txt: Added.
* fast/repaint/vertical-overflow-parent.html: Added.
* fast/repaint/vertical-overflow-same-expected.txt: Added.
* fast/repaint/vertical-overflow-same.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151760 => 151761)


--- trunk/LayoutTests/ChangeLog	2013-06-20 00:10:38 UTC (rev 151760)
+++ trunk/LayoutTests/ChangeLog	2013-06-20 01:06:22 UTC (rev 151761)
@@ -1,3 +1,23 @@
+2013-06-19  Yuki Sekiguchi  <[email protected]>
+
+        Incomplete repaint of input elements in writing-mode overflow
+        https://bugs.webkit.org/show_bug.cgi?id=110246
+
+        Reviewed by Simon Fraser.
+
+        * fast/repaint/horizontal-bt-overflow-child-expected.txt: Added.
+        * fast/repaint/horizontal-bt-overflow-child.html: Added.
+        * fast/repaint/horizontal-bt-overflow-parent-expected.txt: Added.
+        * fast/repaint/horizontal-bt-overflow-parent.html: Added.
+        * fast/repaint/horizontal-bt-overflow-same-expected.txt: Added.
+        * fast/repaint/horizontal-bt-overflow-same.html: Added.
+        * fast/repaint/vertical-overflow-child-expected.txt: Added.
+        * fast/repaint/vertical-overflow-child.html: Added.
+        * fast/repaint/vertical-overflow-parent-expected.txt: Added.
+        * fast/repaint/vertical-overflow-parent.html: Added.
+        * fast/repaint/vertical-overflow-same-expected.txt: Added.
+        * fast/repaint/vertical-overflow-same.html: Added.
+
 2013-06-19  Benjamin Poulain  <[email protected]>
 
         Unskip two canvas tests that only fail on Lion

Added: trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-child-expected.txt (0 => 151761)


--- trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-child-expected.txt	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 29 106 100 100)
+  (rect 29 106 100 100)
+  (rect 29 106 100 100)
+)
+

Added: trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-child.html (0 => 151761)


--- trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-child.html	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html><head>
+    <style>
+        .container {
+            margin: 20px;
+            width: 300px;
+            height: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .horizontal-bt {
+            -webkit-writing-mode: horizontal-bt;
+        }
+        .offset {
+            width: 100px;
+            height: 2000px;
+        }
+        .target {
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            visibility: hidden;
+        }
+    </style>
+</head>
+<body>
+    <!-- A rect (target class) should be painted. -->
+    <!-- In DumpRenderTree, there should be repaint logs of 100x100 rect. We don't care how many times is the log dumpped. -->
+    <div class="container">
+    <div class="horizontal-bt">
+        <div class="target"></div>
+        <div class="offset"></div>
+    </div></div>
+    <script src="" type="text/_javascript_"></script>
+    <script>
+        repaintTest = function() {
+            var target = document.getElementsByClassName("target")[0];
+            target.style.visibility = "visible";
+        };
+        var container = document.getElementsByClassName("container")[0];
+        container.scrollTop = 3000;
+        runRepaintTest();
+    </script>
+</body></html>

Added: trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-parent-expected.txt (0 => 151761)


--- trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-parent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-parent-expected.txt	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 29 29 100 100)
+  (rect 29 29 100 100)
+  (rect 29 29 100 100)
+)
+

Added: trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-parent.html (0 => 151761)


--- trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-parent.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-parent.html	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html><head>
+    <style>
+        .container {
+            margin: 20px;
+            width: 300px;
+            height: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .horizontal-bt {
+            -webkit-writing-mode: horizontal-bt;
+        }
+        .offset {
+            width: 100px;
+            height: 2000px;
+        }
+        .target {
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            visibility: hidden;
+        }
+    </style>
+</head>
+<body>
+    <!-- A rect (target class) should be painted. -->
+    <!-- In DumpRenderTree, there should be repaint logs of 100x100 rect. We don't care how many times is the log dumpped. -->
+    <div class="horizontal-bt">
+    <div class="container">
+        <div class="offset"></div>
+        <div class="target"></div>
+    </div></div>
+    <script src="" type="text/_javascript_"></script>
+    <script>
+        repaintTest = function() {
+            var target = document.getElementsByClassName("target")[0];
+            target.style.visibility = "visible";
+        };
+        var container = document.getElementsByClassName("container")[0];
+        container.scrollTop = 0;
+        runRepaintTest();
+    </script>
+</body></html>

Added: trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-same-expected.txt (0 => 151761)


--- trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-same-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-same-expected.txt	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 29 21 100 100)
+  (rect 29 21 100 100)
+  (rect 29 21 100 100)
+)
+

Added: trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-same.html (0 => 151761)


--- trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-same.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/horizontal-bt-overflow-same.html	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html><head>
+    <style>
+        .container {
+            margin: 20px;
+            width: 300px;
+            height: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .horizontal-bt {
+            -webkit-writing-mode: horizontal-bt;
+        }
+        .offset {
+            width: 100px;
+            height: 2000px;
+        }
+        .target {
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            visibility: hidden;
+        }
+    </style>
+</head>
+<body>
+    <!-- A rect (target class) should be painted. -->
+    <!-- In DumpRenderTree, there should be repaint logs of 100x100 rect. We don't care how many times is the log dumpped. -->
+    <div class="horizontal-bt container">
+        <div class="offset"></div>
+        <div class="target"></div>
+    </div>
+    <script src="" type="text/_javascript_"></script>
+    <script>
+        repaintTest = function() {
+            var target = document.getElementsByClassName("target")[0];
+            target.style.visibility = "visible";
+        };
+        var container = document.getElementsByClassName("container")[0];
+        container.scrollTop = 0;
+        runRepaintTest();
+    </script>
+</body></html>

Added: trunk/LayoutTests/fast/repaint/vertical-overflow-child-expected.txt (0 => 151761)


--- trunk/LayoutTests/fast/repaint/vertical-overflow-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/vertical-overflow-child-expected.txt	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 214 21 100 100)
+  (rect 214 21 100 100)
+  (rect 214 21 100 100)
+)
+

Added: trunk/LayoutTests/fast/repaint/vertical-overflow-child.html (0 => 151761)


--- trunk/LayoutTests/fast/repaint/vertical-overflow-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/vertical-overflow-child.html	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html><head>
+    <style>
+        .container {
+            margin: 20px;
+            width: 300px;
+            height: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .vertical-rl {
+            -webkit-writing-mode: vertical-rl;
+        }
+        .offset {
+            width: 2000px;
+            height: 100px;
+        }
+        .target {
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            visibility: hidden;
+        }
+    </style>
+</head>
+<body>
+    <!-- A rect (target class) should be painted. -->
+    <!-- In DumpRenderTree, there should be repaint logs of 100x100 rect. We don't care how many times is the log dumpped. -->
+    <div class="container">
+    <div class="vertical-rl">
+        <div class="target"></div>
+        <div class="offset"></div>
+    </div></div>
+    <script src="" type="text/_javascript_"></script>
+    <script>
+        repaintTest = function() {
+            var target = document.getElementsByClassName("target")[0];
+            target.style.visibility = "visible";
+        };
+        var container = document.getElementsByClassName("container")[0];
+        container.scrollLeft = 3000;
+        runRepaintTest();
+    </script>
+</body></html>

Added: trunk/LayoutTests/fast/repaint/vertical-overflow-parent-expected.txt (0 => 151761)


--- trunk/LayoutTests/fast/repaint/vertical-overflow-parent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/vertical-overflow-parent-expected.txt	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 29 29 100 100)
+  (rect 29 29 100 100)
+  (rect 29 29 100 100)
+)
+

Added: trunk/LayoutTests/fast/repaint/vertical-overflow-parent.html (0 => 151761)


--- trunk/LayoutTests/fast/repaint/vertical-overflow-parent.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/vertical-overflow-parent.html	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html><head>
+    <style>
+        .container {
+            margin: 20px;
+            width: 300px;
+            height: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .vertical-rl {
+            -webkit-writing-mode: vertical-rl;
+        }
+        .offset {
+            width: 2000px;
+            height: 100px;
+        }
+        .target {
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            visibility: hidden;
+        }
+    </style>
+</head>
+<body>
+    <!-- A rect (target class) should be painted. -->
+    <!-- In DumpRenderTree, there should be repaint logs of 100x100 rect. We don't care how many times is the log dumpped. -->
+    <div class="vertical-rl">
+    <div class="container">
+        <div class="offset"></div>
+        <div class="target"></div>
+    </div></div>
+    <script src="" type="text/_javascript_"></script>
+    <script>
+        repaintTest = function() {
+            var target = document.getElementsByClassName("target")[0];
+            target.style.visibility = "visible";
+        };
+        var container = document.getElementsByClassName("container")[0];
+        container.scrollLeft = 0;
+        runRepaintTest();
+    </script>
+</body></html>

Added: trunk/LayoutTests/fast/repaint/vertical-overflow-same-expected.txt (0 => 151761)


--- trunk/LayoutTests/fast/repaint/vertical-overflow-same-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/vertical-overflow-same-expected.txt	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 29 21 100 100)
+  (rect 29 21 100 100)
+  (rect 29 21 100 100)
+)
+

Added: trunk/LayoutTests/fast/repaint/vertical-overflow-same.html (0 => 151761)


--- trunk/LayoutTests/fast/repaint/vertical-overflow-same.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/vertical-overflow-same.html	2013-06-20 01:06:22 UTC (rev 151761)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html><head>
+    <style>
+        .container {
+            margin: 20px;
+            width: 300px;
+            height: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .vertical-rl {
+            -webkit-writing-mode: vertical-rl;
+        }
+        .offset {
+            width: 2000px;
+            height: 100px;
+        }
+        .target {
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            visibility: hidden;
+        }
+    </style>
+</head>
+<body>
+    <!-- A rect (target class) should be painted. -->
+    <!-- In DumpRenderTree, there should be repaint logs of 100x100 rect. We don't care how many times is the log dumpped. -->
+    <div class="vertical-rl container">
+        <div class="offset"></div>
+        <div class="target"></div>
+    </div>
+    <script src="" type="text/_javascript_"></script>
+    <script>
+        repaintTest = function() {
+            var target = document.getElementsByClassName("target")[0];
+            target.style.visibility = "visible";
+        };
+        var container = document.getElementsByClassName("container")[0];
+        container.scrollLeft = 0;
+        runRepaintTest();
+    </script>
+</body></html>

Modified: trunk/Source/WebCore/ChangeLog (151760 => 151761)


--- trunk/Source/WebCore/ChangeLog	2013-06-20 00:10:38 UTC (rev 151760)
+++ trunk/Source/WebCore/ChangeLog	2013-06-20 01:06:22 UTC (rev 151761)
@@ -1,3 +1,36 @@
+2013-06-19  Yuki Sekiguchi  <[email protected]>
+
+        Incomplete repaint of input elements in writing-mode overflow
+        https://bugs.webkit.org/show_bug.cgi?id=110246
+
+        Reviewed by Simon Fraser.
+
+        We calculate repaint rect using unflipped rect.
+        However, RenderBox::applyCachedClipAndScrollOffsetForRepaint() which is called from repaint rect calculation
+        wants that its argument rect is flipped.
+        The reason is:
+        - paintRect.move(-scrolledContentOffset()); cannot scroll if the rect is unflipped.
+        - It cannot clip using intersect.
+        Passing unflipped rect to applyCachedClipAndScrollOffsetForRepaint() cause invalid clipping.
+        Therefore, this patch flipped the rect at the first part of the function and unflipped it at the last part of the function.
+
+        Scroll bar rect is absolute rect, so it is flipped rect.
+        RenderLayer::invalidateScrollbarRect() pass the rect to repaintRectangle() which expects an argument rect is unflipped.
+        This cause part of overlapping scroll bar doesn't fade out.
+        Therefore, this patch flipped the rect and pass it to repaintRectangle().
+
+        Tests: fast/repaint/horizontal-bt-overflow-child.html
+               fast/repaint/horizontal-bt-overflow-parent.html
+               fast/repaint/horizontal-bt-overflow-same.html
+               fast/repaint/vertical-overflow-child.html
+               fast/repaint/vertical-overflow-parent.html
+               fast/repaint/vertical-overflow-same.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::invalidateScrollbarRect):
+
 2013-06-19  Benjamin Poulain  <[email protected]>
 
         Use the PlatformEvent timestamp when creating a DOM Event

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (151760 => 151761)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-06-20 00:10:38 UTC (rev 151760)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-06-20 01:06:22 UTC (rev 151761)
@@ -816,17 +816,21 @@
 
 void RenderBox::applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const
 {
+    flipForWritingMode(paintRect);
     paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden.
 
     // Do not clip scroll layer contents to reduce the number of repaints while scrolling.
-    if (usesCompositedScrolling())
+    if (usesCompositedScrolling()) {
+        flipForWritingMode(paintRect);
         return;
+    }
 
     // height() is inaccurate if we're in the middle of a layout of this RenderBox, so use the
     // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint
     // anyway if its size does change.
     LayoutRect clipRect(LayoutPoint(), cachedSizeForOverflowClip());
     paintRect = intersection(paintRect, clipRect);
+    flipForWritingMode(paintRect);
 }
 
 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (151760 => 151761)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-06-20 00:10:38 UTC (rev 151760)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-06-20 01:06:22 UTC (rev 151761)
@@ -2855,7 +2855,9 @@
         scrollRect.move(verticalScrollbarStart(0, box->width()), box->borderTop());
     else
         scrollRect.move(horizontalScrollbarStart(0), box->height() - box->borderBottom() - scrollbar->height());
-    renderer()->repaintRectangle(scrollRect);
+    LayoutRect repaintRect = scrollRect;
+    renderBox()->flipForWritingMode(repaintRect);
+    renderer()->repaintRectangle(repaintRect);
 }
 
 void RenderLayer::invalidateScrollCornerRect(const IntRect& rect)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to