Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1283)

Unified Diff: Source/core/paint/LayerClipRecorder.cpp

Issue 1144203004: Allow certain SP recorder classes to defer their "begin" operation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/LayerClipRecorder.h ('k') | Source/core/paint/PartPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/paint/LayerClipRecorder.h ('k') | Source/core/paint/PartPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698