Index: Source/core/rendering/compositing/CompositedLayerMapping.cpp |
diff --git a/Source/core/rendering/compositing/CompositedLayerMapping.cpp b/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
index 8f63184303482ada56d28a7ef616b994e2ee7867..2c30b087c7771fd357df89206a1a85259fbb2f03 100644 |
--- a/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
+++ b/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
@@ -176,6 +176,7 @@ CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) |
, m_backgroundLayerPaintsFixedRootBackground(false) |
, m_needToUpdateGraphicsLayer(false) |
, m_needToUpdateGraphicsLayerOfAllDecendants(false) |
+ , m_scrollingContentsAreEmpty(false) |
{ |
if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) |
m_isMainFrameRenderViewLayer = true; |
@@ -1056,6 +1057,16 @@ void CompositedLayerMapping::updateContentsRect() |
m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); |
} |
+void CompositedLayerMapping::updateScrollingContentsForSelectionGaps() |
+{ |
+ if (!m_scrollingContentsAreEmpty || !m_scrollingContentsLayer) |
+ return; |
+ |
+ // FIXME: in this case, the scrolling contents layer doesn't need to be full size. We should position and size |
+ // it more conservatively. See crbug.com/381187. |
+ m_scrollingContentsLayer->setDrawsContent(m_owningLayer.rendererHasBlockSelectionGaps() == RenderLayer::LayerHasBlockSelectionGaps); |
+} |
+ |
void CompositedLayerMapping::updateDrawsContent() |
{ |
if (m_scrollingLayer) { |
@@ -1067,7 +1078,11 @@ void CompositedLayerMapping::updateDrawsContent() |
m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); |
bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && (renderer()->hasBackground() || paintsChildren()); |
- m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); |
+ m_scrollingContentsAreEmpty = !hasScrollingPaintedContent; |
+ |
+ RenderLayer::PresenceOfBlockSelectionGaps hasBlockSelectionGaps = owningLayer().rendererHasBlockSelectionGaps(); |
+ bool shouldDrawContent = !m_scrollingContentsAreEmpty || hasBlockSelectionGaps == RenderLayer::LayerHasBlockSelectionGaps; |
+ m_scrollingContentsLayer->setDrawsContent(shouldDrawContent); |
return; |
} |