| 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 #ifndef PropertyTreeState_h | 5 #ifndef PropertyTreeState_h |
| 6 #define PropertyTreeState_h | 6 #define PropertyTreeState_h |
| 7 | 7 |
| 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class PropertyTreeState { | 21 class PropertyTreeState { |
| 22 public: | 22 public: |
| 23 PropertyTreeState(const TransformPaintPropertyNode* transform, | 23 PropertyTreeState(const TransformPaintPropertyNode* transform, |
| 24 const ClipPaintPropertyNode* clip, | 24 const ClipPaintPropertyNode* clip, |
| 25 const EffectPaintPropertyNode* effect, | 25 const EffectPaintPropertyNode* effect, |
| 26 const ScrollPaintPropertyNode* scroll) | 26 const ScrollPaintPropertyNode* scroll) |
| 27 : m_transform(transform), | 27 : m_transform(transform), |
| 28 m_clip(clip), | 28 m_clip(clip), |
| 29 m_effect(effect), | 29 m_effect(effect), |
| 30 m_scroll(scroll) { | 30 m_scroll(scroll) { |
| 31 DCHECK(!m_transform->hasOneRef() && !m_clip->hasOneRef() && | 31 DCHECK(!m_transform || !m_transform->hasOneRef()); |
| 32 !m_effect->hasOneRef() && !m_scroll->hasOneRef()); | 32 DCHECK(!m_clip || !m_clip->hasOneRef()); |
| 33 DCHECK(!m_effect || !m_effect->hasOneRef()); |
| 34 DCHECK(!m_scroll || !m_scroll->hasOneRef()); |
| 33 } | 35 } |
| 34 | 36 |
| 35 const TransformPaintPropertyNode* transform() const { | 37 const TransformPaintPropertyNode* transform() const { |
| 36 DCHECK(!m_transform->hasOneRef()); | 38 DCHECK(!m_transform || !m_transform->hasOneRef()); |
| 37 return m_transform.get(); | 39 return m_transform.get(); |
| 38 } | 40 } |
| 39 void setTransform(const TransformPaintPropertyNode* node) { | 41 void setTransform(const TransformPaintPropertyNode* node) { |
| 40 m_transform = node; | 42 m_transform = node; |
| 41 DCHECK(!node->hasOneRef()); | 43 DCHECK(!node->hasOneRef()); |
| 42 } | 44 } |
| 43 | 45 |
| 44 const ClipPaintPropertyNode* clip() const { | 46 const ClipPaintPropertyNode* clip() const { |
| 45 DCHECK(!m_clip->hasOneRef()); | 47 DCHECK(!m_clip || !m_clip->hasOneRef()); |
| 46 return m_clip.get(); | 48 return m_clip.get(); |
| 47 } | 49 } |
| 48 void setClip(const ClipPaintPropertyNode* node) { | 50 void setClip(const ClipPaintPropertyNode* node) { |
| 49 m_clip = node; | 51 m_clip = node; |
| 50 DCHECK(!node->hasOneRef()); | 52 DCHECK(!node->hasOneRef()); |
| 51 } | 53 } |
| 52 | 54 |
| 53 const EffectPaintPropertyNode* effect() const { | 55 const EffectPaintPropertyNode* effect() const { |
| 54 DCHECK(!m_effect->hasOneRef()); | 56 DCHECK(!m_effect || !m_effect->hasOneRef()); |
| 55 return m_effect.get(); | 57 return m_effect.get(); |
| 56 } | 58 } |
| 57 void setEffect(const EffectPaintPropertyNode* node) { | 59 void setEffect(const EffectPaintPropertyNode* node) { |
| 58 m_effect = node; | 60 m_effect = node; |
| 59 DCHECK(!node->hasOneRef()); | 61 DCHECK(!node->hasOneRef()); |
| 60 } | 62 } |
| 61 | 63 |
| 62 const ScrollPaintPropertyNode* scroll() const { | 64 const ScrollPaintPropertyNode* scroll() const { |
| 63 DCHECK(!m_scroll->hasOneRef()); | 65 DCHECK(!m_scroll || !m_scroll->hasOneRef()); |
| 64 return m_scroll.get(); | 66 return m_scroll.get(); |
| 65 } | 67 } |
| 66 void setScroll(const ScrollPaintPropertyNode* node) { | 68 void setScroll(const ScrollPaintPropertyNode* node) { |
| 67 m_scroll = node; | 69 m_scroll = node; |
| 68 DCHECK(!node->hasOneRef()); | 70 DCHECK(!node->hasOneRef()); |
| 69 } | 71 } |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 RefPtr<const TransformPaintPropertyNode> m_transform; | 74 RefPtr<const TransformPaintPropertyNode> m_transform; |
| 73 RefPtr<const ClipPaintPropertyNode> m_clip; | 75 RefPtr<const ClipPaintPropertyNode> m_clip; |
| 74 RefPtr<const EffectPaintPropertyNode> m_effect; | 76 RefPtr<const EffectPaintPropertyNode> m_effect; |
| 75 RefPtr<const ScrollPaintPropertyNode> m_scroll; | 77 RefPtr<const ScrollPaintPropertyNode> m_scroll; |
| 76 }; | 78 }; |
| 79 |
| 80 inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) { |
| 81 return a.transform() == b.transform() && a.clip() == b.clip() && |
| 82 a.effect() == b.effect() && a.scroll() == b.scroll(); |
| 83 } |
| 84 |
| 77 } // namespace blink | 85 } // namespace blink |
| 78 | 86 |
| 79 #endif // PropertyTreeState_h | 87 #endif // PropertyTreeState_h |
| OLD | NEW |