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

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

Issue 2299533002: WIP: Construct SPV2's scroll paint property tree (Closed)
Patch Set: Plumb scroll offset to cc 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"
11 #include "platform/graphics/paint/EffectPaintPropertyNode.h" 11 #include "platform/graphics/paint/EffectPaintPropertyNode.h"
12 #include "platform/graphics/paint/PaintChunkProperties.h" 12 #include "platform/graphics/paint/PaintChunkProperties.h"
13 #include "platform/graphics/paint/PropertyTreeState.h" 13 #include "platform/graphics/paint/PropertyTreeState.h"
14 #include "platform/graphics/paint/ScrollPaintPropertyNode.h"
14 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 15 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
15 #include "wtf/PassRefPtr.h" 16 #include "wtf/PassRefPtr.h"
16 #include "wtf/PtrUtil.h" 17 #include "wtf/PtrUtil.h"
17 #include "wtf/RefPtr.h" 18 #include "wtf/RefPtr.h"
18 #include <memory> 19 #include <memory>
19 20
20 namespace blink { 21 namespace blink {
21 22
22 // This class stores property tree related information associated with a LayoutO bject. 23 // This class stores property tree related information associated with a LayoutO bject.
23 // Currently there are two groups of information: 24 // Currently there are two groups of information:
(...skipping 24 matching lines...) Expand all
48 // This is equivalent to the local bord er box space above, 49 // This is equivalent to the local bord er box space above,
49 // with pixel snapped paint offset bake d in. It is really redundant, 50 // with pixel snapped paint offset bake d in. It is really redundant,
50 // but it is a pain to teach scrollbars to paint with an offset. 51 // but it is a pain to teach scrollbars to paint with an offset.
51 const TransformPaintPropertyNode* paintOffsetTranslation() const { return m_ paintOffsetTranslation.get(); } 52 const TransformPaintPropertyNode* paintOffsetTranslation() const { return m_ paintOffsetTranslation.get(); }
52 const TransformPaintPropertyNode* transform() const { return m_transform.get (); } 53 const TransformPaintPropertyNode* transform() const { return m_transform.get (); }
53 const TransformPaintPropertyNode* perspective() const { return m_perspective .get(); } 54 const TransformPaintPropertyNode* perspective() const { return m_perspective .get(); }
54 const TransformPaintPropertyNode* svgLocalToBorderBoxTransform() const { ret urn m_svgLocalToBorderBoxTransform.get(); } 55 const TransformPaintPropertyNode* svgLocalToBorderBoxTransform() const { ret urn m_svgLocalToBorderBoxTransform.get(); }
55 const TransformPaintPropertyNode* scrollTranslation() const { return m_scrol lTranslation.get(); } 56 const TransformPaintPropertyNode* scrollTranslation() const { return m_scrol lTranslation.get(); }
56 const TransformPaintPropertyNode* scrollbarPaintOffset() const { return m_sc rollbarPaintOffset.get(); } 57 const TransformPaintPropertyNode* scrollbarPaintOffset() const { return m_sc rollbarPaintOffset.get(); }
57 58
59 // Scrolling data for if this object is scrollable.
60 const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); }
61
58 const EffectPaintPropertyNode* effect() const { return m_effect.get(); } 62 const EffectPaintPropertyNode* effect() const { return m_effect.get(); }
59 63
60 // The hierarchy of the clip subtree created by a LayoutObject is as follows : 64 // The hierarchy of the clip subtree created by a LayoutObject is as follows :
61 // [ css clip ] 65 // [ css clip ]
62 // [ css clip fixed position] 66 // [ css clip fixed position]
63 // | 67 // |
64 // +--- [ overflow clip ] 68 // +--- [ overflow clip ]
65 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } 69 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); }
66 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip FixedPosition.get(); } 70 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip FixedPosition.get(); }
67 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge t(); } 71 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge t(); }
68 72
69 // This is a complete set of property nodes that should be used as a startin g point to paint 73 // This is a complete set of property nodes that should be used as a startin g point to paint
70 // this layout object. It is needed becauase some property inherits from the containing block, 74 // this layout object. It is needed becauase some property inherits from the containing block,
71 // not painting parent, thus can't be derived in O(1) during paint walk. 75 // not painting parent, thus can't be derived in O(1) during paint walk.
72 // Note: If this layout object has transform or stacking-context effects, th ose are already 76 // Note: If this layout object has transform or stacking-context effects, th ose are already
73 // baked into in the context here. However for properties that affects only children, 77 // baked into in the context here. However for properties that affects only children,
74 // for example, perspective and overflow clip, those should be applied by th e painter 78 // for example, perspective and overflow clip, those should be applied by th e painter
75 // at the right painting step. 79 // at the right painting step.
76 struct LocalBorderBoxProperties { 80 struct LocalBorderBoxProperties {
77 LayoutPoint paintOffset; 81 LayoutPoint paintOffset;
82 // TODO(pdr): Rename this GeometryPropertyTreeState because it does not contain scroll.
78 PropertyTreeState propertyTreeState; 83 PropertyTreeState propertyTreeState;
84 const ScrollPaintPropertyNode* scroll;
79 }; 85 };
80 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); } 86 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); }
81 // ContentsProperties is the PropertyTreeState state that is the same as in localBorderBoxProperties, except that it is inside 87 // ContentsProperties is the PropertyTreeState state that is the same as in localBorderBoxProperties, except that it is inside
82 // any clips and scrolls caused by this object. This PropertyTreeState is su itable as the destination for paint invalidation. 88 // any clips and scrolls caused by this object. This PropertyTreeState is su itable as the destination for paint invalidation.
83 void getContentsProperties(PropertyTreeState&) const; 89 void getContentsProperties(PropertyTreeState&) const;
84 90
85 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } 91 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; }
86 void clearTransform() { m_transform = nullptr; } 92 void clearTransform() { m_transform = nullptr; }
87 void clearEffect() { m_effect = nullptr; } 93 void clearEffect() { m_effect = nullptr; }
88 void clearCssClip() { m_cssClip = nullptr; } 94 void clearCssClip() { m_cssClip = nullptr; }
89 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; } 95 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; }
90 void clearOverflowClip() { m_overflowClip = nullptr; } 96 void clearOverflowClip() { m_overflowClip = nullptr; }
91 void clearPerspective() { m_perspective = nullptr; } 97 void clearPerspective() { m_perspective = nullptr; }
92 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; } 98 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; }
93 void clearScrollTranslation() { m_scrollTranslation = nullptr; } 99 void clearScrollTranslation() { m_scrollTranslation = nullptr; }
94 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; } 100 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; }
101 void clearScroll() { m_scroll = nullptr; }
95 102
96 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePaintO ffsetTranslation(Args&&... args) { return createOrUpdateProperty(m_paintOffsetTr anslation, std::forward<Args>(args)...); } 103 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePaintO ffsetTranslation(Args&&... args) { return createOrUpdateProperty(m_paintOffsetTr anslation, std::forward<Args>(args)...); }
97 template <typename... Args> TransformPaintPropertyNode* createOrUpdateTransf orm(Args&&... args) { return createOrUpdateProperty(m_transform, std::forward<Ar gs>(args)...); } 104 template <typename... Args> TransformPaintPropertyNode* createOrUpdateTransf orm(Args&&... args) { return createOrUpdateProperty(m_transform, std::forward<Ar gs>(args)...); }
98 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePerspe ctive(Args&&... args) { return createOrUpdateProperty(m_perspective, std::forwar d<Args>(args)...); } 105 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePerspe ctive(Args&&... args) { return createOrUpdateProperty(m_perspective, std::forwar d<Args>(args)...); }
99 template <typename... Args> TransformPaintPropertyNode* createOrUpdateSvgLoc alToBorderBoxTransform(Args&&... args) 106 template <typename... Args> TransformPaintPropertyNode* createOrUpdateSvgLoc alToBorderBoxTransform(Args&&... args)
100 { 107 {
101 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there sho uld never be both a scroll translation and an SVG local to border box transform. "; 108 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there sho uld never be both a scroll translation and an SVG local to border box transform. ";
102 return createOrUpdateProperty(m_svgLocalToBorderBoxTransform, std::forwa rd<Args>(args)...); 109 return createOrUpdateProperty(m_svgLocalToBorderBoxTransform, std::forwa rd<Args>(args)...);
103 } 110 }
104 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll Translation(Args&&... args) 111 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll Translation(Args&&... args)
105 { 112 {
106 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s o there should never be both a scroll translation and an SVG local to border box transform."; 113 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s o there should never be both a scroll translation and an SVG local to border box transform.";
107 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...); 114 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...);
108 } 115 }
109 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); } 116 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); }
117 template <typename... Args> ScrollPaintPropertyNode* createOrUpdateScroll(Ar gs&&... args) { return createOrUpdateProperty(m_scroll, std::forward<Args>(args) ...); }
110 template <typename... Args> EffectPaintPropertyNode* createOrUpdateEffect(Ar gs&&... args) { return createOrUpdateProperty(m_effect, std::forward<Args>(args) ...); } 118 template <typename... Args> EffectPaintPropertyNode* createOrUpdateEffect(Ar gs&&... args) { return createOrUpdateProperty(m_effect, std::forward<Args>(args) ...); }
111 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClip(Arg s&&... args) { return createOrUpdateProperty(m_cssClip, std::forward<Args>(args) ...); } 119 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClip(Arg s&&... args) { return createOrUpdateProperty(m_cssClip, std::forward<Args>(args) ...); }
112 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClipFixe dPosition(Args&&... args) { return createOrUpdateProperty(m_cssClipFixedPosition , std::forward<Args>(args)...); } 120 template <typename... Args> ClipPaintPropertyNode* createOrUpdateCssClipFixe dPosition(Args&&... args) { return createOrUpdateProperty(m_cssClipFixedPosition , std::forward<Args>(args)...); }
113 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); } 121 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); }
114 122
115 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); } 123 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); }
116 124
117 private: 125 private:
118 ObjectPaintProperties() { } 126 ObjectPaintProperties() { }
119 127
(...skipping 11 matching lines...) Expand all
131 RefPtr<TransformPaintPropertyNode> m_transform; 139 RefPtr<TransformPaintPropertyNode> m_transform;
132 RefPtr<EffectPaintPropertyNode> m_effect; 140 RefPtr<EffectPaintPropertyNode> m_effect;
133 RefPtr<ClipPaintPropertyNode> m_cssClip; 141 RefPtr<ClipPaintPropertyNode> m_cssClip;
134 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; 142 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition;
135 RefPtr<ClipPaintPropertyNode> m_overflowClip; 143 RefPtr<ClipPaintPropertyNode> m_overflowClip;
136 RefPtr<TransformPaintPropertyNode> m_perspective; 144 RefPtr<TransformPaintPropertyNode> m_perspective;
137 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. 145 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there.
138 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; 146 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform;
139 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 147 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
140 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 148 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
149 RefPtr<ScrollPaintPropertyNode> m_scroll;
141 150
142 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; 151 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties;
143 }; 152 };
144 153
145 } // namespace blink 154 } // namespace blink
146 155
147 #endif // ObjectPaintProperties_h 156 #endif // ObjectPaintProperties_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698