| 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 "core/CoreExport.h" |
| 8 #include "platform/geometry/LayoutPoint.h" | 9 #include "platform/geometry/LayoutPoint.h" |
| 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 10 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 11 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 11 #include "platform/graphics/paint/PaintChunkProperties.h" | 12 #include "platform/graphics/paint/PaintChunkProperties.h" |
| 13 #include "platform/graphics/paint/PropertyTreeState.h" |
| 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 14 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 13 #include "wtf/PassRefPtr.h" | 15 #include "wtf/PassRefPtr.h" |
| 14 #include "wtf/PtrUtil.h" | 16 #include "wtf/PtrUtil.h" |
| 15 #include "wtf/RefPtr.h" | 17 #include "wtf/RefPtr.h" |
| 16 #include <memory> | 18 #include <memory> |
| 17 | 19 |
| 18 namespace blink { | 20 namespace blink { |
| 19 | 21 |
| 20 // This class stores property tree related information associated with a LayoutO
bject. | 22 // This class stores property tree related information associated with a LayoutO
bject. |
| 21 // Currently there are two groups of information: | 23 // Currently there are two groups of information: |
| 22 // 1. The set of property nodes created locally by this LayoutObject. | 24 // 1. The set of property nodes created locally by this LayoutObject. |
| 23 // 2. [Optional] A suite of property nodes (PaintChunkProperties) and paint offs
et | 25 // 2. [Optional] A suite of property nodes (PaintChunkProperties) and paint offs
et |
| 24 // that can be used to paint the border box of this LayoutObject. | 26 // that can be used to paint the border box of this LayoutObject. |
| 25 class ObjectPaintProperties { | 27 class CORE_EXPORT ObjectPaintProperties { |
| 26 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); | 28 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); |
| 27 USING_FAST_MALLOC(ObjectPaintProperties); | 29 USING_FAST_MALLOC(ObjectPaintProperties); |
| 28 public: | 30 public: |
| 29 struct LocalBorderBoxProperties; | 31 struct LocalBorderBoxProperties; |
| 30 | 32 |
| 31 static std::unique_ptr<ObjectPaintProperties> create() | 33 static std::unique_ptr<ObjectPaintProperties> create() |
| 32 { | 34 { |
| 33 return wrapUnique(new ObjectPaintProperties()); | 35 return wrapUnique(new ObjectPaintProperties()); |
| 34 } | 36 } |
| 35 | 37 |
| 36 // The hierarchy of transform subtree created by a LayoutObject. | 38 // The hierarchy of the transform subtree created by a LayoutObject is as fo
llows: |
| 37 // [ paintOffsetTranslation ] Normally paint offset is accumulated
without creating a node | 39 // [ paintOffsetTranslation ] Normally paint offset is accumulated
without creating a node |
| 38 // | until we see, for example, transform
or position:fixed. | 40 // | until we see, for example, transform
or position:fixed. |
| 39 // +---[ transform ] The space created by CSS transform. | 41 // +---[ transform ] The space created by CSS transform. |
| 40 // | This is the local border box space,
see: LocalBorderBoxProperties below. | 42 // | This is the local border box space,
see: LocalBorderBoxProperties below. |
| 41 // +---[ perspective ] The space created by CSS perspective
. | 43 // +---[ perspective ] The space created by CSS perspective
. |
| 42 // | +---[ svgLocalToBorderBoxTransform ] Additional transform for chi
ldren of the outermost root SVG. | 44 // | +---[ svgLocalToBorderBoxTransform ] Additional transform for chi
ldren of the outermost root SVG. |
| 43 // | OR (SVG does not support scrolling.) | 45 // | OR (SVG does not support scrolling.) |
| 44 // | +---[ scrollTranslation ] The space created by overflow clip. | 46 // | +---[ scrollTranslation ] The space created by overflow clip. |
| 45 // +---[ scrollbarPaintOffset ] TODO(trchen): Remove this once we ba
ke the paint offset into frameRect. | 47 // +---[ scrollbarPaintOffset ] TODO(trchen): Remove this once we ba
ke the paint offset into frameRect. |
| 46 // This is equivalent to the local bord
er box space above, | 48 // This is equivalent to the local bord
er box space above, |
| 47 // with pixel snapped paint offset bake
d in. It is really redundant, | 49 // with pixel snapped paint offset bake
d in. It is really redundant, |
| 48 // but it is a pain to teach scrollbars
to paint with an offset. | 50 // but it is a pain to teach scrollbars
to paint with an offset. |
| 49 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO
ffsetTranslation.get(); } | 51 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO
ffsetTranslation.get(); } |
| 50 TransformPaintPropertyNode* transform() const { return m_transform.get(); } | 52 TransformPaintPropertyNode* transform() const { return m_transform.get(); } |
| 51 TransformPaintPropertyNode* perspective() const { return m_perspective.get()
; } | 53 TransformPaintPropertyNode* perspective() const { return m_perspective.get()
; } |
| 52 TransformPaintPropertyNode* svgLocalToBorderBoxTransform() const { return m_
svgLocalToBorderBoxTransform.get(); } | 54 TransformPaintPropertyNode* svgLocalToBorderBoxTransform() const { return m_
svgLocalToBorderBoxTransform.get(); } |
| 53 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans
lation.get(); } | 55 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans
lation.get(); } |
| 54 TransformPaintPropertyNode* scrollbarPaintOffset() const { return m_scrollba
rPaintOffset.get(); } | 56 TransformPaintPropertyNode* scrollbarPaintOffset() const { return m_scrollba
rPaintOffset.get(); } |
| 55 | 57 |
| 56 EffectPaintPropertyNode* effect() const { return m_effect.get(); } | 58 EffectPaintPropertyNode* effect() const { return m_effect.get(); } |
| 57 | 59 |
| 60 // The hierarchy of the clip subtree created by a LayoutObject is as follows
: |
| 61 // [ css clip ] |
| 62 // | |
| 63 // +--- [ overflow clip ] |
| 58 ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } | 64 ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } |
| 59 ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClipFixedP
osition.get(); } | 65 ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClipFixedP
osition.get(); } |
| 60 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } | 66 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } |
| 61 | 67 |
| 62 // This is a complete set of property nodes that should be used as a startin
g point to paint | 68 // This is a complete set of property nodes that should be used as a startin
g point to paint |
| 63 // this layout object. It is needed becauase some property inherits from the
containing block, | 69 // this layout object. It is needed becauase some property inherits from the
containing block, |
| 64 // 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. |
| 65 // 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 |
| 66 // 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, |
| 67 // 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 |
| 68 // at the right painting step. | 74 // at the right painting step. |
| 69 struct LocalBorderBoxProperties { | 75 struct LocalBorderBoxProperties { |
| 70 LayoutPoint paintOffset; | 76 LayoutPoint paintOffset; |
| 71 RefPtr<TransformPaintPropertyNode> transform; | 77 PropertyTreeState propertyTreeState; |
| 72 RefPtr<ClipPaintPropertyNode> clip; | |
| 73 RefPtr<EffectPaintPropertyNode> effect; | |
| 74 }; | 78 }; |
| 75 LocalBorderBoxProperties* localBorderBoxProperties() const { return m_localB
orderBoxProperties.get(); } | 79 LocalBorderBoxProperties* localBorderBoxProperties() const { return m_localB
orderBoxProperties.get(); } |
| 76 | 80 |
| 77 private: | 81 private: |
| 78 ObjectPaintProperties() { } | 82 ObjectPaintProperties() { } |
| 79 | 83 |
| 80 friend class PaintPropertyTreeBuilder; | 84 friend class PaintPropertyTreeBuilder; |
| 81 // These setters should only be used by PaintPropertyTreeBuilder. | 85 // These setters should only be used by PaintPropertyTreeBuilder. |
| 82 void setPaintOffsetTranslation(PassRefPtr<TransformPaintPropertyNode> paintO
ffset) { m_paintOffsetTranslation = paintOffset; } | 86 void setPaintOffsetTranslation(PassRefPtr<TransformPaintPropertyNode> paintO
ffset) { m_paintOffsetTranslation = paintOffset; } |
| 83 void setTransform(PassRefPtr<TransformPaintPropertyNode> transform) { m_tran
sform = transform; } | 87 void setTransform(PassRefPtr<TransformPaintPropertyNode> transform) { m_tran
sform = transform; } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 110 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; | 114 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; |
| 111 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 115 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 112 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 116 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
| 113 | 117 |
| 114 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; | 118 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // namespace blink | 121 } // namespace blink |
| 118 | 122 |
| 119 #endif // ObjectPaintProperties_h | 123 #endif // ObjectPaintProperties_h |
| OLD | NEW |