Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" | |
|
pdr.
2016/02/04 04:54:01
Can you update PaintPropertyTreePrinter too?
To t
trchen
2016/02/04 23:08:40
Acknowledged.
trchen
2016/02/04 23:49:01
I examined PaintPropertyTreePainter. The painter o
| |
| 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 |
|
pdr.
2016/02/04 04:54:01
We need to update this comment too, since the prop
trchen
2016/02/04 23:08:40
Acknowledged.
| |
| 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. |
| 50 // | It is the local border box space the painter expects, | |
|
pdr.
2016/02/04 04:54:01
This helped me understand the situation. Maybe eve
trchen
2016/02/04 23:08:40
Acknowledged.
| |
| 51 // | see PropertyTreeContext below. | |
| 45 // +---[ perspective ] The space created by CSS perspective . | 52 // +---[ perspective ] The space created by CSS perspective . |
| 46 // +---[ scrollTranslation ] The space created by overflow clip. | 53 // +---[ scrollTranslation ] The space created by overflow clip. |
| 47 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO ffsetTranslation.get(); } | 54 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO ffsetTranslation.get(); } |
| 48 TransformPaintPropertyNode* transform() const { return m_transform.get(); } | 55 TransformPaintPropertyNode* transform() const { return m_transform.get(); } |
| 49 TransformPaintPropertyNode* perspective() const { return m_perspective.get() ; } | 56 TransformPaintPropertyNode* perspective() const { return m_perspective.get() ; } |
| 50 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans lation.get(); } | 57 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans lation.get(); } |
| 51 | 58 |
| 52 // Transform that applies to layer contents, or nullptr if this object | 59 // Transform that applies to layer contents, or nullptr if this object |
| 53 // doesn't define one. | 60 // doesn't define one. |
| 54 TransformPaintPropertyNode* transformForLayerContents() const; | 61 TransformPaintPropertyNode* transformForLayerContents() const; |
|
pdr.
2016/02/04 04:54:01
I think this comment and code still needs updating
trchen
2016/02/04 23:08:40
Not really. The difference is that this function o
| |
| 55 | 62 |
| 56 EffectPaintPropertyNode* effect() const { return m_effect.get(); } | 63 EffectPaintPropertyNode* effect() const { return m_effect.get(); } |
| 57 | 64 |
| 58 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } | 65 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } |
| 59 | 66 |
| 67 // This is a complete set of property nodes that should be used as a startin g point to paint | |
| 68 // this layout object. It is needed becauase some property inherits from the containing block, | |
| 69 // not painting parent, thus can't be derived in O(1) during paint walk. | |
| 70 // Note: If this layout object has transform or stacking-context effects, th ose are already | |
| 71 // baked into in the context here. However for properties that affects only children, | |
| 72 // for example, perspective and overflow clip, those should be applied by th e painter | |
| 73 // at the right painting step. | |
| 74 struct PropertyTreeContext { | |
|
pdr.
2016/02/04 04:54:01
WDYT of "LocalBorderBoxProperties"? In reading thr
trchen
2016/02/04 23:08:40
Sounds clear! Let's do that.
| |
| 75 LayoutPoint paintOffset; | |
| 76 PaintChunkProperties properties; | |
|
pdr.
2016/02/04 04:54:01
Can you think of a case when the effect/filter pro
trchen
2016/02/04 23:08:40
Probably not. Effect node can be derived from the
| |
| 77 }; | |
| 78 PropertyTreeContext* propertyTreeContext() const { return m_propertyTreeCont ext.get(); } | |
| 79 | |
| 60 private: | 80 private: |
| 61 ObjectPaintProperties( | 81 ObjectPaintProperties( |
| 62 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, | 82 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, |
| 63 PassRefPtr<TransformPaintPropertyNode> transform, | 83 PassRefPtr<TransformPaintPropertyNode> transform, |
| 64 PassRefPtr<EffectPaintPropertyNode> effect, | 84 PassRefPtr<EffectPaintPropertyNode> effect, |
| 65 PassRefPtr<ClipPaintPropertyNode> overflowClip, | 85 PassRefPtr<ClipPaintPropertyNode> overflowClip, |
| 66 PassRefPtr<TransformPaintPropertyNode> perspective, | 86 PassRefPtr<TransformPaintPropertyNode> perspective, |
| 67 PassRefPtr<TransformPaintPropertyNode> scrollTranslation) | 87 PassRefPtr<TransformPaintPropertyNode> scrollTranslation, |
| 88 PassOwnPtr<PropertyTreeContext> propertyTreeContext) | |
| 68 : m_paintOffsetTranslation(paintOffsetTranslation) | 89 : m_paintOffsetTranslation(paintOffsetTranslation) |
| 69 , m_transform(transform) | 90 , m_transform(transform) |
| 70 , m_effect(effect) | 91 , m_effect(effect) |
| 71 , m_overflowClip(overflowClip) | 92 , m_overflowClip(overflowClip) |
| 72 , m_perspective(perspective) | 93 , m_perspective(perspective) |
| 73 , m_scrollTranslation(scrollTranslation) { } | 94 , m_scrollTranslation(scrollTranslation) |
| 95 , m_propertyTreeContext(propertyTreeContext) { } | |
| 74 | 96 |
| 75 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; | 97 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; |
| 76 RefPtr<TransformPaintPropertyNode> m_transform; | 98 RefPtr<TransformPaintPropertyNode> m_transform; |
| 77 RefPtr<EffectPaintPropertyNode> m_effect; | 99 RefPtr<EffectPaintPropertyNode> m_effect; |
| 78 RefPtr<ClipPaintPropertyNode> m_overflowClip; | 100 RefPtr<ClipPaintPropertyNode> m_overflowClip; |
| 79 RefPtr<TransformPaintPropertyNode> m_perspective; | 101 RefPtr<TransformPaintPropertyNode> m_perspective; |
| 80 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 102 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 103 | |
| 104 OwnPtr<PropertyTreeContext> m_propertyTreeContext; | |
| 81 }; | 105 }; |
| 82 | 106 |
| 83 } // namespace blink | 107 } // namespace blink |
| 84 | 108 |
| 85 #endif // ObjectPaintProperties_h | 109 #endif // ObjectPaintProperties_h |
| OLD | NEW |