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

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

Issue 2637383006: Set layer element id when building layers in PaintArtifactCompositor. (Closed)
Patch Set: Sync to head. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/paint/PropertyTreeState.h" 5 #include "platform/graphics/paint/PropertyTreeState.h"
6 6
7 #include "platform/graphics/paint/GeometryMapper.h" 7 #include "platform/graphics/paint/GeometryMapper.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 template <typename PropertyNode> 24 template <typename PropertyNode>
25 bool isAncestorOf(const PropertyNode* ancestor, const PropertyNode* child) { 25 bool isAncestorOf(const PropertyNode* ancestor, const PropertyNode* child) {
26 while (child && child != ancestor) { 26 while (child && child != ancestor) {
27 child = child->parent(); 27 child = child->parent();
28 } 28 }
29 return child == ancestor; 29 return child == ancestor;
30 } 30 }
31 31
32 const CompositorElementId PropertyTreeState::compositorElementId() const {
33 // Zero or more of the scroll, effect or transform nodes could have a
34 // compositor element id. The order doesn't matter as the element id should be
35 // the same on all that have a non-default CompositorElementId.
36 #if DCHECK_IS_ON()
37 CompositorElementId expectedElementId;
38 if (CompositorElementId actualElementId = effect()->compositorElementId()) {
39 expectedElementId = actualElementId;
40 }
41 if (CompositorElementId actualElementId = scroll()->compositorElementId()) {
42 if (!expectedElementId)
43 expectedElementId = actualElementId;
44 else
45 DCHECK_EQ(expectedElementId, actualElementId);
46 }
47 if (CompositorElementId actualElementId =
48 transform()->compositorElementId()) {
49 if (expectedElementId)
50 DCHECK_EQ(expectedElementId, actualElementId);
51 }
52 #endif
53 if (effect()->compositorElementId())
54 return effect()->compositorElementId();
55 if (scroll()->compositorElementId())
56 return scroll()->compositorElementId();
57 if (transform()->compositorElementId())
58 return transform()->compositorElementId();
59 return CompositorElementId();
60 }
61
32 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const { 62 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const {
33 // TODO(chrishtr): this is very inefficient when innermostNode() is called 63 // TODO(chrishtr): this is very inefficient when innermostNode() is called
34 // repeatedly. 64 // repeatedly.
35 bool clipTransformStrictAncestorOfTransform = 65 bool clipTransformStrictAncestorOfTransform =
36 m_clip->localTransformSpace() != m_transform.get() && 66 m_clip->localTransformSpace() != m_transform.get() &&
37 isAncestorOf<TransformPaintPropertyNode>(m_clip->localTransformSpace(), 67 isAncestorOf<TransformPaintPropertyNode>(m_clip->localTransformSpace(),
38 m_transform.get()); 68 m_transform.get());
39 bool effectTransformStrictAncestorOfTransform = 69 bool effectTransformStrictAncestorOfTransform =
40 m_effect->localTransformSpace() != m_transform.get() && 70 m_effect->localTransformSpace() != m_transform.get() &&
41 isAncestorOf<TransformPaintPropertyNode>(m_effect->localTransformSpace(), 71 isAncestorOf<TransformPaintPropertyNode>(m_effect->localTransformSpace(),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #if DCHECK_IS_ON() 106 #if DCHECK_IS_ON()
77 107
78 String PropertyTreeState::toTreeString() const { 108 String PropertyTreeState::toTreeString() const {
79 return transform()->toTreeString() + "\n" + clip()->toTreeString() + "\n" + 109 return transform()->toTreeString() + "\n" + clip()->toTreeString() + "\n" +
80 effect()->toTreeString() + "\n" + scroll()->toTreeString(); 110 effect()->toTreeString() + "\n" + scroll()->toTreeString();
81 } 111 }
82 112
83 #endif 113 #endif
84 114
85 } // namespace blink 115 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698