Title: [122529] trunk
Revision
122529
Author
e...@google.com
Date
2012-07-12 16:38:44 -0700 (Thu, 12 Jul 2012)

Log Message

[chromium] Root invalidations for RTL pages need to be in the right space
https://bugs.webkit.org/show_bug.cgi?id=91155

Reviewed by Kenneth Russell.

Source/WebKit/chromium:

The root layer has a translation on it when placed in the tree, so any
invalidations on this layer likewise need to be adjusted.

This adjustment is due to the fact that compositor layers all have the
origin in the upper left corner of the layer, but this is not always
the origin for graphics layers. Rather than making compositor layers
have to deal with a potential offset, we change the transform when
inserting the layer into the tree. Invalidations need to be similarly
transformed from document space into compositor layer space.

The need for this offset is due to the definition of the initial
containing block. RTL pages (pages with dir=RTL on the body) start
scrolled all the way to the right, and the origin is in the upper left
hand corner of this initial viewport. Thus on RTL pages with
horizontal overflow, the left of the document is in negative CSS
space.

* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::invalidateRect):

LayoutTests:

Add a test that demonstrates this problem. Before the code fix, the
test shows just a red square because the invalidation for the style
change repaints the wrong rect.

* compositing/rtl/rtl-overflow-invalidation-expected.png: Added.
* compositing/rtl/rtl-overflow-invalidation-expected.txt: Added.
* compositing/rtl/rtl-overflow-invalidation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122528 => 122529)


--- trunk/LayoutTests/ChangeLog	2012-07-12 23:30:47 UTC (rev 122528)
+++ trunk/LayoutTests/ChangeLog	2012-07-12 23:38:44 UTC (rev 122529)
@@ -1,3 +1,18 @@
+2012-07-12  Adrienne Walker  <e...@google.com>
+
+        [chromium] Root invalidations for RTL pages need to be in the right space
+        https://bugs.webkit.org/show_bug.cgi?id=91155
+
+        Reviewed by Kenneth Russell.
+
+        Add a test that demonstrates this problem. Before the code fix, the
+        test shows just a red square because the invalidation for the style
+        change repaints the wrong rect.
+
+        * compositing/rtl/rtl-overflow-invalidation-expected.png: Added.
+        * compositing/rtl/rtl-overflow-invalidation-expected.txt: Added.
+        * compositing/rtl/rtl-overflow-invalidation.html: Added.
+
 2012-07-12  James Simonsen  <simon...@chromium.org>
 
         [Navigation Timing] Import the W3C Navigation Timing test suite

Added: trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation-expected.png (0 => 122529)


--- trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation-expected.png	                        (rev 0)
+++ trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation-expected.png	2012-07-12 23:38:44 UTC (rev 122529)
@@ -0,0 +1,5 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum7c4f4ad7ad63bab2764e0d8cbcf74d31\x87\xEB
+\xE7IDATx\x9C\xED\xD8\xC1m\x84@EAc\x917"3&\xB2\xD9VH~\xF6xEչ\xFF\xF8\xD4ۜ\xF3\x80\xB7\xCE\xF3\xBC\xFC\xFD{;\x9EI`\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@L`\xC4@l_=a;\xB7\xD5>\xC6<\xE6\xEA	?\xE5\x83X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xDBW\x80G\x98\xC7\=\x81\xBF\xE3\x83X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xDB末7\xFCwc\x8C\xFB\xC7>X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xDB\xC7\xAB7\xB0\xC6u]\xAB'\xC0\xC78\x8E\xE3\xFE\xB1@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4^\xF3\xA6\xF2yE6QIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation-expected.txt (0 => 122529)


--- trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation-expected.txt	2012-07-12 23:38:44 UTC (rev 122529)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation.html (0 => 122529)


--- trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/rtl/rtl-overflow-invalidation.html	2012-07-12 23:38:44 UTC (rev 122529)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    body {
+        direction: rtl;
+        margin: 0px;
+    }
+
+    #layer {
+        position: absolute;
+        top: 50px;
+        right: 50px;
+        width: 100px;
+        height: 100px;
+        background-color: red;
+    }
+
+    #root {
+        width: 1000px;
+        height: 1000px;
+        -webkit-transform:translateZ(0);
+    }
+</style>
+<script>
+    function doTest() {
+        if (window.testRunner) {
+            testRunner.display();
+            testRunner.dumpAsText(true);
+        }
+        // This test passes if this element is repainted correctly, even
+        // on a page that is composited and has horizontal overflow.
+        var elem = document.getElementById("layer");
+        elem.style.backgroundColor = "green";
+    }
+    window.addEventListener('load', doTest, false);
+</script>
+<body>
+    <div id="layer" class=""></div>
+    <div id="root"></div>
+</body>
+</html>

Modified: trunk/Source/WebKit/chromium/ChangeLog (122528 => 122529)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-12 23:30:47 UTC (rev 122528)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-12 23:38:44 UTC (rev 122529)
@@ -1,3 +1,30 @@
+2012-07-12  Adrienne Walker  <e...@google.com>
+
+        [chromium] Root invalidations for RTL pages need to be in the right space
+        https://bugs.webkit.org/show_bug.cgi?id=91155
+
+        Reviewed by Kenneth Russell.
+
+        The root layer has a translation on it when placed in the tree, so any
+        invalidations on this layer likewise need to be adjusted.
+
+        This adjustment is due to the fact that compositor layers all have the
+        origin in the upper left corner of the layer, but this is not always
+        the origin for graphics layers. Rather than making compositor layers
+        have to deal with a potential offset, we change the transform when
+        inserting the layer into the tree. Invalidations need to be similarly
+        transformed from document space into compositor layer space.
+
+        The need for this offset is due to the definition of the initial
+        containing block. RTL pages (pages with dir=RTL on the body) start
+        scrolled all the way to the right, and the origin is in the upper left
+        hand corner of this initial viewport. Thus on RTL pages with
+        horizontal overflow, the left of the document is in negative CSS
+        space.
+
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::NonCompositedContentHost::invalidateRect):
+
 2012-07-12  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Remove the RenderPass pointer from RenderPassDrawQuad

Modified: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp (122528 => 122529)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2012-07-12 23:30:47 UTC (rev 122528)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2012-07-12 23:38:44 UTC (rev 122529)
@@ -157,7 +157,9 @@
 
 void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
 {
-    m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(rect));
+    WebCore::IntRect layerRect = rect;
+    layerRect.move(-m_layerAdjust);
+    m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(layerRect));
 }
 
 void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLayer*, double /* time */)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to