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

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

Issue 1425593007: Separate display item clients for negative and normal/positive z-order children (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Struct DisplayItemClient Created 5 years, 1 month 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: third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
index 35e1c414162c22fa4b24b1096f2952386b21678f..8bfb58e1646eec4b4a82927be7e90ad77eea50ff 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -168,14 +168,9 @@ public:
BeginFixedPositionContainer,
EndFixedPositionContainer,
- SubsequenceFirst,
- SubsequenceNegativeZOrder = SubsequenceFirst,
- SubsequenceNormalFlowAndPositiveZOrder,
- SubsequenceLast = SubsequenceNormalFlowAndPositiveZOrder,
- EndSubsequenceFirst,
- EndSubsequenceLast = EndSubsequenceFirst + SubsequenceLast - SubsequenceFirst,
- CachedSubsequenceFirst,
- CachedSubsequenceLast = CachedSubsequenceFirst + SubsequenceLast - SubsequenceFirst,
+ Subsequence,
+ EndSubsequence,
+ CachedSubsequence,
CachedDisplayItemList,
@@ -194,8 +189,9 @@ public:
};
DisplayItem(const DisplayItemClientWrapper& client, Type type, size_t derivedSize)
- : m_client(client.displayItemClient())
+ : m_clientObject(client.displayItemClient().object)
, m_scope(0)
+ , m_subClientId(client.displayItemClient().subClientId)
, m_type(type)
, m_derivedSize(derivedSize)
, m_skippedCache(false)
@@ -223,7 +219,7 @@ public:
// We should always convert to non-cached types before matching.
ASSERT(!isCachedType(item.m_type));
ASSERT(!isCachedType(type));
- return client == item.m_client
+ return client == item.client()
&& type == item.m_type
&& scope == item.m_scope;
}
@@ -238,20 +234,20 @@ public:
{
if (isCachedDrawingType(type))
return cachedDrawingTypeToDrawingType(type);
- if (isCachedSubsequenceType(type))
- return cachedSubsequenceTypeToSubsequenceType(type);
+ if (type == CachedSubsequence)
+ return Subsequence;
return type;
}
// Return the Id with cached type converted to non-cached type.
Id nonCachedId() const
{
- return Id(m_client, nonCachedType(m_type), m_scope);
+ return Id(client(), nonCachedType(m_type), m_scope);
}
virtual void replay(GraphicsContext&) const { }
- DisplayItemClient client() const { return m_client; }
+ DisplayItemClient client() const { return DisplayItemClient(m_clientObject, m_subClientId); }
Type type() const { return m_type; }
void setScope(unsigned scope) { m_scope = scope; }
@@ -319,13 +315,9 @@ public:
DEFINE_PAIRED_CATEGORY_METHODS(Transform3D, transform3D)
- DEFINE_PAIRED_CATEGORY_METHODS(Subsequence, subsequence)
- DEFINE_CATEGORY_METHODS(CachedSubsequence)
- DEFINE_CONVERSION_METHODS(Subsequence, subsequence, CachedSubsequence, cachedSubsequence)
-
- static bool isCachedType(Type type) { return isCachedDrawingType(type) || isCachedSubsequenceType(type) || type == CachedDisplayItemList; }
+ static bool isCachedType(Type type) { return isCachedDrawingType(type) || type == CachedSubsequence || type == CachedDisplayItemList; }
bool isCached() const { return isCachedType(m_type); }
- static bool isCacheableType(Type type) { return isDrawingType(type) || isSubsequenceType(type); }
+ static bool isCacheableType(Type type) { return isDrawingType(type) || type == Subsequence; }
bool isCacheable() const { return !skippedCache() && isCacheableType(m_type); }
virtual bool isBegin() const { return false; }
@@ -335,7 +327,7 @@ public:
virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const { return false; }
virtual bool equals(const DisplayItem& other) const
{
- return m_client == other.m_client
+ return client() == other.client()
&& m_scope == other.m_scope
&& m_type == other.m_type
&& m_derivedSize == other.m_derivedSize
@@ -345,7 +337,7 @@ public:
virtual bool drawsContent() const { return false; }
- bool isValid() const { return m_client; }
+ bool isValid() const { return m_clientObject; }
#ifndef NDEBUG
static WTF::String typeAsDebugString(DisplayItem::Type);
@@ -362,17 +354,23 @@ private:
template <typename T, unsigned alignment> friend class ContiguousContainer;
DisplayItem()
- : m_client(nullptr)
+ : m_clientObject(nullptr)
, m_scope(0)
+ , m_subClientId(0)
, m_type(UninitializedType)
, m_derivedSize(sizeof(*this))
, m_skippedCache(false)
{ }
- const DisplayItemClient m_client;
+ const DisplayItemClientObject m_clientObject;
unsigned m_scope;
+
+ static_assert(kMaxSubDisplayItemClientId == (1 << 6) - 1, "subClientId should fit in 6 bits");
+ const unsigned m_subClientId : 6;
+
static_assert(TypeLast < (1 << 16), "DisplayItem::Type should fit in 16 bits");
const Type m_type : 16;
+
const unsigned m_derivedSize : 8; // size of the actual derived class
unsigned m_skippedCache : 1;

Powered by Google App Engine
This is Rietveld 408576698