RenderLayerBacking sometimes doesn't attach scrollbars to graphics layer tree
https://bugs.webkit.org/show_bug.cgi?id=89402
Reviewed by James Robinson.
Source/WebCore:
RenderLayerBacking only attaches scrollbar layers to the graphics
layer tree if there's a clip layer. This is wrong, because these
scrollbars become orphans and other code expects them to handle
repainting the scrollbars (which now become invisible). Fix by always
attaching scrollbar layers.
Test: compositing/overflow/image-load-overflow-scrollbars.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateInternalHierarchy):
LayoutTests:
Add a test where an image load creates overflow.
* compositing/overflow/image-load-overflow-scrollbars-expected.png: Added.
* compositing/overflow/image-load-overflow-scrollbars-expected.txt: Added.
* compositing/overflow/image-load-overflow-scrollbars.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@120661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index deed875..a60e20c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2012-06-18 Adrienne Walker <enne@google.com>
+
+ RenderLayerBacking sometimes doesn't attach scrollbars to graphics layer tree
+ https://bugs.webkit.org/show_bug.cgi?id=89402
+
+ Reviewed by James Robinson.
+
+ Add a test where an image load creates overflow.
+
+ * compositing/overflow/image-load-overflow-scrollbars-expected.png: Added.
+ * compositing/overflow/image-load-overflow-scrollbars-expected.txt: Added.
+ * compositing/overflow/image-load-overflow-scrollbars.html: Added.
+
2012-06-18 Ami Fischman <fischman@chromium.org>
Make serve-video.php serve 206 responses
diff --git a/LayoutTests/compositing/overflow/image-load-overflow-scrollbars-expected.png b/LayoutTests/compositing/overflow/image-load-overflow-scrollbars-expected.png
new file mode 100644
index 0000000..07f16ba
--- /dev/null
+++ b/LayoutTests/compositing/overflow/image-load-overflow-scrollbars-expected.png
Binary files differ
diff --git a/LayoutTests/compositing/overflow/image-load-overflow-scrollbars-expected.txt b/LayoutTests/compositing/overflow/image-load-overflow-scrollbars-expected.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/LayoutTests/compositing/overflow/image-load-overflow-scrollbars-expected.txt
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/compositing/overflow/image-load-overflow-scrollbars.html b/LayoutTests/compositing/overflow/image-load-overflow-scrollbars.html
new file mode 100644
index 0000000..270b913
--- /dev/null
+++ b/LayoutTests/compositing/overflow/image-load-overflow-scrollbars.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type='text/css'>
+ #overflow {
+ overflow:auto;
+ width:200px;
+ height:200px;
+ -webkit-transform:translateZ(0);
+ }
+</style>
+<script type='text/javascript'>
+ function doTest() {
+ var canvas = document.createElement('canvas');
+ canvas.width = 1;
+ canvas.height = 400;
+ var content = document.getElementById("content");
+ content.onload = function() {
+ var overflow = document.getElementById("overflow");
+ overflow.scrollTop = 50;
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ content.src = canvas.toDataURL();
+ }
+ window.addEventListener('load', doTest, false);
+
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText(true);
+ }
+</script>
+</head>
+<body>
+ <!-- This test passes if a partially scrolled scrollbar appears -->
+ <div id="overflow">
+ <img id="content">
+ </div>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 8ac0c0a..8a3fd2f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2012-06-18 Adrienne Walker <enne@google.com>
+
+ RenderLayerBacking sometimes doesn't attach scrollbars to graphics layer tree
+ https://bugs.webkit.org/show_bug.cgi?id=89402
+
+ Reviewed by James Robinson.
+
+ RenderLayerBacking only attaches scrollbar layers to the graphics
+ layer tree if there's a clip layer. This is wrong, because these
+ scrollbars become orphans and other code expects them to handle
+ repainting the scrollbars (which now become invisible). Fix by always
+ attaching scrollbar layers.
+
+ Test: compositing/overflow/image-load-overflow-scrollbars.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateInternalHierarchy):
+
2012-06-18 Amy Ousterhout <aousterh@chromium.org>
[Chromium] DeviceOrientation Cleanup
diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp
index ecd4d72..e2d7757f 100644
--- a/Source/WebCore/rendering/RenderLayerBacking.cpp
+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp
@@ -610,22 +610,22 @@
if (m_clippingLayer) {
m_clippingLayer->removeFromParent();
m_graphicsLayer->addChild(m_clippingLayer.get());
+ }
- // The clip for child layers does not include space for overflow controls, so they exist as
- // siblings of the clipping layer if we have one. Normal children of this layer are set as
- // children of the clipping layer.
- if (m_layerForHorizontalScrollbar) {
- m_layerForHorizontalScrollbar->removeFromParent();
- m_graphicsLayer->addChild(m_layerForHorizontalScrollbar.get());
- }
- if (m_layerForVerticalScrollbar) {
- m_layerForVerticalScrollbar->removeFromParent();
- m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get());
- }
- if (m_layerForScrollCorner) {
- m_layerForScrollCorner->removeFromParent();
- m_graphicsLayer->addChild(m_layerForScrollCorner.get());
- }
+ // The clip for child layers does not include space for overflow controls, so they exist as
+ // siblings of the clipping layer if we have one. Normal children of this layer are set as
+ // children of the clipping layer.
+ if (m_layerForHorizontalScrollbar) {
+ m_layerForHorizontalScrollbar->removeFromParent();
+ m_graphicsLayer->addChild(m_layerForHorizontalScrollbar.get());
+ }
+ if (m_layerForVerticalScrollbar) {
+ m_layerForVerticalScrollbar->removeFromParent();
+ m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get());
+ }
+ if (m_layerForScrollCorner) {
+ m_layerForScrollCorner->removeFromParent();
+ m_graphicsLayer->addChild(m_layerForScrollCorner.get());
}
}