| Index: Source/core/paint/LayerClipRecorder.cpp
|
| diff --git a/Source/core/paint/LayerClipRecorder.cpp b/Source/core/paint/LayerClipRecorder.cpp
|
| index 8ed407eb3a00945912f0a74413a992922bf1cfe9..2fe66afd52c41522aff98a69737c938302f9541b 100644
|
| --- a/Source/core/paint/LayerClipRecorder.cpp
|
| +++ b/Source/core/paint/LayerClipRecorder.cpp
|
| @@ -17,24 +17,19 @@
|
|
|
| namespace blink {
|
|
|
| -LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const LayoutBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& clipRect,
|
| - const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule)
|
| +LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, DisplayItem::Type clipType)
|
| : m_graphicsContext(graphicsContext)
|
| - , m_layoutObject(layoutObject)
|
| + , m_layoutObject(nullptr)
|
| , m_clipType(clipType)
|
| + , m_engaged(false)
|
| {
|
| - IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect());
|
| - OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutObject, clipType, snappedClipRect);
|
| - if (localPaintingInfo && clipRect.hasRadius())
|
| - collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graphicsContext, fragmentOffset, paintFlags, rule, clipDisplayItem->roundedRectClips());
|
| - if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| - clipDisplayItem->replay(graphicsContext);
|
| - } else {
|
| - ASSERT(m_graphicsContext.displayItemList());
|
| - if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabled())
|
| - return;
|
| - m_graphicsContext.displayItemList()->add(clipDisplayItem.release());
|
| - }
|
| +}
|
| +
|
| +LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const LayoutBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& clipRect,
|
| + const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule)
|
| + : LayerClipRecorder(graphicsContext, clipType)
|
| +{
|
| + begin(layoutObject, clipRect, localPaintingInfo, fragmentOffset, paintFlags, rule);
|
| }
|
|
|
| static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedPaintLayer* endLayer)
|
| @@ -78,16 +73,39 @@ void LayerClipRecorder::collectRoundedRectClips(DeprecatedPaintLayer& paintLayer
|
|
|
| LayerClipRecorder::~LayerClipRecorder()
|
| {
|
| + if (!m_engaged)
|
| + return;
|
| +
|
| if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| ASSERT(m_graphicsContext.displayItemList());
|
| if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabled())
|
| return;
|
| DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType);
|
| - OwnPtr<EndClipDisplayItem> endClip = EndClipDisplayItem::create(m_layoutObject, endType);
|
| + OwnPtr<EndClipDisplayItem> endClip = EndClipDisplayItem::create(*m_layoutObject, endType);
|
| m_graphicsContext.displayItemList()->add(endClip.release());
|
| } else {
|
| m_graphicsContext.restore();
|
| }
|
| }
|
|
|
| +void LayerClipRecorder::begin(const LayoutBoxModelObject& layoutObject, const ClipRect& clipRect, const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule)
|
| +{
|
| + ASSERT(!m_engaged);
|
| + m_engaged = true;
|
| + m_layoutObject = &layoutObject;
|
| +
|
| + IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect());
|
| + OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(*m_layoutObject, m_clipType, snappedClipRect);
|
| + if (localPaintingInfo && clipRect.hasRadius())
|
| + collectRoundedRectClips(*m_layoutObject->layer(), *localPaintingInfo, m_graphicsContext, fragmentOffset, paintFlags, rule, clipDisplayItem->roundedRectClips());
|
| + if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) {
|
| + clipDisplayItem->replay(m_graphicsContext);
|
| + } else {
|
| + ASSERT(m_graphicsContext.displayItemList());
|
| + if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabled())
|
| + return;
|
| + m_graphicsContext.displayItemList()->add(clipDisplayItem.release());
|
| + }
|
| +}
|
| +
|
| } // namespace blink
|
|
|