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

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

Issue 2651093003: Make scroll translation transform nodes reference scroll nodes (Closed)
Patch Set: Add note about scroll tree differences Created 3 years, 10 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 12 matching lines...) Expand all
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 { 32 const CompositorElementId PropertyTreeState::compositorElementId() const {
33 // Zero or more of the scroll, effect or transform nodes could have a 33 // The effect or transform nodes could have a compositor element id. The order
34 // compositor element id. The order doesn't matter as the element id should be 34 // doesn't matter as the element id should be the same on all that have a
35 // the same on all that have a non-default CompositorElementId. 35 // non-default CompositorElementId.
36 #if DCHECK_IS_ON() 36 #if DCHECK_IS_ON()
37 CompositorElementId expectedElementId; 37 CompositorElementId expectedElementId;
38 if (CompositorElementId actualElementId = effect()->compositorElementId()) { 38 if (CompositorElementId actualElementId = effect()->compositorElementId()) {
39 expectedElementId = actualElementId; 39 expectedElementId = actualElementId;
40 } 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 = 41 if (CompositorElementId actualElementId =
48 transform()->compositorElementId()) { 42 transform()->compositorElementId()) {
49 if (expectedElementId) 43 if (expectedElementId)
50 DCHECK_EQ(expectedElementId, actualElementId); 44 DCHECK_EQ(expectedElementId, actualElementId);
51 } 45 }
52 #endif 46 #endif
53 if (effect()->compositorElementId()) 47 if (effect()->compositorElementId())
54 return effect()->compositorElementId(); 48 return effect()->compositorElementId();
55 if (scroll()->compositorElementId())
56 return scroll()->compositorElementId();
57 if (transform()->compositorElementId()) 49 if (transform()->compositorElementId())
58 return transform()->compositorElementId(); 50 return transform()->compositorElementId();
59 return CompositorElementId(); 51 return CompositorElementId();
60 } 52 }
61 53
62 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const { 54 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const {
63 // TODO(chrishtr): this is very inefficient when innermostNode() is called 55 // TODO(chrishtr): this is very inefficient when innermostNode() is called
64 // repeatedly. 56 // repeatedly.
65 bool clipTransformStrictAncestorOfTransform = 57 bool clipTransformStrictAncestorOfTransform =
66 m_clip->localTransformSpace() != m_transform.get() && 58 m_clip->localTransformSpace() != m_transform.get() &&
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #if DCHECK_IS_ON() 98 #if DCHECK_IS_ON()
107 99
108 String PropertyTreeState::toTreeString() const { 100 String PropertyTreeState::toTreeString() const {
109 return transform()->toTreeString() + "\n" + clip()->toTreeString() + "\n" + 101 return transform()->toTreeString() + "\n" + clip()->toTreeString() + "\n" +
110 effect()->toTreeString() + "\n" + scroll()->toTreeString(); 102 effect()->toTreeString() + "\n" + scroll()->toTreeString();
111 } 103 }
112 104
113 #endif 105 #endif
114 106
115 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698