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

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

Issue 2565073002: Implement the algorithm to test merging and overlap in PaintArtifactCompositor. (Closed)
Patch Set: none Created 4 years 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
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 const ScrollPaintPropertyNode* scroll() const { 62 const ScrollPaintPropertyNode* scroll() const {
63 DCHECK(!m_scroll->hasOneRef()); 63 DCHECK(!m_scroll->hasOneRef());
64 return m_scroll.get(); 64 return m_scroll.get();
65 } 65 }
66 void setScroll(const ScrollPaintPropertyNode* node) { 66 void setScroll(const ScrollPaintPropertyNode* node) {
67 m_scroll = node; 67 m_scroll = node;
68 DCHECK(!node->hasOneRef()); 68 DCHECK(!node->hasOneRef());
69 } 69 }
70 70
71 bool hasDirectCompositingReasons() const {
72 if (!m_transform->isRoot() &&
73 m_clip->localTransformSpace() != m_transform) {
74 return m_transform->hasDirectCompositingReasons();
75 }
76 return false;
77 }
78
71 private: 79 private:
72 RefPtr<const TransformPaintPropertyNode> m_transform; 80 RefPtr<const TransformPaintPropertyNode> m_transform;
73 RefPtr<const ClipPaintPropertyNode> m_clip; 81 RefPtr<const ClipPaintPropertyNode> m_clip;
74 RefPtr<const EffectPaintPropertyNode> m_effect; 82 RefPtr<const EffectPaintPropertyNode> m_effect;
75 RefPtr<const ScrollPaintPropertyNode> m_scroll; 83 RefPtr<const ScrollPaintPropertyNode> m_scroll;
76 }; 84 };
85
86 class PropertyTreeStateIterator {
87 public:
88 PropertyTreeStateIterator(const PropertyTreeState& properties)
89 : m_properties(properties) {}
90
91 const PropertyTreeState& current() { return m_properties; }
92 void next() {
93 if (!m_properties.transform()->isRoot() &&
94 m_properties.clip()->localTransformSpace() !=
95 m_properties.transform()) {
96 m_properties.setTransform(m_properties.transform()->parent());
97 }
98 if (!m_properties.effect()->isRoot() &&
99 m_properties.effect()->outputClip() == m_properties.clip()) {
100 m_properties.setEffect(m_properties.effect()->parent());
101 }
102 if (!m_properties.clip()->isRoot()) {
103 m_properties.setClip(m_properties.clip()->parent());
104 }
105 }
106
107 bool hasNext() {
108 if (!m_properties.transform()->isRoot() &&
109 m_properties.clip()->localTransformSpace() !=
110 m_properties.transform()) {
111 return true;
112 }
113 if (!m_properties.effect()->isRoot() &&
114 m_properties.effect()->outputClip() == m_properties.clip()) {
115 return true;
116 }
117 if (!m_properties.clip()->isRoot()) {
118 return true;
119 }
120 return false;
121 }
122
123 private:
124 PropertyTreeState m_properties;
125 };
126
127 inline bool operator==(const PropertyTreeState& a, const PropertyTreeState& b) {
128 return a.transform() == b.transform() && a.clip() == b.clip() &&
129 a.effect() == b.effect() && a.scroll() == b.scroll();
130 }
131
77 } // namespace blink 132 } // namespace blink
78 133
79 #endif // PropertyTreeState_h 134 #endif // PropertyTreeState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698