Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2266103002: Repaint when background switches painting from/to scrolling contents layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update flag and use setNeedsDisplay to dirty scrollingContentsLayer. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index c070f17b691aaa55202e27bd01b0c065aeb2c101..7cd26080cb894d0fef511a67ca34bfbea54273f1 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -173,6 +173,7 @@ CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer)
, m_isMainFrameLayoutViewLayer(false)
, m_backgroundLayerPaintsFixedRootBackground(false)
, m_scrollingContentsAreEmpty(false)
+ , m_backgroundPaintsOntoScrollingContentsLayer(false)
{
if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame())
m_isMainFrameLayoutViewLayer = true;
@@ -293,9 +294,22 @@ void CompositedLayerMapping::updateIsRootForIsolatedGroup()
m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
}
+void CompositedLayerMapping::updateBackgroundPaintingLayer()
+{
+ bool backgroundLayerPaintsOntoScrollingContentsLayer = shouldPaintBackgroundOntoScrollingContentsLayer();
+ if (backgroundLayerPaintsOntoScrollingContentsLayer != m_backgroundPaintsOntoScrollingContentsLayer) {
+ // If the background is no longer painted onto the scrolling contents
+ // layer the scrolling contents layer needs to be updated. If it is
+ // going to be painted onto the scrolling contents layer this update
+ // will be triggered by LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect
+ if (!backgroundLayerPaintsOntoScrollingContentsLayer)
+ m_scrollingContentsLayer->setNeedsDisplay();
+ m_backgroundPaintsOntoScrollingContentsLayer = backgroundLayerPaintsOntoScrollingContentsLayer;
+ }
+}
+
void CompositedLayerMapping::updateContentsOpaque()
{
- ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer);
if (isAcceleratedCanvas(layoutObject())) {
// Determine whether the rendering context's external texture layer is opaque.
CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->node())->renderingContext();
@@ -311,7 +325,7 @@ void CompositedLayerMapping::updateContentsOpaque()
} else {
// For non-root layers, background is painted by the scrolling contents layer if all backgrounds
// are background attachment local, otherwise background is painted by the primary graphics layer.
- if (hasScrollingLayer() && shouldPaintBackgroundOntoScrollingContentsLayer()) {
+ if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) {
// Backgrounds painted onto the foreground are clipped by the padding box rect.
// TODO(flackr): This should actually check the entire overflow rect within the
// scrolling contents layer but since we currently only trigger this for solid
@@ -768,6 +782,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(const PaintLayer* compo
updateBackgroundColor();
updateDrawsContent();
updateElementIdAndCompositorMutableProperties();
+ updateBackgroundPaintingLayer();
updateContentsOpaque();
updateAfterPartResize();
updateRenderingContext();
@@ -2460,7 +2475,7 @@ void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
|| graphicsLayer == m_childClippingMaskLayer.get()
|| graphicsLayer == m_scrollingContentsLayer.get()) {
- bool paintRootBackgroundOntoScrollingContentsLayer = shouldPaintBackgroundOntoScrollingContentsLayer();
+ bool paintRootBackgroundOntoScrollingContentsLayer = m_backgroundPaintsOntoScrollingContentsLayer;
DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || (!m_backgroundLayer && !m_foregroundLayer));
if (paintRootBackgroundOntoScrollingContentsLayer) {
if (graphicsLayer == m_scrollingContentsLayer.get())

Powered by Google App Engine
This is Rietveld 408576698