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 51159637bc5b210ce7b76982670cd289db156338..7787bb0b809e2545725b7ace00ef46a09a08b7c6 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
@@ -309,7 +309,17 @@ void CompositedLayerMapping::updateContentsOpaque() |
m_graphicsLayer->setContentsOpaque(false); |
m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
} else { |
- // For non-root layers, background is always painted by the primary graphics layer. |
+ // 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. |
chrishtr
2016/07/29 21:04:34
Even with this CL, doesn't m_graphicsLayer still p
flackr
2016/08/02 16:58:14
No, it's either painted into m_scrollingContentsLa
chrishtr
2016/08/03 18:58:00
1. I don't see this exclusion in the current patch
flackr
2016/08/03 20:58:52
We always paint the border and shadows into the m_
chrishtr
2016/08/04 05:20:52
I still don't see the logic that leads to this...
|
+ if (hasScrollingLayer() && m_owningLayer.shouldPaintBackgroundOntoForeground()) { |
+ // 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 |
+ // color backgrounds the answer will be the same. |
+ m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); |
+ } |
+ // The border is always painted into the m_graphicsLayer, so we check if it is known to be |
+ // opaque separately. |
m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
} |
} |
@@ -2421,8 +2431,11 @@ void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G |
paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; |
if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) |
paintLayerFlags |= PaintLayerPaintingOverflowContents; |
- if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) |
+ if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) { |
paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; |
+ if (m_owningLayer.shouldPaintBackgroundOntoForeground()) |
+ paintLayerFlags |= PaintLayerPaintingBackgroundOntoForeground; |
+ } |
if (graphicsLayer == m_backgroundLayer.get()) |
paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers. |