Fix scrollbar layers being misplaced with a clipped owner layer
authorenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jun 2012 21:00:09 +0000 (21:00 +0000)
committerenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jun 2012 21:00:09 +0000 (21:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89486

Reviewed by Simon Fraser.

Source/WebCore:

Scrollbar layers are positioned relative to their parent layer. If
that parent gets clipped, then that positioning becomes incorrect and
scrollbars get positioned relative to the clipped bounds instead of
the full bounds. Fix by not clipping in this case.

Test: compositing/overflow/scrollbars-with-clipped-owner.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldClipCompositedBounds):

LayoutTests:

* compositing/overflow/scrollbars-with-clipped-owner-expected.png: Added.
* compositing/overflow/scrollbars-with-clipped-owner-expected.txt: Added.
* compositing/overflow/scrollbars-with-clipped-owner.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120750 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.png [new file with mode: 0644]
LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.txt [new file with mode: 0644]
LayoutTests/compositing/overflow/scrollbars-with-clipped-owner.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp

index 9714a95..adf7f36 100644 (file)
@@ -1,3 +1,14 @@
+2012-06-19  Adrienne Walker  <enne@google.com>
+
+        Fix scrollbar layers being misplaced with a clipped owner layer
+        https://bugs.webkit.org/show_bug.cgi?id=89486
+
+        Reviewed by Simon Fraser.
+
+        * compositing/overflow/scrollbars-with-clipped-owner-expected.png: Added.
+        * compositing/overflow/scrollbars-with-clipped-owner-expected.txt: Added.
+        * compositing/overflow/scrollbars-with-clipped-owner.html: Added.
+
 2012-06-19  Shinya Kawanaka  <shinyak@chromium.org>
 
         [Shadow][Editing] applying document.execCommand('bold') twice to elements having shadow insertion points causes a crash.
diff --git a/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.png b/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.png
new file mode 100644 (file)
index 0000000..2cc0269
Binary files /dev/null and b/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.png differ
diff --git a/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.txt b/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner.html b/LayoutTests/compositing/overflow/scrollbars-with-clipped-owner.html
new file mode 100644 (file)
index 0000000..9feb272
--- /dev/null
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <style>
+      body {
+        margin: 0px;
+        overflow:hidden;
+      }
+
+      #outer-scrollable {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        right: 0px;
+        bottom: 0px;
+        overflow: scroll;
+      }
+
+      #tall {
+        height: 1000px;
+      }
+
+      #inner-scrollable {
+        position: relative;
+        overflow: auto;
+        width: 200px;
+        height: 200px;
+        z-index: 0;
+      }
+
+      #content {
+        width: 300px;
+        height: 300px;
+        background-color: blue;
+        margin: 0px;
+        -webkit-transform:translateZ(0);
+      }
+    </style>
+    <script>
+      function doTest() {
+        if (window.testRunner)
+          testRunner.dumpAsText(true);
+
+        // This test succeeds if the scrollbars on the inner-scrollable
+        // are positioned properly.
+        var scroller = document.getElementById("outer-scrollable");
+        scroller.scrollTop = 100;
+      }
+      window.addEventListener("load", doTest, false);
+    </script>
+  </head>
+  <body>
+    <div id="outer-scrollable">
+      <div id="tall">
+        <div id="inner-scrollable">
+          <div id="content"></div>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>
index abd0fa0..3f6a9df 100644 (file)
@@ -1,3 +1,20 @@
+2012-06-19  Adrienne Walker  <enne@google.com>
+
+        Fix scrollbar layers being misplaced with a clipped owner layer
+        https://bugs.webkit.org/show_bug.cgi?id=89486
+
+        Reviewed by Simon Fraser.
+
+        Scrollbar layers are positioned relative to their parent layer. If
+        that parent gets clipped, then that positioning becomes incorrect and
+        scrollbars get positioned relative to the clipped bounds instead of
+        the full bounds. Fix by not clipping in this case.
+
+        Test: compositing/overflow/scrollbars-with-clipped-owner.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
+
 2012-06-19  Shinya Kawanaka  <shinyak@chromium.org>
 
         [Shadow][Editing] applying document.execCommand('bold') twice to elements having shadow insertion points causes a crash.
index e2d7757..f9a818a 100644 (file)
@@ -244,6 +244,10 @@ static bool layerOrAncestorIsTransformed(RenderLayer* layer)
 
 bool RenderLayerBacking::shouldClipCompositedBounds() const
 {
+    // Scrollbar layers use this layer for relative positioning, so don't clip.
+    if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())
+        return false;
+
     if (m_usingTiledCacheLayer)
         return true;