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 99a217ea891822244bcdcb4c8ef4925719edf1da..e6397348d169f507c61c3f8012dc8e5932042294 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
@@ -174,6 +174,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; |
@@ -294,9 +295,24 @@ void CompositedLayerMapping::updateIsRootForIsolatedGroup() |
m_graphicsLayer->setIsRootForIsolatedGroup(isolate); |
} |
+void CompositedLayerMapping::updateBackgroundPaintingLayer() |
chrishtr
2016/08/24 23:35:32
updateBackgroundPaintsOntoScrollingContentsLayer
flackr
2016/08/25 15:21:52
Done.
|
+{ |
+ bool backgroundLayerPaintsOntoScrollingContentsLayer = shouldPaintBackgroundOntoScrollingContentsLayer(); |
+ if (backgroundLayerPaintsOntoScrollingContentsLayer != m_backgroundPaintsOntoScrollingContentsLayer) { |
+ 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) { |
+ 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(); |
@@ -312,7 +328,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 |
@@ -324,6 +340,8 @@ void CompositedLayerMapping::updateContentsOpaque() |
// not opaque. |
m_graphicsLayer->setContentsOpaque(false); |
} else { |
+ if (hasScrollingLayer()) |
+ m_scrollingContentsLayer->setContentsOpaque(false); |
chrishtr
2016/08/24 23:35:32
Is this technically an unrelated fix?
Is it teste
flackr
2016/08/25 15:21:52
No, this is necessary to remove contents opaque fl
|
m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
} |
} |
@@ -769,6 +787,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(const PaintLayer* compo |
updateBackgroundColor(); |
updateDrawsContent(); |
updateElementIdAndCompositorMutableProperties(); |
+ updateBackgroundPaintingLayer(); |
updateContentsOpaque(); |
updateAfterPartResize(); |
updateRenderingContext(); |
@@ -2461,7 +2480,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()) |