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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h

Issue 2366123002: Switch the RootLayerScrolls codepath to use root effect paint properties (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 for inherited effects.
19 //
20 // The effect tree is rooted at a node with no parent. This root node should
21 // not be modified.
22 //
19 // TODO(pdr): Support more effects than just opacity. 23 // TODO(pdr): Support more effects than just opacity.
20 class PLATFORM_EXPORT EffectPaintPropertyNode : public RefCounted<EffectPaintPro pertyNode> { 24 class PLATFORM_EXPORT EffectPaintPropertyNode : public RefCounted<EffectPaintPro pertyNode> {
21 public: 25 public:
22 static PassRefPtr<EffectPaintPropertyNode> create(PassRefPtr<const EffectPai ntPropertyNode> parent, float opacity) 26 static PassRefPtr<EffectPaintPropertyNode> create(PassRefPtr<const EffectPai ntPropertyNode> parent, float opacity)
23 { 27 {
24 return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity)) ; 28 return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity)) ;
25 } 29 }
26 30
27 void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) 31 void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity)
28 { 32 {
33 DCHECK(!isRoot());
29 DCHECK(parent != this); 34 DCHECK(parent != this);
30 m_parent = parent; 35 m_parent = parent;
31 m_opacity = opacity; 36 m_opacity = opacity;
32 } 37 }
33 38
34 float opacity() const { return m_opacity; } 39 float opacity() const { return m_opacity; }
35 40
36 // Parent effect or nullptr if this is the root effect. 41 // Parent effect or nullptr if this is the root effect.
37 const EffectPaintPropertyNode* parent() const { return m_parent.get(); } 42 const EffectPaintPropertyNode* parent() const { return m_parent.get(); }
38 bool isRoot() const { return !m_parent; } 43 bool isRoot() const { return !m_parent; }
39 44
40 private: 45 private:
41 EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, fl oat opacity) 46 EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, fl oat opacity)
42 : m_parent(parent), m_opacity(opacity) { } 47 : m_parent(parent), m_opacity(opacity) { }
43 48
44 RefPtr<const EffectPaintPropertyNode> m_parent; 49 RefPtr<const EffectPaintPropertyNode> m_parent;
45 float m_opacity; 50 float m_opacity;
46 }; 51 };
47 52
48 // Redeclared here to avoid ODR issues. 53 // Redeclared here to avoid ODR issues.
49 // See platform/testing/PaintPrinters.h. 54 // See platform/testing/PaintPrinters.h.
50 void PrintTo(const EffectPaintPropertyNode&, std::ostream*); 55 void PrintTo(const EffectPaintPropertyNode&, std::ostream*);
51 56
52 } // namespace blink 57 } // namespace blink
53 58
54 #endif // EffectPaintPropertyNode_h 59 #endif // EffectPaintPropertyNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698