- Revision
- 137248
- Author
- [email protected]
- Date
- 2012-12-10 21:54:06 -0800 (Mon, 10 Dec 2012)
Log Message
Source/WebCore: REGRESSION (r137215): WebKit stretches and shrinks a part of screen on scroll
https://bugs.webkit.org/show_bug.cgi?id=104626
Reviewed by Beth Dakin.
r137215 removed a compositing layer repaint on size changes. However, there
are cases where the compositing code constrains layer size by clipping
with the viewport and a clipping ancestor. When that happens, we must
invalidate the layer on a size change to avoid showing stretched or
shrunken content.
Test: compositing/repaint/clipped-layer-size-change.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::RenderLayerBacking::updateCompositedBounds):
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
* rendering/RenderLayerBacking.h:
(RenderLayerBacking):
LayoutTests: REGRESSION(r137215): WebKit stretches and shrinks a part of screen on scroll
https://bugs.webkit.org/show_bug.cgi?id=104626
Reviewed by Beth Dakin.
Testcase that scrolls an overflow area containing a compositing layer.
* compositing/repaint/clipped-layer-size-change-expected.html: Added.
* compositing/repaint/clipped-layer-size-change.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (137247 => 137248)
--- trunk/LayoutTests/ChangeLog 2012-12-11 05:22:49 UTC (rev 137247)
+++ trunk/LayoutTests/ChangeLog 2012-12-11 05:54:06 UTC (rev 137248)
@@ -1,3 +1,15 @@
+2012-12-10 Simon Fraser <[email protected]>
+
+ REGRESSION(r137215): WebKit stretches and shrinks a part of screen on scroll
+ https://bugs.webkit.org/show_bug.cgi?id=104626
+
+ Reviewed by Beth Dakin.
+
+ Testcase that scrolls an overflow area containing a compositing layer.
+
+ * compositing/repaint/clipped-layer-size-change-expected.html: Added.
+ * compositing/repaint/clipped-layer-size-change.html: Added.
+
2012-12-10 Noel Gordon <[email protected]>
[chromium] fast/dom/HTMLMeterElement/meter-boundary-values.html is flaky
Added: trunk/LayoutTests/compositing/repaint/clipped-layer-size-change-expected.html (0 => 137248)
--- trunk/LayoutTests/compositing/repaint/clipped-layer-size-change-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/repaint/clipped-layer-size-change-expected.html 2012-12-11 05:54:06 UTC (rev 137248)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ overflow: hidden;
+ border: 1px solid black;
+ }
+
+ .scroll-content {
+ height: 600px;
+ }
+
+ .inner {
+ position: relative;
+ width: 150px;
+ height: 150px;
+ margin-top: -10px; /* force overlap with the composited element */
+ margin-left: 10px;
+ box-sizing: border-box;
+ border: 40px solid black;
+ }
+
+ .composited {
+ height: 50px;
+ width: 100px;
+ -webkit-transform: translateZ(0);
+ }
+ </style>
+</head>
+<body>
+
+ <div id="container">
+ <div class="scroll-content">
+ <div class="composited"></div>
+ <div class="inner"></div>
+ </div>
+ </div>
+</body>
+</html>
Added: trunk/LayoutTests/compositing/repaint/clipped-layer-size-change.html (0 => 137248)
--- trunk/LayoutTests/compositing/repaint/clipped-layer-size-change.html (rev 0)
+++ trunk/LayoutTests/compositing/repaint/clipped-layer-size-change.html 2012-12-11 05:54:06 UTC (rev 137248)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ overflow: hidden;
+ border: 1px solid black;
+ }
+
+ .scroll-content {
+ height: 600px;
+ }
+
+ .inner {
+ position: relative;
+ width: 150px;
+ height: 150px;
+ margin-top: -10px; /* force overlap with the composited element */
+ margin-left: 10px;
+ box-sizing: border-box;
+ border: 40px solid black;
+ }
+
+ .composited {
+ height: 150px;
+ width: 100px;
+ -webkit-transform: translateZ(0);
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ function doTest()
+ {
+ window.setTimeout(function() {
+ var container = document.getElementById('container');
+ window.console.log('scrolling')
+ container.scrollTop = 100;
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+ <div id="container">
+ <div class="scroll-content">
+ <div class="composited"></div>
+ <div class="inner"></div>
+ </div>
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (137247 => 137248)
--- trunk/Source/WebCore/ChangeLog 2012-12-11 05:22:49 UTC (rev 137247)
+++ trunk/Source/WebCore/ChangeLog 2012-12-11 05:54:06 UTC (rev 137248)
@@ -1,3 +1,25 @@
+2012-12-10 Simon Fraser <[email protected]>
+
+ REGRESSION (r137215): WebKit stretches and shrinks a part of screen on scroll
+ https://bugs.webkit.org/show_bug.cgi?id=104626
+
+ Reviewed by Beth Dakin.
+
+ r137215 removed a compositing layer repaint on size changes. However, there
+ are cases where the compositing code constrains layer size by clipping
+ with the viewport and a clipping ancestor. When that happens, we must
+ invalidate the layer on a size change to avoid showing stretched or
+ shrunken content.
+
+ Test: compositing/repaint/clipped-layer-size-change.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::RenderLayerBacking):
+ (WebCore::RenderLayerBacking::updateCompositedBounds):
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ * rendering/RenderLayerBacking.h:
+ (RenderLayerBacking):
+
2012-12-10 Dean Jackson <[email protected]>
Remove old WebKit Animation API code
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (137247 => 137248)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-12-11 05:22:49 UTC (rev 137247)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-12-11 05:54:06 UTC (rev 137248)
@@ -101,6 +101,7 @@
: m_owningLayer(layer)
, m_scrollLayerID(0)
, m_artificiallyInflatedBounds(false)
+ , m_boundsConstrainedByClipping(false)
, m_isMainFrameRenderViewLayer(false)
, m_usingTiledCacheLayer(false)
, m_requiresOwnBackingStore(true)
@@ -366,7 +367,6 @@
return true;
}
-
void RenderLayerBacking::updateCompositedBounds()
{
IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
@@ -389,7 +389,9 @@
clippingBounds.move(-delta.x(), -delta.y());
layerBounds.intersect(pixelSnappedIntRect(clippingBounds));
- }
+ m_boundsConstrainedByClipping = true;
+ } else
+ m_boundsConstrainedByClipping = false;
// If the element has a transform-origin that has fixed lengths, and the renderer has zero size,
// then we need to ensure that the compositing layer has non-zero size so that we can apply
@@ -631,8 +633,14 @@
FloatSize oldSize = m_graphicsLayer->size();
FloatSize newSize = relativeCompositingBounds.size();
- if (oldSize != newSize)
+ if (oldSize != newSize) {
m_graphicsLayer->setSize(newSize);
+ // Usually invalidation will happen via layout etc, but if we've affected the layer
+ // size by constraining relative to a clipping ancestor or the viewport, we
+ // have to invalidate to avoid showing stretched content.
+ if (m_boundsConstrainedByClipping)
+ m_graphicsLayer->setNeedsDisplay();
+ }
// If we have a layer that clips children, position it.
IntRect clippingBox;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (137247 => 137248)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2012-12-11 05:22:49 UTC (rev 137247)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2012-12-11 05:54:06 UTC (rev 137248)
@@ -275,7 +275,8 @@
IntRect m_compositedBounds;
- bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
+ bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
+ bool m_boundsConstrainedByClipping;
bool m_isMainFrameRenderViewLayer;
bool m_usingTiledCacheLayer;
bool m_requiresOwnBackingStore;