Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 } | 31 } |
| 32 | 32 |
| 33 template <typename PropertyNode> | 33 template <typename PropertyNode> |
| 34 bool IsAncestorOf(const PropertyNode* ancestor, const PropertyNode* child) { | 34 bool IsAncestorOf(const PropertyNode* ancestor, const PropertyNode* child) { |
| 35 while (child && child != ancestor) { | 35 while (child && child != ancestor) { |
| 36 child = child->Parent(); | 36 child = child->Parent(); |
| 37 } | 37 } |
| 38 return child == ancestor; | 38 return child == ancestor; |
| 39 } | 39 } |
| 40 | 40 |
| 41 const CompositorElementId PropertyTreeState::GetCompositorElementId( | 41 CompositorElementId PropertyTreeState::GetCompositorElementId( |
| 42 const CompositorElementIdSet& element_ids) const { | 42 const CompositorElementIdSet& element_ids) const { |
| 43 // The effect or transform nodes could have a compositor element id. The order | 43 // The effect or transform nodes could have a compositor element id. The order |
| 44 // doesn't matter as the element id should be the same on all that have a | 44 // doesn't matter as the element id should be the same on all that have a |
| 45 // non-default CompositorElementId. | 45 // non-default CompositorElementId. |
| 46 // | 46 // |
| 47 // Note that PropertyTreeState acts as a context that accumulates state as we | 47 // Note that PropertyTreeState acts as a context that accumulates state as we |
| 48 // traverse the tree building layers. This means that we could see a | 48 // traverse the tree building layers. This means that we could see a |
| 49 // compositor element id 'A' for a parent layer in conjunction with a | 49 // compositor element id 'A' for a parent layer in conjunction with a |
| 50 // compositor element id 'B' for a child layer. To preserve uniqueness of | 50 // compositor element id 'B' for a child layer. To preserve uniqueness of |
| 51 // element ids, then, we check for presence in the |element_ids| set (which | 51 // element ids, then, we check for presence in the |element_ids| set (which |
| 52 // represents element ids already previously attached to a layer). This is an | 52 // represents element ids already previously attached to a layer). This is an |
| 53 // interim step while we pursue broader rework of animation subsystem noted in | 53 // interim step while we pursue broader rework of animation subsystem noted in |
| 54 // http://crbug.com/709137. | 54 // http://crbug.com/709137. |
| 55 if (Effect()->GetCompositorElementId() && | 55 if (Effect()->GetCompositorElementId() && |
| 56 !element_ids.Contains(Effect()->GetCompositorElementId())) | 56 !element_ids.Contains(Effect()->GetCompositorElementId().id)) |
|
wkorman
2017/05/08 18:23:25
These bum me out and there's no STL help here due
| |
| 57 return Effect()->GetCompositorElementId(); | 57 return Effect()->GetCompositorElementId(); |
| 58 if (Transform()->GetCompositorElementId() && | 58 if (Transform()->GetCompositorElementId() && |
| 59 !element_ids.Contains(Transform()->GetCompositorElementId())) | 59 !element_ids.Contains(Transform()->GetCompositorElementId().id)) |
| 60 return Transform()->GetCompositorElementId(); | 60 return Transform()->GetCompositorElementId(); |
| 61 return CompositorElementId(); | 61 return CompositorElementId(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 PropertyTreeState::InnermostNode PropertyTreeState::GetInnermostNode() const { | 64 PropertyTreeState::InnermostNode PropertyTreeState::GetInnermostNode() const { |
| 65 // TODO(chrishtr): this is very inefficient when innermostNode() is called | 65 // TODO(chrishtr): this is very inefficient when innermostNode() is called |
| 66 // repeatedly. | 66 // repeatedly. |
| 67 bool clip_transform_strict_ancestor_of_transform = | 67 bool clip_transform_strict_ancestor_of_transform = |
| 68 clip_->LocalTransformSpace() != transform_.Get() && | 68 clip_->LocalTransformSpace() != transform_.Get() && |
| 69 IsAncestorOf<TransformPaintPropertyNode>(clip_->LocalTransformSpace(), | 69 IsAncestorOf<TransformPaintPropertyNode>(clip_->LocalTransformSpace(), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 #if DCHECK_IS_ON() | 113 #if DCHECK_IS_ON() |
| 114 | 114 |
| 115 String PropertyTreeState::ToTreeString() const { | 115 String PropertyTreeState::ToTreeString() const { |
| 116 return Transform()->ToTreeString() + "\n" + Clip()->ToTreeString() + "\n" + | 116 return Transform()->ToTreeString() + "\n" + Clip()->ToTreeString() + "\n" + |
| 117 Effect()->ToTreeString(); | 117 Effect()->ToTreeString(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |