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

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

Issue 2292273003: Define contentsProperties on ObjectPaintProperties, for use in paint invalidation. (Closed)
Patch Set: none Created 4 years, 3 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // not painting parent, thus can't be derived in O(1) during paint walk. 70 // not painting parent, thus can't be derived in O(1) during paint walk.
71 // Note: If this layout object has transform or stacking-context effects, th ose are already 71 // Note: If this layout object has transform or stacking-context effects, th ose are already
72 // baked into in the context here. However for properties that affects only children, 72 // baked into in the context here. However for properties that affects only children,
73 // for example, perspective and overflow clip, those should be applied by th e painter 73 // for example, perspective and overflow clip, those should be applied by th e painter
74 // at the right painting step. 74 // at the right painting step.
75 struct LocalBorderBoxProperties { 75 struct LocalBorderBoxProperties {
76 LayoutPoint paintOffset; 76 LayoutPoint paintOffset;
77 PropertyTreeState propertyTreeState; 77 PropertyTreeState propertyTreeState;
78 }; 78 };
79 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); } 79 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); }
80 // ContentsProperties is the PropertyTreeState state that is the same as in localBorderBoxProperties, except that it is inside
81 // any clips and scrolls caused by this object. This PropertyTreeState is su itable as the destination for paint invalidation.
82 const PropertyTreeState* contentsProperties() const { return m_contentsPrope rties.get(); }
80 83
81 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } 84 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; }
82 void clearTransform() { m_transform = nullptr; } 85 void clearTransform() { m_transform = nullptr; }
83 void clearEffect() { m_effect = nullptr; } 86 void clearEffect() { m_effect = nullptr; }
84 void clearCssClip() { m_cssClip = nullptr; } 87 void clearCssClip() { m_cssClip = nullptr; }
85 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; } 88 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; }
86 void clearOverflowClip() { m_overflowClip = nullptr; } 89 void clearOverflowClip() { m_overflowClip = nullptr; }
87 void clearPerspective() { m_perspective = nullptr; } 90 void clearPerspective() { m_perspective = nullptr; }
88 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; } 91 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; }
89 void clearScrollTranslation() { m_scrollTranslation = nullptr; } 92 void clearScrollTranslation() { m_scrollTranslation = nullptr; }
(...skipping 12 matching lines...) Expand all
102 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s o there should never be both a scroll translation and an SVG local to border box transform."; 105 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s o there should never be both a scroll translation and an SVG local to border box transform.";
103 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...); 106 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...);
104 } 107 }
105 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); } 108 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); }
106 template <typename... Args> EffectPaintPropertyNode* createOrUpdateEffect(Ar gs&&... args) { return createOrUpdateProperty(m_effect, std::forward<Args>(args) ...); } 109 template <typename... Args> EffectPaintPropertyNode* createOrUpdateEffect(Ar gs&&... args) { return createOrUpdateProperty(m_effect, std::forward<Args>(args) ...); }
107 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClip(Arg s&&... args) { return createOrUpdateProperty(m_cssClip, std::forward<Args>(args) ...); } 110 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClip(Arg s&&... args) { return createOrUpdateProperty(m_cssClip, std::forward<Args>(args) ...); }
108 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClipFixe dPosition(Args&&... args) { return createOrUpdateProperty(m_cssClipFixedPosition , std::forward<Args>(args)...); } 111 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClipFixe dPosition(Args&&... args) { return createOrUpdateProperty(m_cssClipFixedPosition , std::forward<Args>(args)...); }
109 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); } 112 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); }
110 113
111 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); } 114 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); }
115 void setContentsProperties(std::unique_ptr<PropertyTreeState> properties) { m_contentsProperties = std::move(properties); }
112 116
113 private: 117 private:
114 ObjectPaintProperties() { } 118 ObjectPaintProperties() { }
115 119
116 template <typename PaintPropertyNode, typename... Args> 120 template <typename PaintPropertyNode, typename... Args>
117 PaintPropertyNode* createOrUpdateProperty(RefPtr<PaintPropertyNode>& field, Args&&... args) 121 PaintPropertyNode* createOrUpdateProperty(RefPtr<PaintPropertyNode>& field, Args&&... args)
118 { 122 {
119 if (field) 123 if (field)
120 field->update(std::forward<Args>(args)...); 124 field->update(std::forward<Args>(args)...);
121 else 125 else
122 field = PaintPropertyNode::create(std::forward<Args>(args)...); 126 field = PaintPropertyNode::create(std::forward<Args>(args)...);
123 return field.get(); 127 return field.get();
124 } 128 }
125 129
126 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; 130 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
127 RefPtr<TransformPaintPropertyNode> m_transform; 131 RefPtr<TransformPaintPropertyNode> m_transform;
128 RefPtr<EffectPaintPropertyNode> m_effect; 132 RefPtr<EffectPaintPropertyNode> m_effect;
129 RefPtr<ClipPaintPropertyNode> m_cssClip; 133 RefPtr<ClipPaintPropertyNode> m_cssClip;
130 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; 134 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition;
131 RefPtr<ClipPaintPropertyNode> m_overflowClip; 135 RefPtr<ClipPaintPropertyNode> m_overflowClip;
132 RefPtr<TransformPaintPropertyNode> m_perspective; 136 RefPtr<TransformPaintPropertyNode> m_perspective;
133 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. 137 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there.
134 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; 138 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform;
135 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 139 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
136 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 140 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
137 141
138 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; 142 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties;
143 std::unique_ptr<PropertyTreeState> m_contentsProperties;
pdr. 2016/08/31 04:48:52 Instead of caching such a large object, could we c
szager1 2016/08/31 16:31:22 +1, I don't think it should be stored; it should b
chrishtr 2016/08/31 17:43:30 Yes. I think you could say the same for localBorde
139 }; 144 };
140 145
141 } // namespace blink 146 } // namespace blink
142 147
143 #endif // ObjectPaintProperties_h 148 #endif // ObjectPaintProperties_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698