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

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: Mark scrolling contents layer no longer opaque and setNeedsRepaint and add content to test. 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b1c4aa02c5bcea8978bed491f1a0144bc04e4b36 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,24 @@ void CompositedLayerMapping::updateIsRootForIsolatedGroup()
m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
}
+void CompositedLayerMapping::updateBackgroundPaintingLayer()
+{
+ bool backgroundLayerPaintsOntoScrollingContentsLayer = shouldPaintBackgroundOntoScrollingContentsLayer();
+ if (backgroundLayerPaintsOntoScrollingContentsLayer != m_backgroundPaintsOntoScrollingContentsLayer) {
chrishtr 2016/08/24 20:50:35 What if backgroundLayerPaintsOntoScrollingContents
flackr 2016/08/24 21:01:10 It does, but in that case it's handled by LayoutBo
+ m_backgroundPaintsOntoScrollingContentsLayer = backgroundLayerPaintsOntoScrollingContentsLayer;
+ // 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 (hasScrollingLayer() && !backgroundLayerPaintsOntoScrollingContentsLayer) {
chrishtr 2016/08/24 00:33:26 This is not the right place for this invalidation.
flackr 2016/08/24 01:34:51 Hmm, PaintLayer::styleDidChange could detect most
+ m_scrollingContentsLayer->setNeedsDisplay();
+ m_owningLayer.setNeedsRepaint();
+ }
+ }
+}
+
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 +327,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
@@ -323,6 +339,8 @@ void CompositedLayerMapping::updateContentsOpaque()
// not opaque.
m_graphicsLayer->setContentsOpaque(false);
} else {
+ if (hasScrollingLayer())
+ m_scrollingContentsLayer->setContentsOpaque(false);
m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
}
}
@@ -768,6 +786,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(const PaintLayer* compo
updateBackgroundColor();
updateDrawsContent();
updateElementIdAndCompositorMutableProperties();
+ updateBackgroundPaintingLayer();
updateContentsOpaque();
updateAfterPartResize();
updateRenderingContext();
@@ -2460,7 +2479,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())
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698