| 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" | 8 #include "platform/geometry/LayoutPoint.h" |
| 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 11 #include "platform/graphics/paint/PaintChunkProperties.h" | 11 #include "platform/graphics/paint/PaintChunkProperties.h" |
| 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 13 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
| 14 #include "wtf/PassRefPtr.h" | 14 #include "wtf/PassRefPtr.h" |
| 15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 // This class stores property tree related information associated with a LayoutO
bject. | 19 // This class stores property tree related information associated with a LayoutO
bject. |
| 20 // Currently there are two groups of information: | 20 // Currently there are two groups of information: |
| 21 // 1. The set of property nodes created locally by this LayoutObject. | 21 // 1. The set of property nodes created locally by this LayoutObject. |
| 22 // 2. [Optional] A suite of property nodes (PaintChunkProperties) and paint offs
et | 22 // 2. [Optional] A suite of property nodes (PaintChunkProperties) and paint offs
et |
| 23 // that can be used to paint the border box of this LayoutObject. | 23 // that can be used to paint the border box of this LayoutObject. |
| 24 class ObjectPaintProperties { | 24 class ObjectPaintProperties { |
| 25 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); | 25 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); |
| 26 USING_FAST_MALLOC(ObjectPaintProperties); | 26 USING_FAST_MALLOC(ObjectPaintProperties); |
| 27 public: | 27 public: |
| 28 struct LocalBorderBoxProperties; | 28 struct LocalBorderBoxProperties; |
| 29 | 29 |
| 30 // TODO(pdr): This should be refactored to not pass 11 arguments because it |
| 31 // is hard to follow here and at the callsites. |
| 30 static PassOwnPtr<ObjectPaintProperties> create( | 32 static PassOwnPtr<ObjectPaintProperties> create( |
| 31 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, | 33 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, |
| 32 PassRefPtr<TransformPaintPropertyNode> transform, | 34 PassRefPtr<TransformPaintPropertyNode> transform, |
| 33 PassRefPtr<EffectPaintPropertyNode> effect, | 35 PassRefPtr<EffectPaintPropertyNode> effect, |
| 34 PassRefPtr<ClipPaintPropertyNode> cssClip, | 36 PassRefPtr<ClipPaintPropertyNode> cssClip, |
| 35 PassRefPtr<ClipPaintPropertyNode> cssClipFixedPosition, | 37 PassRefPtr<ClipPaintPropertyNode> cssClipFixedPosition, |
| 36 PassRefPtr<ClipPaintPropertyNode> overflowClip, | 38 PassRefPtr<ClipPaintPropertyNode> overflowClip, |
| 37 PassRefPtr<TransformPaintPropertyNode> perspective, | 39 PassRefPtr<TransformPaintPropertyNode> perspective, |
| 40 PassRefPtr<TransformPaintPropertyNode> svgLocalTransform, |
| 38 PassRefPtr<TransformPaintPropertyNode> scrollTranslation, | 41 PassRefPtr<TransformPaintPropertyNode> scrollTranslation, |
| 39 PassRefPtr<TransformPaintPropertyNode> scrollbarPaintOffset, | 42 PassRefPtr<TransformPaintPropertyNode> scrollbarPaintOffset, |
| 40 PassOwnPtr<LocalBorderBoxProperties> localBorderBoxProperties) | 43 PassOwnPtr<LocalBorderBoxProperties> localBorderBoxProperties) |
| 41 { | 44 { |
| 42 return adoptPtr(new ObjectPaintProperties(paintOffsetTranslation, transf
orm, effect, cssClip, cssClipFixedPosition, overflowClip, perspective, scrollTra
nslation, scrollbarPaintOffset, localBorderBoxProperties)); | 45 return adoptPtr(new ObjectPaintProperties(paintOffsetTranslation, |
| 46 transform, effect, cssClip, cssClipFixedPosition, overflowClip, |
| 47 perspective, svgLocalTransform, scrollTranslation, |
| 48 scrollbarPaintOffset, localBorderBoxProperties)); |
| 43 } | 49 } |
| 44 | 50 |
| 45 // The hierarchy of transform subtree created by a LayoutObject. | 51 // The hierarchy of transform subtree created by a LayoutObject. |
| 46 // [ paintOffsetTranslation ] Normally paint offset is accumulated
without creating a node | 52 // [ paintOffsetTranslation ] Normally paint offset is accumulated
without creating a node |
| 47 // | until we see, for example, transform
or position:fixed. | 53 // | until we see, for example, transform
or position:fixed. |
| 48 // +---[ transform ] The space created by CSS transform. | 54 // +---[ transform ] The space created by CSS transform. |
| 49 // | This is the local border box space,
see: LocalBorderBoxProperties below. | 55 // | This is the local border box space,
see: LocalBorderBoxProperties below. |
| 50 // +---[ perspective ] The space created by CSS perspective
. | 56 // +---[ perspective ] The space created by CSS perspective
. |
| 57 // | +---[ svgLocalTransform ] The transform for an SVG element. |
| 58 // | OR (SVG does not support scrolling.) |
| 51 // | +---[ scrollTranslation ] The space created by overflow clip. | 59 // | +---[ scrollTranslation ] The space created by overflow clip. |
| 52 // +---[ scrollbarPaintOffset ] TODO(trchen): Remove this once we ba
ke the paint offset into frameRect. | 60 // +---[ scrollbarPaintOffset ] TODO(trchen): Remove this once we ba
ke the paint offset into frameRect. |
| 53 // This is equivalent to the local bord
er box space above, | 61 // This is equivalent to the local bord
er box space above, |
| 54 // with pixel snapped paint offset bake
d in. It is really redundant, | 62 // with pixel snapped paint offset bake
d in. It is really redundant, |
| 55 // but it is a pain to teach scrollbars
to paint with an offset. | 63 // but it is a pain to teach scrollbars
to paint with an offset. |
| 56 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO
ffsetTranslation.get(); } | 64 TransformPaintPropertyNode* paintOffsetTranslation() const { return m_paintO
ffsetTranslation.get(); } |
| 57 TransformPaintPropertyNode* transform() const { return m_transform.get(); } | 65 TransformPaintPropertyNode* transform() const { return m_transform.get(); } |
| 58 TransformPaintPropertyNode* perspective() const { return m_perspective.get()
; } | 66 TransformPaintPropertyNode* perspective() const { return m_perspective.get()
; } |
| 67 TransformPaintPropertyNode* svgLocalTransform() const { return m_svgLocalTra
nsform.get(); } |
| 59 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans
lation.get(); } | 68 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans
lation.get(); } |
| 60 TransformPaintPropertyNode* scrollbarPaintOffset() const { return m_scrollba
rPaintOffset.get(); } | 69 TransformPaintPropertyNode* scrollbarPaintOffset() const { return m_scrollba
rPaintOffset.get(); } |
| 61 | 70 |
| 62 EffectPaintPropertyNode* effect() const { return m_effect.get(); } | 71 EffectPaintPropertyNode* effect() const { return m_effect.get(); } |
| 63 | 72 |
| 64 ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } | 73 ClipPaintPropertyNode* cssClip() const { return m_cssClip.get(); } |
| 65 ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClipFixedP
osition.get(); } | 74 ClipPaintPropertyNode* cssClipFixedPosition() const { return m_cssClipFixedP
osition.get(); } |
| 66 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } | 75 ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); } |
| 67 | 76 |
| 68 // This is a complete set of property nodes that should be used as a startin
g point to paint | 77 // This is a complete set of property nodes that should be used as a startin
g point to paint |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 | 91 |
| 83 private: | 92 private: |
| 84 ObjectPaintProperties( | 93 ObjectPaintProperties( |
| 85 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, | 94 PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation, |
| 86 PassRefPtr<TransformPaintPropertyNode> transform, | 95 PassRefPtr<TransformPaintPropertyNode> transform, |
| 87 PassRefPtr<EffectPaintPropertyNode> effect, | 96 PassRefPtr<EffectPaintPropertyNode> effect, |
| 88 PassRefPtr<ClipPaintPropertyNode> cssClip, | 97 PassRefPtr<ClipPaintPropertyNode> cssClip, |
| 89 PassRefPtr<ClipPaintPropertyNode> cssClipFixedPosition, | 98 PassRefPtr<ClipPaintPropertyNode> cssClipFixedPosition, |
| 90 PassRefPtr<ClipPaintPropertyNode> overflowClip, | 99 PassRefPtr<ClipPaintPropertyNode> overflowClip, |
| 91 PassRefPtr<TransformPaintPropertyNode> perspective, | 100 PassRefPtr<TransformPaintPropertyNode> perspective, |
| 101 PassRefPtr<TransformPaintPropertyNode> svgLocalTransform, |
| 92 PassRefPtr<TransformPaintPropertyNode> scrollTranslation, | 102 PassRefPtr<TransformPaintPropertyNode> scrollTranslation, |
| 93 PassRefPtr<TransformPaintPropertyNode> scrollbarPaintOffset, | 103 PassRefPtr<TransformPaintPropertyNode> scrollbarPaintOffset, |
| 94 PassOwnPtr<LocalBorderBoxProperties> localBorderBoxProperties) | 104 PassOwnPtr<LocalBorderBoxProperties> localBorderBoxProperties) |
| 95 : m_paintOffsetTranslation(paintOffsetTranslation) | 105 : m_paintOffsetTranslation(paintOffsetTranslation) |
| 96 , m_transform(transform) | 106 , m_transform(transform) |
| 97 , m_effect(effect) | 107 , m_effect(effect) |
| 98 , m_cssClip(cssClip) | 108 , m_cssClip(cssClip) |
| 99 , m_cssClipFixedPosition(cssClipFixedPosition) | 109 , m_cssClipFixedPosition(cssClipFixedPosition) |
| 100 , m_overflowClip(overflowClip) | 110 , m_overflowClip(overflowClip) |
| 101 , m_perspective(perspective) | 111 , m_perspective(perspective) |
| 112 , m_svgLocalTransform(svgLocalTransform) |
| 102 , m_scrollTranslation(scrollTranslation) | 113 , m_scrollTranslation(scrollTranslation) |
| 103 , m_scrollbarPaintOffset(scrollbarPaintOffset) | 114 , m_scrollbarPaintOffset(scrollbarPaintOffset) |
| 104 , m_localBorderBoxProperties(localBorderBoxProperties) { } | 115 , m_localBorderBoxProperties(localBorderBoxProperties) { } |
| 105 | 116 |
| 106 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; | 117 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; |
| 107 RefPtr<TransformPaintPropertyNode> m_transform; | 118 RefPtr<TransformPaintPropertyNode> m_transform; |
| 108 RefPtr<EffectPaintPropertyNode> m_effect; | 119 RefPtr<EffectPaintPropertyNode> m_effect; |
| 109 RefPtr<ClipPaintPropertyNode> m_cssClip; | 120 RefPtr<ClipPaintPropertyNode> m_cssClip; |
| 110 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; | 121 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; |
| 111 RefPtr<ClipPaintPropertyNode> m_overflowClip; | 122 RefPtr<ClipPaintPropertyNode> m_overflowClip; |
| 112 RefPtr<TransformPaintPropertyNode> m_perspective; | 123 RefPtr<TransformPaintPropertyNode> m_perspective; |
| 124 RefPtr<TransformPaintPropertyNode> m_svgLocalTransform; |
| 113 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 125 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 114 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 126 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
| 115 | 127 |
| 116 OwnPtr<LocalBorderBoxProperties> m_localBorderBoxProperties; | 128 OwnPtr<LocalBorderBoxProperties> m_localBorderBoxProperties; |
| 117 }; | 129 }; |
| 118 | 130 |
| 119 } // namespace blink | 131 } // namespace blink |
| 120 | 132 |
| 121 #endif // ObjectPaintProperties_h | 133 #endif // ObjectPaintProperties_h |
| OLD | NEW |