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

Unified Diff: Source/core/paint/ScrollRecorder.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/ScrollRecorder.h ('k') | Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ScrollRecorder.cpp
diff --git a/Source/core/paint/ScrollRecorder.cpp b/Source/core/paint/ScrollRecorder.cpp
index bbc320b683e32d46d749edacfadbc2ce4a72fa05..7fedf69ab3338544b3681c36feaa2688c2bce67f 100644
--- a/Source/core/paint/ScrollRecorder.cpp
+++ b/Source/core/paint/ScrollRecorder.cpp
@@ -12,33 +12,50 @@
namespace blink {
-ScrollRecorder::ScrollRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase phase, const IntSize& currentOffset)
+ScrollRecorder::ScrollRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase phase)
: m_client(client)
, m_beginItemType(DisplayItem::paintPhaseToScrollType(phase))
, m_context(context)
+ , m_engaged(false)
{
+}
+
+ScrollRecorder::ScrollRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase phase, const IntSize& currentOffset)
+ : ScrollRecorder(context, client, phase)
+{
+ begin(currentOffset);
+}
+
+ScrollRecorder::~ScrollRecorder()
+{
+ if (!m_engaged)
+ return;
+
+ DisplayItem::Type endItemType = DisplayItem::scrollTypeToEndScrollType(m_beginItemType);
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
- m_context.displayItemList()->add(BeginScrollDisplayItem::create(m_client, m_beginItemType, currentOffset));
+ m_context.displayItemList()->add(EndScrollDisplayItem::create(m_client, endItemType));
} else {
- BeginScrollDisplayItem scrollDisplayItem(m_client, m_beginItemType, currentOffset);
- scrollDisplayItem.replay(m_context);
+ EndScrollDisplayItem endScrollDisplayItem(m_client, endItemType);
+ endScrollDisplayItem.replay(m_context);
}
}
-ScrollRecorder::~ScrollRecorder()
+void ScrollRecorder::begin(const IntSize& currentOffset)
{
- DisplayItem::Type endItemType = DisplayItem::scrollTypeToEndScrollType(m_beginItemType);
+ ASSERT(!m_engaged);
+ m_engaged = true;
+
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
- m_context.displayItemList()->add(EndScrollDisplayItem::create(m_client, endItemType));
+ m_context.displayItemList()->add(BeginScrollDisplayItem::create(m_client, m_beginItemType, currentOffset));
} else {
- EndScrollDisplayItem endScrollDisplayItem(m_client, endItemType);
- endScrollDisplayItem.replay(m_context);
+ BeginScrollDisplayItem scrollDisplayItem(m_client, m_beginItemType, currentOffset);
+ scrollDisplayItem.replay(m_context);
}
}
« no previous file with comments | « Source/core/paint/ScrollRecorder.h ('k') | Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698