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

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: Add more paint property builder tests, update comments/documentation" 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 // Auxillary scrolling information for compositor-thread scrolling. Includes information such as the
60 // hierarchy of scrollable areas, the extent that can be scrolled, etc.
61 const ScrollPaintPropertyNode* scroll() const { return m_scroll.get(); }
62
58 const EffectPaintPropertyNode* effect() const { return m_effect.get(); } 63 const EffectPaintPropertyNode* effect() const { return m_effect.get(); }
59 64
60 // The hierarchy of the clip subtree created by a LayoutObject is as follows : 65 // The hierarchy of the clip subtree created by a LayoutObject is as follows :
61 // [ css clip ] 66 // [ css clip ]
62 // [ css clip fixed position] 67 // [ css clip fixed position]
63 // | 68 // |
64 // +--- [ overflow clip ] 69 // +--- [ overflow clip ]
65 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } 70 const ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); }
66 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip FixedPosition.get(); } 71 const ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClip FixedPosition.get(); }
67 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge t(); } 72 const ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.ge t(); }
68 73
69 // This is a complete set of property nodes that should be used as a startin g point to paint 74 // 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, 75 // 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. 76 // 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 77 // 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, 78 // 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 79 // for example, perspective and overflow clip, those should be applied by th e painter
75 // at the right painting step. 80 // at the right painting step.
76 struct LocalBorderBoxProperties { 81 struct LocalBorderBoxProperties {
77 LayoutPoint paintOffset; 82 LayoutPoint paintOffset;
83 // TODO(pdr): Rename this GeometryPropertyTreeState because it does not contain scroll.
78 PropertyTreeState propertyTreeState; 84 PropertyTreeState propertyTreeState;
85 const ScrollPaintPropertyNode* scroll;
79 }; 86 };
80 const LocalBorderBoxProperties* localBorderBoxProperties() const { return m_ localBorderBoxProperties.get(); } 87 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 88 // 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. 89 // any clips and scrolls caused by this object. This PropertyTreeState is su itable as the destination for paint invalidation.
83 void getContentsProperties(PropertyTreeState&) const; 90 void getContentsProperties(PropertyTreeState&) const;
84 91
85 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; } 92 void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; }
86 void clearTransform() { m_transform = nullptr; } 93 void clearTransform() { m_transform = nullptr; }
87 void clearEffect() { m_effect = nullptr; } 94 void clearEffect() { m_effect = nullptr; }
88 void clearCssClip() { m_cssClip = nullptr; } 95 void clearCssClip() { m_cssClip = nullptr; }
89 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; } 96 void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; }
90 void clearOverflowClip() { m_overflowClip = nullptr; } 97 void clearOverflowClip() { m_overflowClip = nullptr; }
91 void clearPerspective() { m_perspective = nullptr; } 98 void clearPerspective() { m_perspective = nullptr; }
92 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; } 99 void clearSvgLocalToBorderBoxTransform() { m_svgLocalToBorderBoxTransform = nullptr; }
93 void clearScrollTranslation() { m_scrollTranslation = nullptr; } 100 void clearScrollTranslation() { m_scrollTranslation = nullptr; }
94 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; } 101 void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; }
102 void clearScroll() { m_scroll = nullptr; }
95 103
96 template <typename... Args> TransformPaintPropertyNode* createOrUpdatePaintO ffsetTranslation(Args&&... args) { return createOrUpdateProperty(m_paintOffsetTr anslation, std::forward<Args>(args)...); } 104 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)...); } 105 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)...); } 106 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) 107 template <typename... Args> TransformPaintPropertyNode* createOrUpdateSvgLoc alToBorderBoxTransform(Args&&... args)
100 { 108 {
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. "; 109 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)...); 110 return createOrUpdateProperty(m_svgLocalToBorderBoxTransform, std::forwa rd<Args>(args)...);
103 } 111 }
104 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll Translation(Args&&... args) 112 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll Translation(Args&&... args)
105 { 113 {
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."; 114 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)...); 115 return createOrUpdateProperty(m_scrollTranslation, std::forward<Args>(ar gs)...);
108 } 116 }
109 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); } 117 template <typename... Args> TransformPaintPropertyNode* createOrUpdateScroll barPaintOffset(Args&&... args) { return createOrUpdateProperty(m_scrollbarPaintO ffset, std::forward<Args>(args)...); }
118 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) ...); } 119 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) ...); } 120 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)...); } 121 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)...); } 122 template <typename... Args> ClipPaintPropertyNode* createOrUpdateOverflowCli p(Args&&... args) { return createOrUpdateProperty(m_overflowClip, std::forward<A rgs>(args)...); }
114 123
115 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); } 124 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p roperties) { m_localBorderBoxProperties = std::move(properties); }
116 125
117 private: 126 private:
118 ObjectPaintProperties() { } 127 ObjectPaintProperties() { }
119 128
(...skipping 11 matching lines...) Expand all
131 RefPtr<TransformPaintPropertyNode> m_transform; 140 RefPtr<TransformPaintPropertyNode> m_transform;
132 RefPtr<EffectPaintPropertyNode> m_effect; 141 RefPtr<EffectPaintPropertyNode> m_effect;
133 RefPtr<ClipPaintPropertyNode> m_cssClip; 142 RefPtr<ClipPaintPropertyNode> m_cssClip;
134 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; 143 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition;
135 RefPtr<ClipPaintPropertyNode> m_overflowClip; 144 RefPtr<ClipPaintPropertyNode> m_overflowClip;
136 RefPtr<TransformPaintPropertyNode> m_perspective; 145 RefPtr<TransformPaintPropertyNode> m_perspective;
137 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. 146 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there.
138 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; 147 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform;
139 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 148 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
140 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; 149 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset;
150 RefPtr<ScrollPaintPropertyNode> m_scroll;
141 151
142 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; 152 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties;
143 }; 153 };
144 154
145 } // namespace blink 155 } // namespace blink
146 156
147 #endif // ObjectPaintProperties_h 157 #endif // ObjectPaintProperties_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/FramePainter.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698