Log Message
Repaint all graphics layers when their renderer offset changes https://bugs.webkit.org/show_bug.cgi?id=75730
Reviewed by Simon Fraser. Source/WebCore: In RenderLayerBacking, only the main graphics layer gets repainted when the offset changes. If the offset on other graphics layers (e.g. the foreground layer) changes, they should get repainted as well. Test: compositing/geometry/foreground-offset-change.html * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::setOffsetFromRenderer): (WebCore::GraphicsLayer::paintGraphicsLayerContents): * platform/graphics/GraphicsLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): (WebCore::RenderLayerBacking::paintContents): LayoutTests: * compositing/geometry/foreground-offset-change-expected.png: Added. * compositing/geometry/foreground-offset-change-expected.txt: Added. * compositing/geometry/foreground-offset-change.html: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp
- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (104781 => 104782)
--- trunk/LayoutTests/ChangeLog 2012-01-12 02:30:39 UTC (rev 104781)
+++ trunk/LayoutTests/ChangeLog 2012-01-12 03:46:47 UTC (rev 104782)
@@ -1,3 +1,14 @@
+2012-01-11 Adrienne Walker <[email protected]>
+
+ Repaint all graphics layers when their renderer offset changes
+ https://bugs.webkit.org/show_bug.cgi?id=75730
+
+ Reviewed by Simon Fraser.
+
+ * compositing/geometry/foreground-offset-change-expected.png: Added.
+ * compositing/geometry/foreground-offset-change-expected.txt: Added.
+ * compositing/geometry/foreground-offset-change.html: Added.
+
2012-01-11 Dmitry Titov <[email protected]>
[Chromium] Rebaseline test images for input controls
Added: trunk/LayoutTests/compositing/geometry/foreground-offset-change-expected.png (0 => 104782)
--- trunk/LayoutTests/compositing/geometry/foreground-offset-change-expected.png (rev 0)
+++ trunk/LayoutTests/compositing/geometry/foreground-offset-change-expected.png 2012-01-12 03:46:47 UTC (rev 104782)
@@ -0,0 +1,7 @@
+\x89PNG
+
+
+IHDR X ' )tEXtchecksum 919c4609446010053b38c67636334c9a\xAE\x92v\xA1
+\xD1IDATx\x9C\xEDٱ
+\x840As\xBA\xBE\xA0t\xA8\xCCW\xD9
+K\xC7L\xEA䅫\xEFm\xCE9 \xE8|V \xF87 &\xB0 b &\xB0 b &\xB0 b \xF6\xBD{\xB8\xAE\xEB\xC9 \xBC־\xEF\xAB'@\xEC6\xB0\xC6\xC7y<5\x80\x97:\x8Fs\xF5\xE8\xF9" \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88ms\xCE\xD5 \xFE\x8A @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 @\xEC\xD2 \xAD|\x81\xE2 IEND\xAEB`\x82
\ No newline at end of file
Added: trunk/LayoutTests/compositing/geometry/foreground-offset-change-expected.txt (0 => 104782)
--- trunk/LayoutTests/compositing/geometry/foreground-offset-change-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/geometry/foreground-offset-change-expected.txt 2012-01-12 03:46:47 UTC (rev 104782)
@@ -0,0 +1 @@
+
Added: trunk/LayoutTests/compositing/geometry/foreground-offset-change.html (0 => 104782)
--- trunk/LayoutTests/compositing/geometry/foreground-offset-change.html (rev 0)
+++ trunk/LayoutTests/compositing/geometry/foreground-offset-change.html 2012-01-12 03:46:47 UTC (rev 104782)
@@ -0,0 +1,73 @@
+<html>
+<head>
+ <style>
+ #clipper {
+ width: 550px;
+ height: 550px;
+ overflow:hidden;
+ }
+
+ #trigger {
+ /* Only overlap with the contents element, not the stretch element */
+ -webkit-transform:translateZ(0);
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 500px;
+ height: 200px;
+ }
+
+ #container {
+ /* Force compositing for this layer if any children get composited */
+ -webkit-transform:translate(0px, 1px);
+ }
+
+ #negative {
+ /* Trigger foreground layer from container */
+ z-index: -1;
+ position: absolute;
+ }
+
+ #contents {
+ /* foreground layer contents */
+ width: 550px;
+ height: 550px;
+ background-color: green;
+ }
+
+ /* Move this element to stretch container to have a negative offset */
+ #stretch {
+ position: absolute;
+ background-color: blue;
+ top: 200px;
+ left: -200px;
+ width: 50px;
+ height: 50px;
+ }
+
+ </style>
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText(true);
+
+ function doTest()
+ {
+ if (window.layoutTestController)
+ layoutTestController.display();
+
+ document.getElementById("stretch").style.left = "-100px";
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ <div id="trigger"></div>
+ <div id="clipper">
+ <div id="container">
+ <img id="contents">
+ <div id="stretch"></div>
+ <div id="negative"></div>
+ </div>
+ </div>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (104781 => 104782)
--- trunk/Source/WebCore/ChangeLog 2012-01-12 02:30:39 UTC (rev 104781)
+++ trunk/Source/WebCore/ChangeLog 2012-01-12 03:46:47 UTC (rev 104782)
@@ -1,3 +1,24 @@
+2012-01-11 Adrienne Walker <[email protected]>
+
+ Repaint all graphics layers when their renderer offset changes
+ https://bugs.webkit.org/show_bug.cgi?id=75730
+
+ Reviewed by Simon Fraser.
+
+ In RenderLayerBacking, only the main graphics layer gets repainted
+ when the offset changes. If the offset on other graphics layers (e.g.
+ the foreground layer) changes, they should get repainted as well.
+
+ Test: compositing/geometry/foreground-offset-change.html
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::setOffsetFromRenderer):
+ (WebCore::GraphicsLayer::paintGraphicsLayerContents):
+ * platform/graphics/GraphicsLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ (WebCore::RenderLayerBacking::paintContents):
+
2012-01-11 Scott Violet <[email protected]>
[chromium] TiledLayerChromium drops invalidates that occur during
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (104781 => 104782)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2012-01-12 02:30:39 UTC (rev 104781)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2012-01-12 03:46:47 UTC (rev 104782)
@@ -30,6 +30,8 @@
#include "GraphicsLayer.h"
#include "FloatPoint.h"
+#include "GraphicsContext.h"
+#include "LayoutTypes.h"
#include "RotateTransformOperation.h"
#include "TextStream.h"
#include <wtf/text/CString.h>
@@ -261,6 +263,17 @@
m_replicaLayer = layer;
}
+void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset)
+{
+ if (offset == m_offsetFromRenderer)
+ return;
+
+ m_offsetFromRenderer = offset;
+
+ // If the compositing layer offset changes, we need to repaint.
+ setNeedsDisplay();
+}
+
void GraphicsLayer::setBackgroundColor(const Color& color)
{
m_backgroundColor = color;
@@ -278,8 +291,15 @@
#ifndef NDEBUG
s_inPaintContents = true;
#endif
- if (m_client)
- m_client->paintContents(this, context, m_paintingPhase, clip);
+ if (m_client) {
+ LayoutSize offset = offsetFromRenderer();
+ context.translate(-offset);
+
+ LayoutRect clipRect(clip);
+ clipRect.move(offset);
+
+ m_client->paintContents(this, context, m_paintingPhase, clipRect);
+ }
#ifndef NDEBUG
s_inPaintContents = false;
#endif
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (104781 => 104782)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-01-12 02:30:39 UTC (rev 104781)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-01-12 03:46:47 UTC (rev 104782)
@@ -258,7 +258,7 @@
// Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative).
IntSize offsetFromRenderer() const { return m_offsetFromRenderer; }
- void setOffsetFromRenderer(const IntSize& offset) { m_offsetFromRenderer = offset; }
+ void setOffsetFromRenderer(const IntSize&);
// The position of the layer (the location of its top-left corner in its parent)
const FloatPoint& position() const { return m_position; }
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (104781 => 104782)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-01-12 02:30:39 UTC (rev 104781)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-01-12 03:46:47 UTC (rev 104782)
@@ -453,14 +453,8 @@
}
m_graphicsLayer->setPosition(FloatPoint() + (relativeCompositingBounds.location() - graphicsLayerParentLocation));
-
- LayoutSize oldOffsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - LayoutPoint());
- // If the compositing layer offset changes, we need to repaint.
- if (oldOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer())
- m_graphicsLayer->setNeedsDisplay();
-
FloatSize oldSize = m_graphicsLayer->size();
FloatSize newSize = relativeCompositingBounds.size();
if (oldSize != newSize) {
@@ -1234,15 +1228,9 @@
if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get()) {
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_owningLayer->renderer()->frame(), clip);
- LayoutSize offset = graphicsLayer->offsetFromRenderer();
- context.translate(-offset);
-
- LayoutRect clipRect(clip);
- clipRect.move(offset);
-
// The dirtyRect is in the coords of the painting root.
LayoutRect dirtyRect = compositedBounds();
- dirtyRect.intersect(clipRect);
+ dirtyRect.intersect(clip);
// We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase, renderer());
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes
