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

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

Issue 1651153003: [SPv2] Adds pre-computed paint property context to PaintLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: migrated the cache to ObjectPaintProperties Created 4 years, 10 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 "platform/geometry/LayoutPoint.h"
8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h"
11 #include "platform/graphics/paint/PaintChunkProperties.h"
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
11 #include "wtf/PassOwnPtr.h" 13 #include "wtf/PassOwnPtr.h"
12 #include "wtf/PassRefPtr.h" 14 #include "wtf/PassRefPtr.h"
13 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
14 16
15 namespace blink { 17 namespace blink {
16 18
17 // The minimal set of paint properties created by a |LayoutObject|. These 19 // The minimal set of paint properties created by a |LayoutObject|. These
18 // properties encode a hierachy of transforms, clips, effects, etc, both between 20 // properties encode a hierachy of transforms, clips, effects, etc, both between
19 // LayoutObjects (each property has a parent) and among the properties of a 21 // LayoutObjects (each property has a parent) and among the properties of a
20 // single LayoutObject (e.g., transform and perspective with the correct parent 22 // single LayoutObject (e.g., transform and perspective with the correct parent
21 // relationship to represent ordering). 23 // relationship to represent ordering).
22 // 24 //
23 // This differs from |PaintChunkProperties| because it can store multiple 25 // This differs from |PaintChunkProperties| because it can store multiple
24 // properties of the same type (e.g., transform and perspective which are both 26 // properties of the same type (e.g., transform and perspective which are both
25 // transforms). 27 // transforms).
26 class ObjectPaintProperties { 28 class ObjectPaintProperties {
27 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); 29 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties);
28 USING_FAST_MALLOC(ObjectPaintProperties); 30 USING_FAST_MALLOC(ObjectPaintProperties);
29 public: 31 public:
32 struct PropertyTreeContext;
33
30 static PassOwnPtr<ObjectPaintProperties> create( 34 static PassOwnPtr<ObjectPaintProperties> create(
31 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, 35 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation,
32 PassRefPtr<TransformPaintPropertyNode> transform, 36 PassRefPtr<TransformPaintPropertyNode> transform,
33 PassRefPtr<EffectPaintPropertyNode> effect, 37 PassRefPtr<EffectPaintPropertyNode> effect,
34 PassRefPtr<ClipPaintPropertyNode> overflowClip, 38 PassRefPtr<ClipPaintPropertyNode> overflowClip,
35 PassRefPtr<TransformPaintPropertyNode> perspective, 39 PassRefPtr<TransformPaintPropertyNode> perspective,
36 PassRefPtr<TransformPaintPropertyNode> scrollTranslation) 40 PassRefPtr<TransformPaintPropertyNode> scrollTranslation,
41 PassOwnPtr<PropertyTreeContext> propertyTreeContext)
37 { 42 {
38 return adoptPtr(new ObjectPaintProperties(paintOffsetTranslation, transf orm, effect, overflowClip, perspective, scrollTranslation)); 43 return adoptPtr(new ObjectPaintProperties(paintOffsetTranslation, transf orm, effect, overflowClip, perspective, scrollTranslation, propertyTreeContext)) ;
39 } 44 }
40 45
41 // The hierarchy of transform subtree created by a LayoutObject. 46 // The hierarchy of transform subtree created by a LayoutObject.
42 // [ paintOffsetTranslation ] Normally paint offset is accumulated without creating a node 47 // [ paintOffsetTranslation ] Normally paint offset is accumulated without creating a node
43 // | until we see, for example, transform or position:fixed. 48 // | until we see, for example, transform or position:fixed.
44 // +---[ transform ] The space created by CSS transform. 49 // +---[ transform ] The space created by CSS transform.
pdr. 2016/02/03 23:56:11 WDYT about updating this diagram to include the co
trchen 2016/02/04 00:03:02 Acknowledged.
45 // +---[ perspective ] The space created by CSS perspective . 50 // +---[ perspective ] The space created by CSS perspective .
46 // +---[ scrollTranslation ] The space created by overflow clip. 51 // +---[ scrollTranslation ] The space created by overflow clip.
47 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO ffsetTranslation.get(); } 52 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO ffsetTranslation.get(); }
48 TransformPaintPropertyNode* transform() const { return m_transform.get(); } 53 TransformPaintPropertyNode* transform() const { return m_transform.get(); }
49 TransformPaintPropertyNode* perspective() const { return m_perspective.get() ; } 54 TransformPaintPropertyNode* perspective() const { return m_perspective.get() ; }
50 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans lation.get(); } 55 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans lation.get(); }
51 56
52 // Transform that applies to layer contents, or nullptr if this object 57 // Transform that applies to layer contents, or nullptr if this object
53 // doesn't define one. 58 // doesn't define one.
54 TransformPaintPropertyNode* transformForLayerContents() const; 59 TransformPaintPropertyNode* transformForLayerContents() const;
pdr. 2016/02/03 23:56:11 Does transformForLayerContents need to be updated
trchen 2016/02/04 00:03:02 Ah ha! Yes we can make use of the cache to get rid
trchen 2016/02/04 00:07:51 NVM. We can simply remove it with my CL #2.
55 60
56 EffectPaintPropertyNode* effect() const { return m_effect.get(); } 61 EffectPaintPropertyNode* effect() const { return m_effect.get(); }
57 62
58 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } 63 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); }
59 64
65 // This is a complete set of property nodes that should be used as a startin g point to paint
66 // this layout object. It is needed becauase some property inherits from the containing block,
67 // not painting parent, thus can't be derived in O(1) during paint walk.
68 // Note: If this layout object has transform or stacking-context effects, th ose are already
69 // baked into in the context here. However for properties that affects only children,
70 // for example, perspective and overflow clip, those should be applied by th e painter
71 // at the right painting step.
72 struct PropertyTreeContext {
73 LayoutPoint paintOffset;
74 PaintChunkProperties properties;
75 };
76 PropertyTreeContext* propertyTreeContext() const { return m_propertyTreeCont ext.get(); }
77
60 private: 78 private:
61 ObjectPaintProperties( 79 ObjectPaintProperties(
62 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, 80 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation,
63 PassRefPtr<TransformPaintPropertyNode> transform, 81 PassRefPtr<TransformPaintPropertyNode> transform,
64 PassRefPtr<EffectPaintPropertyNode> effect, 82 PassRefPtr<EffectPaintPropertyNode> effect,
65 PassRefPtr<ClipPaintPropertyNode> overflowClip, 83 PassRefPtr<ClipPaintPropertyNode> overflowClip,
66 PassRefPtr<TransformPaintPropertyNode> perspective, 84 PassRefPtr<TransformPaintPropertyNode> perspective,
67 PassRefPtr<TransformPaintPropertyNode> scrollTranslation) 85 PassRefPtr<TransformPaintPropertyNode> scrollTranslation,
86 PassOwnPtr<PropertyTreeContext> propertyTreeContext)
68 : m_paintOffsetTranslation(paintOffsetTranslation) 87 : m_paintOffsetTranslation(paintOffsetTranslation)
69 , m_transform(transform) 88 , m_transform(transform)
70 , m_effect(effect) 89 , m_effect(effect)
71 , m_overflowClip(overflowClip) 90 , m_overflowClip(overflowClip)
72 , m_perspective(perspective) 91 , m_perspective(perspective)
73 , m_scrollTranslation(scrollTranslation) { } 92 , m_scrollTranslation(scrollTranslation)
93 , m_propertyTreeContext(propertyTreeContext) { }
74 94
75 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; 95 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
76 RefPtr<TransformPaintPropertyNode> m_transform; 96 RefPtr<TransformPaintPropertyNode> m_transform;
77 RefPtr<EffectPaintPropertyNode> m_effect; 97 RefPtr<EffectPaintPropertyNode> m_effect;
78 RefPtr<ClipPaintPropertyNode> m_overflowClip; 98 RefPtr<ClipPaintPropertyNode> m_overflowClip;
79 RefPtr<TransformPaintPropertyNode> m_perspective; 99 RefPtr<TransformPaintPropertyNode> m_perspective;
80 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 100 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
101
102 OwnPtr<PropertyTreeContext> m_propertyTreeContext;
81 }; 103 };
82 104
83 } // namespace blink 105 } // namespace blink
84 106
85 #endif // ObjectPaintProperties_h 107 #endif // ObjectPaintProperties_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698