OLD | NEW |
---|---|
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 Loading... | |
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. | |
ajuma
2017/01/20 15:07:46
Is it worth DCHECK-ing that this holds?
wkorman
2017/01/20 22:13:56
Done.
| |
36 if (effect()->compositorElementId()) | |
37 return effect()->compositorElementId(); | |
38 if (scroll()->compositorElementId()) | |
39 return scroll()->compositorElementId(); | |
40 if (transform()->compositorElementId()) | |
41 return transform()->compositorElementId(); | |
42 return CompositorElementId(); | |
43 } | |
44 | |
32 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const { | 45 PropertyTreeState::InnermostNode PropertyTreeState::innermostNode() const { |
33 // TODO(chrishtr): this is very inefficient when innermostNode() is called | 46 // TODO(chrishtr): this is very inefficient when innermostNode() is called |
34 // repeatedly. | 47 // repeatedly. |
35 bool clipTransformStrictAncestorOfTransform = | 48 bool clipTransformStrictAncestorOfTransform = |
36 m_clip->localTransformSpace() != m_transform.get() && | 49 m_clip->localTransformSpace() != m_transform.get() && |
37 isAncestorOf<TransformPaintPropertyNode>(m_clip->localTransformSpace(), | 50 isAncestorOf<TransformPaintPropertyNode>(m_clip->localTransformSpace(), |
38 m_transform.get()); | 51 m_transform.get()); |
39 bool effectTransformStrictAncestorOfTransform = | 52 bool effectTransformStrictAncestorOfTransform = |
40 m_effect->localTransformSpace() != m_transform.get() && | 53 m_effect->localTransformSpace() != m_transform.get() && |
41 isAncestorOf<TransformPaintPropertyNode>(m_effect->localTransformSpace(), | 54 isAncestorOf<TransformPaintPropertyNode>(m_effect->localTransformSpace(), |
(...skipping 25 matching lines...) Expand all Loading... | |
67 case PropertyTreeState::Effect: | 80 case PropertyTreeState::Effect: |
68 m_properties.setEffect(m_properties.effect()->parent()); | 81 m_properties.setEffect(m_properties.effect()->parent()); |
69 return &m_properties; | 82 return &m_properties; |
70 case PropertyTreeState::None: | 83 case PropertyTreeState::None: |
71 return nullptr; | 84 return nullptr; |
72 } | 85 } |
73 return nullptr; | 86 return nullptr; |
74 } | 87 } |
75 | 88 |
76 } // namespace blink | 89 } // namespace blink |
OLD | NEW |