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