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

Side by Side Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h

Issue 2368043002: [SPv2] Separate SVG root viewport clip from overflow clip. (Closed)
Patch Set: none 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 | « no previous file | third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp » ('j') | 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 ObjectPaintProperties_h 5 #ifndef ObjectPaintProperties_h
6 #define ObjectPaintProperties_h 6 #define ObjectPaintProperties_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/geometry/LayoutPoint.h" 9 #include "platform/geometry/LayoutPoint.h"
10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // transform tree (m_scrollTranslation). 76 // transform tree (m_scrollTranslation).
77 const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); } 77 const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); }
78 78
79 const EffectPaintPropertyNode* effect() const { return m_effect.get(); } 79 const EffectPaintPropertyNode* effect() const { return m_effect.get(); }
80 80
81 // The hierarchy of the clip subtree created by a LayoutObject is as follows : 81 // The hierarchy of the clip subtree created by a LayoutObject is as follows :
82 // [ css clip ] 82 // [ css clip ]
83 // [ css clip fixed position] 83 // [ css clip fixed position]
84 // | 84 // |
85 // +--- [ overflow clip ] 85 // +--- [ overflow clip ]
86 // |
87 // +--- [ SVG root viewport clip ]
86 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } 88 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); }
87 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip FixedPosition.get(); } 89 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip FixedPosition.get(); }
88 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge t(); } 90 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge t(); }
91 const ClipPaintPropertyNode* svgRootViewportClip() const { return m_svgRootV iewportClip.get(); }
89 92
90 // This is a complete set of property nodes that should be used as a startin g point to paint 93 // This is a complete set of property nodes that should be used as a startin g point to paint
91 // this layout object. It is needed becauase some property inherits from the containing block, 94 // this layout object. It is needed becauase some property inherits from the containing block,
92 // not painting parent, thus can't be derived in O(1) during paint walk. 95 // not painting parent, thus can't be derived in O(1) during paint walk.
93 // Note: If this layout object has transform or stacking-context effects, th ose are already 96 // Note: If this layout object has transform or stacking-context effects, th ose are already
94 // baked into in the context here. However for properties that affects only children, 97 // baked into in the context here. However for properties that affects only children,
95 // for example, perspective and overflow clip, those should be applied by th e painter 98 // for example, perspective and overflow clip, those should be applied by th e painter
96 // at the right painting step. 99 // at the right painting step.
97 // TODO(pdr): Refactor this to use PropertyTreeState. 100 // TODO(pdr): Refactor this to use PropertyTreeState.
98 struct LocalBorderBoxProperties { 101 struct LocalBorderBoxProperties {
99 LayoutPoint paintOffset; 102 LayoutPoint paintOffset;
100 GeometryPropertyTreeState geometryPropertyTreeState; 103 GeometryPropertyTreeState geometryPropertyTreeState;
101 const ScrollPaintPropertyNode* scroll; 104 const ScrollPaintPropertyNode* scroll;
102 }; 105 };
103 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); } 106 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); }
104 // ContentsProperties is the GeometryPropertyTreeState that is the same as i n 107 // ContentsProperties is the GeometryPropertyTreeState that is the same as i n
105 // localBorderBoxProperties, except that it is inside any clips and scrolls caused by this 108 // localBorderBoxProperties, except that it is inside any clips and scrolls caused by this
106 // object. This GeometryPropertyTreeState is suitable as the destination for paint invalidation. 109 // object. This GeometryPropertyTreeState is suitable as the destination for paint invalidation.
107 void getContentsProperties(GeometryPropertyTreeState&) const; 110 void getContentsProperties(GeometryPropertyTreeState&) const;
108 111
109 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } 112 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; }
110 void clearTransform() { m_transform = nullptr; } 113 void clearTransform() { m_transform = nullptr; }
111 void clearEffect() { m_effect = nullptr; } 114 void clearEffect() { m_effect = nullptr; }
112 void clearCssClip() { m_cssClip = nullptr; } 115 void clearCssClip() { m_cssClip = nullptr; }
113 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; } 116 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; }
114 void clearOverflowClip() { m_overflowClip = nullptr; } 117 void clearOverflowClip() { m_overflowClip = nullptr; }
118 void clearSvgRootViewportClip() { m_svgRootViewportClip = nullptr; }
115 void clearPerspective() { m_perspective = nullptr; } 119 void clearPerspective() { m_perspective = nullptr; }
116 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; } 120 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; }
117 void clearScrollTranslation() { m_scrollTranslation = nullptr; } 121 void clearScrollTranslation() { m_scrollTranslation = nullptr; }
118 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; } 122 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; }
119 void clearScroll() { m_scroll = nullptr; } 123 void clearScroll() { m_scroll = nullptr; }
120 124
121 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePaintO ffsetTranslation(Args&&... args) { return createOrUpdateProperty(m_paintOffsetTr anslation, std::forward<Args>(args)...); } 125 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePaintO ffsetTranslation(Args&&... args) { return createOrUpdateProperty(m_paintOffsetTr anslation, std::forward<Args>(args)...); }
122 template <typename... Args> TransformPaintPropertyNode* createOrUpdateTransf orm(Args&&... args) { return createOrUpdateProperty(m_transform, std::forward<Ar gs>(args)...); } 126 template <typename... Args> TransformPaintPropertyNode* createOrUpdateTransf orm(Args&&... args) { return createOrUpdateProperty(m_transform, std::forward<Ar gs>(args)...); }
123 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePerspe ctive(Args&&... args) { return createOrUpdateProperty(m_perspective, std::forwar d<Args>(args)...); } 127 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePerspe ctive(Args&&... args) { return createOrUpdateProperty(m_perspective, std::forwar d<Args>(args)...); }
124 template <typename... Args> TransformPaintPropertyNode* createOrUpdateSvgLoc alToBorderBoxTransform(Args&&... args) 128 template <typename... Args> TransformPaintPropertyNode* createOrUpdateSvgLoc alToBorderBoxTransform(Args&&... args)
125 { 129 {
126 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there sho uld never be both a scroll translation and an SVG local to border box transform. "; 130 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there sho uld never be both a scroll translation and an SVG local to border box transform. ";
127 return createOrUpdateProperty(m_svgLocalToBorderBoxTransform, std::forwa rd<Args>(args)...); 131 return createOrUpdateProperty(m_svgLocalToBorderBoxTransform, std::forwa rd<Args>(args)...);
128 } 132 }
129 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll Translation(Args&&... args) 133 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll Translation(Args&&... args)
130 { 134 {
131 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s o there should never be both a scroll translation and an SVG local to border box transform."; 135 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s o there should never be both a scroll translation and an SVG local to border box transform.";
132 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...); 136 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...);
133 } 137 }
134 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); } 138 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); }
135 template <typename... Args> ScrollPaintPropertyNode* createOrUpdateScroll(Ar gs&&... args) { return createOrUpdateProperty(m_scroll, std::forward<Args>(args) ...); } 139 template <typename... Args> ScrollPaintPropertyNode* createOrUpdateScroll(Ar gs&&... args) { return createOrUpdateProperty(m_scroll, std::forward<Args>(args) ...); }
136 template <typename... Args> EffectPaintPropertyNode* createOrUpdateEffect(Ar gs&&... args) { return createOrUpdateProperty(m_effect, std::forward<Args>(args) ...); } 140 template <typename... Args> EffectPaintPropertyNode* createOrUpdateEffect(Ar gs&&... args) { return createOrUpdateProperty(m_effect, std::forward<Args>(args) ...); }
137 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClip(Arg s&&... args) { return createOrUpdateProperty(m_cssClip, std::forward<Args>(args) ...); } 141 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClip(Arg s&&... args) { return createOrUpdateProperty(m_cssClip, std::forward<Args>(args) ...); }
138 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClipFixe dPosition(Args&&... args) { return createOrUpdateProperty(m_cssClipFixedPosition , std::forward<Args>(args)...); } 142 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClipFixe dPosition(Args&&... args) { return createOrUpdateProperty(m_cssClipFixedPosition , std::forward<Args>(args)...); }
139 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); } 143 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); }
144 template <typename... Args> ClipPaintPropertyNode* createOrUpdateSvgRootView portClip(Args&&... args) { return createOrUpdateProperty(m_svgRootViewportClip, std::forward<Args>(args)...); }
140 145
141 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); } 146 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); }
142 147
143 private: 148 private:
144 ObjectPaintProperties() { } 149 ObjectPaintProperties() { }
145 150
146 template <typename PaintPropertyNode, typename... Args> 151 template <typename PaintPropertyNode, typename... Args>
147 PaintPropertyNode* createOrUpdateProperty(RefPtr<PaintPropertyNode>& field, Args&&... args) 152 PaintPropertyNode* createOrUpdateProperty(RefPtr<PaintPropertyNode>& field, Args&&... args)
148 { 153 {
149 if (field) 154 if (field)
150 field->update(std::forward<Args>(args)...); 155 field->update(std::forward<Args>(args)...);
151 else 156 else
152 field = PaintPropertyNode::create(std::forward<Args>(args)...); 157 field = PaintPropertyNode::create(std::forward<Args>(args)...);
153 return field.get(); 158 return field.get();
154 } 159 }
155 160
156 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; 161 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
157 RefPtr<TransformPaintPropertyNode> m_transform; 162 RefPtr<TransformPaintPropertyNode> m_transform;
158 RefPtr<EffectPaintPropertyNode> m_effect; 163 RefPtr<EffectPaintPropertyNode> m_effect;
159 RefPtr<ClipPaintPropertyNode> m_cssClip; 164 RefPtr<ClipPaintPropertyNode> m_cssClip;
160 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; 165 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition;
161 RefPtr<ClipPaintPropertyNode> m_overflowClip; 166 RefPtr<ClipPaintPropertyNode> m_overflowClip;
167 RefPtr<ClipPaintPropertyNode> m_svgRootViewportClip;
162 RefPtr<TransformPaintPropertyNode> m_perspective; 168 RefPtr<TransformPaintPropertyNode> m_perspective;
163 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. 169 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there.
164 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; 170 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform;
165 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 171 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
166 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 172 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
167 RefPtr<ScrollPaintPropertyNode> m_scroll; 173 RefPtr<ScrollPaintPropertyNode> m_scroll;
168 174
169 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; 175 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties;
170 }; 176 };
171 177
172 } // namespace blink 178 } // namespace blink
173 179
174 #endif // ObjectPaintProperties_h 180 #endif // ObjectPaintProperties_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698