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..8fe11b28904612a0a199ccd50186800033ecc019 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
@@ -309,7 +309,15 @@ 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. |
+ if (hasScrollingLayer() && m_owningLayer.shouldPaintBackgroundOntoForeground()) { |
+ // Backgrounds painted onto the foreground are clipped by the padding box rect. |
+ // TODO(flackr): Check the entire overflow rect. |
+ m_scrollingContentsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(toLayoutBox(layoutObject())->paddingBoxRect())); |
+ } |
+ // The border is always painted by the m_graphicsLayer, so we check if it is known to be |
+ // opaque separately. |
m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); |
} |
} |
@@ -2421,8 +2429,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. |