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/PassRefPtr.h" | 14 #include "wtf/PassRefPtr.h" |
14 #include "wtf/PtrUtil.h" | |
15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
16 #include <memory> | |
17 | 16 |
18 namespace blink { | 17 namespace blink { |
19 | 18 |
20 // 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. |
21 // Currently there are two groups of information: | 20 // Currently there are two groups of information: |
22 // 1. The set of property nodes created locally by this LayoutObject. | 21 // 1. The set of property nodes created locally by this LayoutObject. |
23 // 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 |
24 // 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. |
25 class ObjectPaintProperties { | 24 class ObjectPaintProperties { |
26 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); | 25 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); |
27 USING_FAST_MALLOC(ObjectPaintProperties); | 26 USING_FAST_MALLOC(ObjectPaintProperties); |
28 public: | 27 public: |
29 struct LocalBorderBoxProperties; | 28 struct LocalBorderBoxProperties; |
30 | 29 |
31 static std::unique_ptr<ObjectPaintProperties> create() | 30 static PassOwnPtr<ObjectPaintProperties> create() |
32 { | 31 { |
33 return wrapUnique(new ObjectPaintProperties()); | 32 return adoptPtr(new ObjectPaintProperties()); |
34 } | 33 } |
35 | 34 |
36 // The hierarchy of transform subtree created by a LayoutObject. | 35 // The hierarchy of transform subtree created by a LayoutObject. |
37 // [ paintOffsetTranslation ] Normally paint offset is accumulated
without creating a node | 36 // [ paintOffsetTranslation ] Normally paint offset is accumulated
without creating a node |
38 // | until we see, for example, transform
or position:fixed. | 37 // | until we see, for example, transform
or position:fixed. |
39 // +---[ transform ] The space created by CSS transform. | 38 // +---[ transform ] The space created by CSS transform. |
40 // | This is the local border box space,
see: LocalBorderBoxProperties below. | 39 // | This is the local border box space,
see: LocalBorderBoxProperties below. |
41 // +---[ perspective ] The space created by CSS perspective
. | 40 // +---[ perspective ] The space created by CSS perspective
. |
42 // | +---[ svgLocalToBorderBoxTransform ] Additional transform for chi
ldren of the outermost root SVG. | 41 // | +---[ svgLocalToBorderBoxTransform ] Additional transform for chi
ldren of the outermost root SVG. |
43 // | OR (SVG does not support scrolling.) | 42 // | OR (SVG does not support scrolling.) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 { | 89 { |
91 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there sho
uld never be both a scroll translation and an SVG local to border box transform.
"; | 90 DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there sho
uld never be both a scroll translation and an SVG local to border box transform.
"; |
92 m_svgLocalToBorderBoxTransform = transform; | 91 m_svgLocalToBorderBoxTransform = transform; |
93 } | 92 } |
94 void setScrollTranslation(PassRefPtr<TransformPaintPropertyNode> translation
) | 93 void setScrollTranslation(PassRefPtr<TransformPaintPropertyNode> translation
) |
95 { | 94 { |
96 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s
o there should never be both a scroll translation and an SVG local to border box
transform."; | 95 DCHECK(!svgLocalToBorderBoxTransform()) << "SVG elements cannot scroll s
o there should never be both a scroll translation and an SVG local to border box
transform."; |
97 m_scrollTranslation = translation; | 96 m_scrollTranslation = translation; |
98 } | 97 } |
99 void setScrollbarPaintOffset(PassRefPtr<TransformPaintPropertyNode> paintOff
set) { m_scrollbarPaintOffset = paintOffset; } | 98 void setScrollbarPaintOffset(PassRefPtr<TransformPaintPropertyNode> paintOff
set) { m_scrollbarPaintOffset = paintOffset; } |
100 void setLocalBorderBoxProperties(std::unique_ptr<LocalBorderBoxProperties> p
roperties) { m_localBorderBoxProperties = std::move(properties); } | 99 void setLocalBorderBoxProperties(PassOwnPtr<LocalBorderBoxProperties> proper
ties) { m_localBorderBoxProperties = std::move(properties); } |
101 | 100 |
102 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; | 101 RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation; |
103 RefPtr<TransformPaintPropertyNode> m_transform; | 102 RefPtr<TransformPaintPropertyNode> m_transform; |
104 RefPtr<EffectPaintPropertyNode> m_effect; | 103 RefPtr<EffectPaintPropertyNode> m_effect; |
105 RefPtr<ClipPaintPropertyNode> m_cssClip; | 104 RefPtr<ClipPaintPropertyNode> m_cssClip; |
106 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; | 105 RefPtr<ClipPaintPropertyNode> m_cssClipFixedPosition; |
107 RefPtr<ClipPaintPropertyNode> m_overflowClip; | 106 RefPtr<ClipPaintPropertyNode> m_overflowClip; |
108 RefPtr<TransformPaintPropertyNode> m_perspective; | 107 RefPtr<TransformPaintPropertyNode> m_perspective; |
109 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. | 108 // TODO(pdr): Only LayoutSVGRoot needs this and it should be moved there. |
110 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; | 109 RefPtr<TransformPaintPropertyNode> m_svgLocalToBorderBoxTransform; |
111 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 110 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
112 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; | 111 RefPtr<TransformPaintPropertyNode> m_scrollbarPaintOffset; |
113 | 112 |
114 std::unique_ptr<LocalBorderBoxProperties> m_localBorderBoxProperties; | 113 OwnPtr<LocalBorderBoxProperties> m_localBorderBoxProperties; |
115 }; | 114 }; |
116 | 115 |
117 } // namespace blink | 116 } // namespace blink |
118 | 117 |
119 #endif // ObjectPaintProperties_h | 118 #endif // ObjectPaintProperties_h |
OLD | NEW |