| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EffectPaintPropertyNode_h | 5 #ifndef EffectPaintPropertyNode_h |
| 6 #define EffectPaintPropertyNode_h | 6 #define EffectPaintPropertyNode_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/PassRefPtr.h" | 9 #include "wtf/PassRefPtr.h" |
| 10 #include "wtf/RefCounted.h" | 10 #include "wtf/RefCounted.h" |
| 11 #include "wtf/RefPtr.h" | 11 #include "wtf/RefPtr.h" |
| 12 | 12 |
| 13 #include <iosfwd> | 13 #include <iosfwd> |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 // A paint effect created by the opacity css property along with a reference to | 17 // A paint effect created by the opacity css property along with a reference to |
| 18 // the parent effect node, or nullptr for the root. | 18 // the parent effect node, or nullptr for the root. |
| 19 // TODO(pdr): Support more effects than just opacity. | 19 // TODO(pdr): Support more effects than just opacity. |
| 20 class PLATFORM_EXPORT EffectPaintPropertyNode : public RefCounted<EffectPaintPro
pertyNode> { | 20 class PLATFORM_EXPORT EffectPaintPropertyNode : public RefCounted<EffectPaintPro
pertyNode> { |
| 21 public: | 21 public: |
| 22 static PassRefPtr<EffectPaintPropertyNode> create(PassRefPtr<const EffectPai
ntPropertyNode> parent, float opacity) | 22 static PassRefPtr<EffectPaintPropertyNode> create(PassRefPtr<const EffectPai
ntPropertyNode> parent, float opacity) |
| 23 { | 23 { |
| 24 return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity))
; | 24 return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity))
; |
| 25 } | 25 } |
| 26 | 26 |
| 27 void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) | 27 void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) |
| 28 { | 28 { |
| 29 DCHECK(parent != this); |
| 29 m_parent = parent; | 30 m_parent = parent; |
| 30 m_opacity = opacity; | 31 m_opacity = opacity; |
| 31 } | 32 } |
| 32 | 33 |
| 33 float opacity() const { return m_opacity; } | 34 float opacity() const { return m_opacity; } |
| 34 | 35 |
| 35 // Parent effect or nullptr if this is the root effect. | 36 // Parent effect or nullptr if this is the root effect. |
| 36 const EffectPaintPropertyNode* parent() const { return m_parent.get(); } | 37 const EffectPaintPropertyNode* parent() const { return m_parent.get(); } |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, fl
oat opacity) | 40 EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, fl
oat opacity) |
| 40 : m_parent(parent), m_opacity(opacity) { } | 41 : m_parent(parent), m_opacity(opacity) { } |
| 41 | 42 |
| 42 RefPtr<const EffectPaintPropertyNode> m_parent; | 43 RefPtr<const EffectPaintPropertyNode> m_parent; |
| 43 float m_opacity; | 44 float m_opacity; |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 // Redeclared here to avoid ODR issues. | 47 // Redeclared here to avoid ODR issues. |
| 47 // See platform/testing/PaintPrinters.h. | 48 // See platform/testing/PaintPrinters.h. |
| 48 void PrintTo(const EffectPaintPropertyNode&, std::ostream*); | 49 void PrintTo(const EffectPaintPropertyNode&, std::ostream*); |
| 49 | 50 |
| 50 } // namespace blink | 51 } // namespace blink |
| 51 | 52 |
| 52 #endif // EffectPaintPropertyNode_h | 53 #endif // EffectPaintPropertyNode_h |
| OLD | NEW |