Chromium Code Reviews| Index: Source/core/rendering/RenderLayerBacking.cpp |
| diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp |
| index a5a84c2b7768a81120c75fe9546c869b246ec6c4..760b32b824124e33a548dc51526bf43ef6ba5b51 100644 |
| --- a/Source/core/rendering/RenderLayerBacking.cpp |
| +++ b/Source/core/rendering/RenderLayerBacking.cpp |
| @@ -82,6 +82,14 @@ static inline bool isAcceleratedCanvas(RenderObject* renderer) |
| return false; |
| } |
| +static inline bool shouldClipRoundedBorders(RenderObject* renderer) |
| +{ |
| + return renderer->style()->hasBorderRadius() |
| + && (isAcceleratedCanvas(renderer) |
|
jamesr
2013/07/03 21:34:01
i'm not sure i understand the purpose of these che
rosca
2013/07/04 07:51:51
This is the first case, where the content being cl
|
| + || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) |
| + || renderer->isVideo()); |
| +} |
| + |
| // Get the scrolling coordinator in a way that works inside RenderLayerBacking's destructor. |
| static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer* layer) |
| { |
| @@ -168,6 +176,11 @@ void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaint |
| m_maskLayer->setShowRepaintCounter(showRepaintCounter); |
| } |
| + if (m_borderRadiusLayer) { |
| + m_borderRadiusLayer->setShowDebugBorder(showBorder); |
| + m_borderRadiusLayer->setShowRepaintCounter(showRepaintCounter); |
| + } |
| + |
| if (m_layerForHorizontalScrollbar) |
| m_layerForHorizontalScrollbar->setShowDebugBorder(showBorder); |
| @@ -220,6 +233,7 @@ void RenderLayerBacking::destroyGraphicsLayers() |
| m_backgroundLayer = nullptr; |
| m_childContainmentLayer = nullptr; |
| m_maskLayer = nullptr; |
| + m_borderRadiusLayer = nullptr; |
| m_scrollingLayer = nullptr; |
| m_scrollingContentsLayer = nullptr; |
| @@ -431,6 +445,9 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration() |
| if (updateMaskLayer(renderer->hasMask())) |
| m_graphicsLayer->setMaskLayer(m_maskLayer.get()); |
| + if (updateBorderRadiusLayer(shouldClipRoundedBorders(renderer))) |
| + m_graphicsLayer->setBorderRadiusLayer(m_borderRadiusLayer.get()); |
| + |
| if (m_owningLayer->hasReflection()) { |
| if (m_owningLayer->reflectionLayer()->backing()) { |
| GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->backing()->graphicsLayer(); |
| @@ -1066,6 +1083,23 @@ bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer) |
| return layerChanged; |
| } |
| +bool RenderLayerBacking::updateBorderRadiusLayer(bool needsBorderRadiusLayer) |
| +{ |
| + bool layerChanged = false; |
| + if (needsBorderRadiusLayer) { |
| + if (!m_borderRadiusLayer) { |
| + m_borderRadiusLayer = createGraphicsLayer("BorderRadiusMask", CompositingReasonLayerForMask); |
| + m_borderRadiusLayer->setDrawsContent(true); |
| + m_borderRadiusLayer->setPaintingPhase(GraphicsLayerPaintBorderRadiusMask); |
| + layerChanged = true; |
| + } |
| + } else if (m_borderRadiusLayer) { |
| + m_borderRadiusLayer = nullptr; |
| + layerChanged = true; |
| + } |
| + return layerChanged; |
| +} |
| + |
| bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers) |
| { |
| ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer); |
| @@ -1553,6 +1587,9 @@ void RenderLayerBacking::setContentsNeedDisplay() |
| if (m_maskLayer && m_maskLayer->drawsContent()) |
| m_maskLayer->setNeedsDisplay(); |
| + if (m_borderRadiusLayer && m_borderRadiusLayer->drawsContent()) |
| + m_borderRadiusLayer->setNeedsDisplay(); |
| + |
| if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) |
| m_scrollingContentsLayer->setNeedsDisplay(); |
| } |
| @@ -1587,6 +1624,12 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) |
| m_maskLayer->setNeedsDisplayInRect(layerDirtyRect); |
| } |
| + if (m_borderRadiusLayer && m_borderRadiusLayer->drawsContent()) { |
| + IntRect layerDirtyRect = r; |
| + layerDirtyRect.move(-m_borderRadiusLayer->offsetFromRenderer()); |
| + m_borderRadiusLayer->setNeedsDisplayInRect(layerDirtyRect); |
| + } |
| + |
| if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) { |
| IntRect layerDirtyRect = r; |
| layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer()); |
| @@ -1612,6 +1655,8 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap |
| paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase; |
| if (paintingPhase & GraphicsLayerPaintMask) |
| paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase; |
| + if (paintingPhase & GraphicsLayerPaintBorderRadiusMask) |
| + paintFlags |= RenderLayer::PaintLayerPaintingCompositingBorderRadiusMaskPhase; |
| if (paintingPhase & GraphicsLayerPaintOverflowContents) |
| paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents; |
| if (paintingPhase & GraphicsLayerPaintCompositedScroll) |
| @@ -1658,6 +1703,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph |
| || graphicsLayer == m_foregroundLayer.get() |
| || graphicsLayer == m_backgroundLayer.get() |
| || graphicsLayer == m_maskLayer.get() |
| + || graphicsLayer == m_borderRadiusLayer.get() |
| || graphicsLayer == m_scrollingContentsLayer.get()) { |
| InspectorInstrumentation::willPaint(renderer()); |
| @@ -1935,6 +1981,8 @@ double RenderLayerBacking::backingStoreMemoryEstimate() const |
| backingMemory += m_backgroundLayer->backingStoreMemoryEstimate(); |
| if (m_maskLayer) |
| backingMemory += m_maskLayer->backingStoreMemoryEstimate(); |
| + if (m_borderRadiusLayer) |
| + backingMemory += m_borderRadiusLayer->backingStoreMemoryEstimate(); |
| if (m_scrollingContentsLayer) |
| backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate(); |
| @@ -1962,6 +2010,7 @@ void RenderLayerBacking::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c |
| info.addMember(m_backgroundLayer, "backgroundLayer"); |
| info.addMember(m_childContainmentLayer, "childContainmentLayer"); |
| info.addMember(m_maskLayer, "maskLayer"); |
| + info.addMember(m_borderRadiusLayer, "borderRadiusLayer"); |
| info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar"); |
| info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); |
| info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); |