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

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

Issue 2430813002: Switch to shorter names for property tree storage and updates (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
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void clearOverflowClip() { m_overflowClip = nullptr; } 145 void clearOverflowClip() { m_overflowClip = nullptr; }
146 void clearPerspective() { m_perspective = nullptr; } 146 void clearPerspective() { m_perspective = nullptr; }
147 void clearSvgLocalToBorderBoxTransform() { 147 void clearSvgLocalToBorderBoxTransform() {
148 m_svgLocalToBorderBoxTransform = nullptr; 148 m_svgLocalToBorderBoxTransform = nullptr;
149 } 149 }
150 void clearScrollTranslation() { m_scrollTranslation = nullptr; } 150 void clearScrollTranslation() { m_scrollTranslation = nullptr; }
151 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; } 151 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; }
152 void clearScroll() { m_scroll = nullptr; } 152 void clearScroll() { m_scroll = nullptr; }
153 153
154 template <typename... Args> 154 template <typename... Args>
155 TransformPaintPropertyNode* createOrUpdatePaintOffsetTranslation( 155 TransformPaintPropertyNode* updatePaintOffsetTranslation(Args&&... args) {
156 Args&&... args) { 156 return updateProperty(m_paintOffsetTranslation,
157 return createOrUpdateProperty(m_paintOffsetTranslation, 157 std::forward<Args>(args)...);
158 std::forward<Args>(args)...);
159 } 158 }
160 template <typename... Args> 159 template <typename... Args>
161 TransformPaintPropertyNode* createOrUpdateTransform(Args&&... args) { 160 TransformPaintPropertyNode* updateTransform(Args&&... args) {
162 return createOrUpdateProperty(m_transform, std::forward<Args>(args)...); 161 return updateProperty(m_transform, std::forward<Args>(args)...);
163 } 162 }
164 template <typename... Args> 163 template <typename... Args>
165 TransformPaintPropertyNode* createOrUpdatePerspective(Args&&... args) { 164 TransformPaintPropertyNode* updatePerspective(Args&&... args) {
166 return createOrUpdateProperty(m_perspective, std::forward<Args>(args)...); 165 return updateProperty(m_perspective, std::forward<Args>(args)...);
167 } 166 }
168 template <typename... Args> 167 template <typename... Args>
169 TransformPaintPropertyNode* createOrUpdateSvgLocalToBorderBoxTransform( 168 TransformPaintPropertyNode* updateSvgLocalToBorderBoxTransform(
170 Args&&... args) { 169 Args&&... args) {
171 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there " 170 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there "
172 "should never be both a scroll translation " 171 "should never be both a scroll translation "
173 "and an SVG local to border box transform."; 172 "and an SVG local to border box transform.";
174 return createOrUpdateProperty(m_svgLocalToBorderBoxTransform, 173 return updateProperty(m_svgLocalToBorderBoxTransform,
175 std::forward<Args>(args)...); 174 std::forward<Args>(args)...);
176 } 175 }
177 template <typename... Args> 176 template <typename... Args>
178 TransformPaintPropertyNode* createOrUpdateScrollTranslation(Args&&... args) { 177 TransformPaintPropertyNode* updateScrollTranslation(Args&&... args) {
179 DCHECK(!svgLocalToBorderBoxTransform()) 178 DCHECK(!svgLocalToBorderBoxTransform())
180 << "SVG elements cannot scroll so there should never be both a scroll " 179 << "SVG elements cannot scroll so there should never be both a scroll "
181 "translation and an SVG local to border box transform."; 180 "translation and an SVG local to border box transform.";
182 return createOrUpdateProperty(m_scrollTranslation, 181 return updateProperty(m_scrollTranslation, std::forward<Args>(args)...);
183 std::forward<Args>(args)...);
184 } 182 }
185 template <typename... Args> 183 template <typename... Args>
186 TransformPaintPropertyNode* createOrUpdateScrollbarPaintOffset( 184 TransformPaintPropertyNode* updateScrollbarPaintOffset(Args&&... args) {
187 Args&&... args) { 185 return updateProperty(m_scrollbarPaintOffset, std::forward<Args>(args)...);
188 return createOrUpdateProperty(m_scrollbarPaintOffset,
189 std::forward<Args>(args)...);
190 } 186 }
191 template <typename... Args> 187 template <typename... Args>
192 ScrollPaintPropertyNode* createOrUpdateScroll(Args&&... args) { 188 ScrollPaintPropertyNode* updateScroll(Args&&... args) {
193 return createOrUpdateProperty(m_scroll, std::forward<Args>(args)...); 189 return updateProperty(m_scroll, std::forward<Args>(args)...);
194 } 190 }
195 template <typename... Args> 191 template <typename... Args>
196 EffectPaintPropertyNode* createOrUpdateEffect(Args&&... args) { 192 EffectPaintPropertyNode* updateEffect(Args&&... args) {
197 return createOrUpdateProperty(m_effect, std::forward<Args>(args)...); 193 return updateProperty(m_effect, std::forward<Args>(args)...);
198 } 194 }
199 template <typename... Args> 195 template <typename... Args>
200 ClipPaintPropertyNode* createOrUpdateCssClip(Args&&... args) { 196 ClipPaintPropertyNode* updateCssClip(Args&&... args) {
201 return createOrUpdateProperty(m_cssClip, std::forward<Args>(args)...); 197 return updateProperty(m_cssClip, std::forward<Args>(args)...);
202 } 198 }
203 template <typename... Args> 199 template <typename... Args>
204 ClipPaintPropertyNode* createOrUpdateCssClipFixedPosition(Args&&... args) { 200 ClipPaintPropertyNode* updateCssClipFixedPosition(Args&&... args) {
205 return createOrUpdateProperty(m_cssClipFixedPosition, 201 return updateProperty(m_cssClipFixedPosition, std::forward<Args>(args)...);
206 std::forward<Args>(args)...);
207 } 202 }
208 template <typename... Args> 203 template <typename... Args>
209 ClipPaintPropertyNode* createOrUpdateInnerBorderRadiusClip(Args&&... args) { 204 ClipPaintPropertyNode* updateInnerBorderRadiusClip(Args&&... args) {
210 return createOrUpdateProperty(m_innerBorderRadiusClip, 205 return updateProperty(m_innerBorderRadiusClip, std::forward<Args>(args)...);
211 std::forward<Args>(args)...);
212 } 206 }
213 template <typename... Args> 207 template <typename... Args>
214 ClipPaintPropertyNode* createOrUpdateOverflowClip(Args&&... args) { 208 ClipPaintPropertyNode* updateOverflowClip(Args&&... args) {
215 return createOrUpdateProperty(m_overflowClip, std::forward<Args>(args)...); 209 return updateProperty(m_overflowClip, std::forward<Args>(args)...);
216 } 210 }
217 211
218 private: 212 private:
219 ObjectPaintProperties() {} 213 ObjectPaintProperties() {}
220 214
221 template <typename PaintPropertyNode, typename... Args> 215 template <typename PaintPropertyNode, typename... Args>
222 PaintPropertyNode* createOrUpdateProperty(RefPtr<PaintPropertyNode>& field, 216 PaintPropertyNode* updateProperty(RefPtr<PaintPropertyNode>& field,
223 Args&&... args) { 217 Args&&... args) {
224 if (field) 218 if (field)
225 field->update(std::forward<Args>(args)...); 219 field->update(std::forward<Args>(args)...);
226 else 220 else
227 field = PaintPropertyNode::create(std::forward<Args>(args)...); 221 field = PaintPropertyNode::create(std::forward<Args>(args)...);
228 return field.get(); 222 return field.get();
229 } 223 }
230 224
231 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; 225 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
232 RefPtr<TransformPaintPropertyNode> m_transform; 226 RefPtr<TransformPaintPropertyNode> m_transform;
233 RefPtr<EffectPaintPropertyNode> m_effect; 227 RefPtr<EffectPaintPropertyNode> m_effect;
234 RefPtr<ClipPaintPropertyNode> m_cssClip; 228 RefPtr<ClipPaintPropertyNode> m_cssClip;
235 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; 229 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition;
236 RefPtr<ClipPaintPropertyNode> m_innerBorderRadiusClip; 230 RefPtr<ClipPaintPropertyNode> m_innerBorderRadiusClip;
237 RefPtr<ClipPaintPropertyNode> m_overflowClip; 231 RefPtr<ClipPaintPropertyNode> m_overflowClip;
238 RefPtr<TransformPaintPropertyNode> m_perspective; 232 RefPtr<TransformPaintPropertyNode> m_perspective;
239 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. 233 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there.
240 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; 234 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform;
241 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 235 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
242 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 236 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
243 RefPtr<ScrollPaintPropertyNode> m_scroll; 237 RefPtr<ScrollPaintPropertyNode> m_scroll;
244 238
245 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties; 239 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties;
246 }; 240 };
247 241
248 } // namespace blink 242 } // namespace blink
249 243
250 #endif // ObjectPaintProperties_h 244 #endif // ObjectPaintProperties_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BoxClipper.cpp ('k') | third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698