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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp

Issue 2808463003: SPv2: Limit compositor element id application to a single layer. (Closed)
Patch Set: Revise expectations slightly. Created 3 years, 8 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: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp
index 548f5810fa6111f0cee1cf398110bcfe9c9fa978..1b07e9698f63c204499401e4307b032767eb1e7f 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp
@@ -38,25 +38,37 @@ bool IsAncestorOf(const PropertyNode* ancestor, const PropertyNode* child) {
return child == ancestor;
}
-const CompositorElementId PropertyTreeState::GetCompositorElementId() const {
+const CompositorElementId PropertyTreeState::GetCompositorElementId(
+ const CompositorElementIdSet& element_ids) const {
// The effect or transform nodes could have a compositor element id. The order
// doesn't matter as the element id should be the same on all that have a
// non-default CompositorElementId.
+//
+// Note that PropertyTreeState acts as a context that accumulates state as we
+// traverse the tree building layers. This means that we could see a compositor
+// element id 'A' for a parent layer in conjunction with a compositor element id
+// 'B' for a child layer. To preserve uniqueness of element ids, then, we check
+// for presence in the |element_ids| set (which represents element ids already
+// previously attached to a layer). This is an interim step while we pursue
+// broader rework of animation subsystem noted in http://crbug.com/709137.
#if DCHECK_IS_ON()
CompositorElementId expected_element_id;
- if (CompositorElementId actual_element_id =
- Effect()->GetCompositorElementId()) {
- expected_element_id = actual_element_id;
+ CompositorElementId effect_element_id = Effect()->GetCompositorElementId();
+ if (effect_element_id && !element_ids.Contains(effect_element_id)) {
+ expected_element_id = effect_element_id;
}
- if (CompositorElementId actual_element_id =
- Transform()->GetCompositorElementId()) {
- if (expected_element_id)
- DCHECK_EQ(expected_element_id, actual_element_id);
+ CompositorElementId transform_element_id =
+ Transform()->GetCompositorElementId();
+ if (expected_element_id && transform_element_id &&
+ !element_ids.Contains(transform_element_id)) {
+ DCHECK_EQ(expected_element_id, transform_element_id);
}
#endif
- if (Effect()->GetCompositorElementId())
+ if (Effect()->GetCompositorElementId() &&
+ !element_ids.Contains(Effect()->GetCompositorElementId()))
return Effect()->GetCompositorElementId();
- if (Transform()->GetCompositorElementId())
+ if (Transform()->GetCompositorElementId() &&
+ !element_ids.Contains(Transform()->GetCompositorElementId()))
return Transform()->GetCompositorElementId();
return CompositorElementId();
}

Powered by Google App Engine
This is Rietveld 408576698