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

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

Issue 2538273002: Use a create-or-update pattern for faster local border box property updates (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // because some properties inherit from the containing block chain instead of 117 // because some properties inherit from the containing block chain instead of
118 // the painting parent and cannot be derived in O(1) during the paint walk. 118 // the painting parent and cannot be derived in O(1) during the paint walk.
119 // For example, <div style='opacity: 0.3; position: relative; margin: 11px;'/> 119 // For example, <div style='opacity: 0.3; position: relative; margin: 11px;'/>
120 // would have a paint offset of (11px, 11px) and propertyTreeState.effect() 120 // would have a paint offset of (11px, 11px) and propertyTreeState.effect()
121 // would be an effect node with opacity of 0.3 which was created by the div 121 // would be an effect node with opacity of 0.3 which was created by the div
122 // itself. Note that propertyTreeState.transform() would not be null but would 122 // itself. Note that propertyTreeState.transform() would not be null but would
123 // instead point to the transform space setup by div's ancestors. 123 // instead point to the transform space setup by div's ancestors.
124 const PropertyTreeStateWithOffset* localBorderBoxProperties() const { 124 const PropertyTreeStateWithOffset* localBorderBoxProperties() const {
125 return m_localBorderBoxProperties.get(); 125 return m_localBorderBoxProperties.get();
126 } 126 }
127 void setLocalBorderBoxProperties( 127 void updateLocalBorderBoxProperties(
128 std::unique_ptr<PropertyTreeStateWithOffset> properties) { 128 LayoutPoint& paintOffset,
129 m_localBorderBoxProperties = std::move(properties); 129 const TransformPaintPropertyNode* transform,
130 const ClipPaintPropertyNode* clip,
131 const EffectPaintPropertyNode* effect,
132 const ScrollPaintPropertyNode* scroll) {
133 if (m_localBorderBoxProperties) {
134 m_localBorderBoxProperties->paintOffset = paintOffset;
135 m_localBorderBoxProperties->propertyTreeState.setTransform(transform);
136 m_localBorderBoxProperties->propertyTreeState.setClip(clip);
137 m_localBorderBoxProperties->propertyTreeState.setEffect(effect);
138 m_localBorderBoxProperties->propertyTreeState.setScroll(scroll);
139 } else {
140 m_localBorderBoxProperties =
141 wrapUnique(new ObjectPaintProperties::PropertyTreeStateWithOffset(
142 paintOffset, PropertyTreeState(transform, clip, effect, scroll)));
143 }
130 } 144 }
131 145
132 // This is the complete set of property nodes and paint offset that can be 146 // This is the complete set of property nodes and paint offset that can be
133 // used to paint the contents of this object. It is similar to 147 // used to paint the contents of this object. It is similar to
134 // localBorderBoxProperties but includes properties (e.g., overflow clip, 148 // localBorderBoxProperties but includes properties (e.g., overflow clip,
135 // scroll translation) that apply to contents. This is suitable for paint 149 // scroll translation) that apply to contents. This is suitable for paint
136 // invalidation. 150 // invalidation.
137 ObjectPaintProperties::PropertyTreeStateWithOffset contentsProperties() const; 151 ObjectPaintProperties::PropertyTreeStateWithOffset contentsProperties() const;
138 152
139 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } 153 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 287 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
274 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 288 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
275 RefPtr<ScrollPaintPropertyNode> m_scroll; 289 RefPtr<ScrollPaintPropertyNode> m_scroll;
276 290
277 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties; 291 std::unique_ptr<PropertyTreeStateWithOffset> m_localBorderBoxProperties;
278 }; 292 };
279 293
280 } // namespace blink 294 } // namespace blink
281 295
282 #endif // ObjectPaintProperties_h 296 #endif // ObjectPaintProperties_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698