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

Unified Diff: Source/core/paint/RoundedInnerRectClipper.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/RoundedInnerRectClipper.h ('k') | Source/core/paint/SVGContainerPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/RoundedInnerRectClipper.cpp
diff --git a/Source/core/paint/RoundedInnerRectClipper.cpp b/Source/core/paint/RoundedInnerRectClipper.cpp
index 5f4274cc6bdedd8a7e88c758d4c57acecfb6c2de..b9f8484ee71b96fa74190a30f21f41b10e5102d8 100644
--- a/Source/core/paint/RoundedInnerRectClipper.cpp
+++ b/Source/core/paint/RoundedInnerRectClipper.cpp
@@ -12,13 +12,48 @@
namespace blink {
-RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, const PaintInfo& paintInfo, const LayoutRect& rect, const FloatRoundedRect& clipRect, RoundedInnerRectClipperBehavior behavior)
+RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, const PaintInfo& paintInfo)
: m_layoutObject(layoutObject)
, m_paintInfo(paintInfo)
- , m_useDisplayItemList(RuntimeEnabledFeatures::slimmingPaintEnabled() && behavior == ApplyToDisplayListIfEnabled)
- , m_clipType(m_useDisplayItemList ? m_paintInfo.displayItemTypeForClipping() : DisplayItem::ClipBoxPaintPhaseFirst)
+ , m_useDisplayItemList(false)
+ , m_clipType(DisplayItem::ClipBoxPaintPhaseFirst)
+ , m_engaged(false)
+{
+}
+
+RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, const PaintInfo& paintInfo, const LayoutRect& rect, const FloatRoundedRect& clipRect, RoundedInnerRectClipperBehavior behavior)
+ : RoundedInnerRectClipper(layoutObject, paintInfo)
{
- OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutObject, m_clipType, LayoutRect::infiniteIntRect());
+ begin(rect, clipRect, behavior);
+}
+
+RoundedInnerRectClipper::~RoundedInnerRectClipper()
+{
+ if (!m_engaged)
+ return;
+
+ DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType);
+ if (m_useDisplayItemList) {
+ ASSERT(m_paintInfo.context->displayItemList());
+ if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled())
+ return;
+ OwnPtr<EndClipDisplayItem> endClipDisplayItem = EndClipDisplayItem::create(m_layoutObject, endType);
+ m_paintInfo.context->displayItemList()->add(endClipDisplayItem.release());
+ } else {
+ EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType);
+ endClipDisplayItem.replay(*m_paintInfo.context);
+ }
+}
+
+void RoundedInnerRectClipper::begin(const LayoutRect& rect, const FloatRoundedRect& clipRect, RoundedInnerRectClipperBehavior behavior)
+{
+ ASSERT(!m_engaged);
+ m_engaged = true;
+
+ m_useDisplayItemList = RuntimeEnabledFeatures::slimmingPaintEnabled() && behavior == ApplyToDisplayListIfEnabled;
+ m_clipType = m_useDisplayItemList ? m_paintInfo.displayItemTypeForClipping() : DisplayItem::ClipBoxPaintPhaseFirst;
+
+ OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_layoutObject, m_clipType, LayoutRect::infiniteIntRect());
if (clipRect.isRenderable()) {
clipDisplayItem->roundedRectClips().append(clipRect);
@@ -55,22 +90,7 @@ RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, con
return;
m_paintInfo.context->displayItemList()->add(clipDisplayItem.release());
} else {
- clipDisplayItem->replay(*paintInfo.context);
- }
-}
-
-RoundedInnerRectClipper::~RoundedInnerRectClipper()
-{
- DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType);
- if (m_useDisplayItemList) {
- ASSERT(m_paintInfo.context->displayItemList());
- if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled())
- return;
- OwnPtr<EndClipDisplayItem> endClipDisplayItem = EndClipDisplayItem::create(m_layoutObject, endType);
- m_paintInfo.context->displayItemList()->add(endClipDisplayItem.release());
- } else {
- EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType);
- endClipDisplayItem.replay(*m_paintInfo.context);
+ clipDisplayItem->replay(*m_paintInfo.context);
}
}
« no previous file with comments | « Source/core/paint/RoundedInnerRectClipper.h ('k') | Source/core/paint/SVGContainerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698