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

Unified Diff: Source/platform/graphics/paint/DisplayItem.h

Issue 1157653005: Move use of DisplayItemList's vector behind an explicit DisplayItems interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: DisplayItems must be noncopyable (Windows build fix) Created 5 years, 6 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
Index: Source/platform/graphics/paint/DisplayItem.h
diff --git a/Source/platform/graphics/paint/DisplayItem.h b/Source/platform/graphics/paint/DisplayItem.h
index d72b72c18024f045fecf0dbb912a27f001b4a9e2..ed8985384fd6aee80bffa12ab56447a5271950e0 100644
--- a/Source/platform/graphics/paint/DisplayItem.h
+++ b/Source/platform/graphics/paint/DisplayItem.h
@@ -176,18 +176,50 @@ public:
TypeLast = EndSubtreeLast
};
+ struct Id {
+ Id(DisplayItemClient c, Type t) : client(c), type(t), scopeId(0), scopeContainer(nullptr)
+ {
+ ASSERT(c);
+ }
+
+ bool operator==(const Id& other) const
+ {
+ return client == other.client
+ && type == other.type
+ && scopeId == other.scopeId
+ && scopeContainer == other.scopeContainer;
+ }
+
+ bool equalToExceptForType(const Id& other, DisplayItem::Type overrideType) const
+ {
+ return client == other.client
+ && type == overrideType
+ && scopeId == other.scopeId
+ && scopeContainer == other.scopeContainer;
+ }
+
+ const DisplayItemClient client;
+ const Type type;
+ int scopeId;
+ DisplayItemClient scopeContainer;
+ };
+
virtual ~DisplayItem() { }
virtual void replay(GraphicsContext&) { }
DisplayItemClient client() const { return m_client; }
Type type() const { return m_type; }
+ Id id() const
+ {
+ Id result(m_client, m_type);
+ result.scopeId = m_scopeId;
+ result.scopeContainer = m_scopeContainer;
+ return result;
+ }
bool idsEqual(const DisplayItem& other, Type overrideType) const
{
- return m_client == other.m_client
- && m_type == overrideType
- && m_scopeId == other.m_scopeId
- && m_scopeContainer == other.m_scopeContainer;
+ return id().equalToExceptForType(other.id(), overrideType);
}
void setScope(int scopeId, DisplayItemClient scopeContainer)
@@ -266,7 +298,7 @@ public:
virtual bool isEnd() const { return false; }
#if ENABLE(ASSERT)
- virtual bool isEndAndPairedWith(const DisplayItem& other) const { return false; }
+ virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const { return false; }
#endif
virtual bool drawsContent() const { return false; }
@@ -316,7 +348,7 @@ protected:
PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type) { }
#if ENABLE(ASSERT)
- virtual bool isEndAndPairedWith(const DisplayItem& other) const override = 0;
+ virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0;
#endif
private:

Powered by Google App Engine
This is Rietveld 408576698