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/graphics/paint/TransformPaintPropertyNode.h" | 8 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 9 #include "wtf/HashMap.h" |
| 10 #include "wtf/OwnPtr.h" |
| 11 #include "wtf/PassOwnPtr.h" |
9 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
10 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
11 | 14 |
12 namespace blink { | 15 namespace blink { |
13 | 16 |
14 // The minimal set of paint properties created by a |LayoutObject|. These | 17 // The minimal set of paint properties created by a |LayoutObject|. These |
15 // properties encode a hierachy of transforms, clips, effects, etc, both between | 18 // properties encode a hierachy of transforms, clips, effects, etc, both between |
16 // LayoutObjects (each property has a parent) and among the properties of a | 19 // LayoutObjects (each property has a parent) and among the properties of a |
17 // single LayoutObject (e.g., transform and perspective with the correct parent | 20 // single LayoutObject (e.g., transform and perspective with the correct parent |
18 // relationship to represent ordering). | 21 // relationship to represent ordering). |
19 // | 22 // |
20 // This differs from |PaintChunkProperties| because it can store multiple | 23 // This differs from |PaintChunkProperties| because it can store multiple |
21 // properties of the same type (e.g., transform and perspective which are both | 24 // properties of the same type (e.g., transform and perspective which are both |
22 // transforms). | 25 // transforms). |
23 class ObjectPaintProperties { | 26 class ObjectPaintProperties { |
24 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); | 27 WTF_MAKE_NONCOPYABLE(ObjectPaintProperties); |
25 WTF_MAKE_FAST_ALLOCATED(ObjectPaintProperties); | 28 WTF_MAKE_FAST_ALLOCATED(ObjectPaintProperties); |
26 public: | 29 public: |
27 static PassOwnPtr<ObjectPaintProperties> create() | 30 static PassOwnPtr<ObjectPaintProperties> create() |
28 { | 31 { |
29 return adoptPtr(new ObjectPaintProperties()); | 32 return adoptPtr(new ObjectPaintProperties()); |
30 } | 33 } |
31 | 34 |
32 bool hasTransform() const { return m_transform; } | 35 // The hierarchy of transform subtree created by a LayoutObject. |
| 36 // [ preTranslation ] Normally paint offset is accumulated
without creating a node |
| 37 // | until we see, for example, transform
or position:fixed. |
| 38 // +---[ transform ] The space created by CSS transform. |
| 39 // +---[ perspective ] The space created by CSS perspective
. |
| 40 // +---[ scrollTranslation ] The space created by overflow clip. |
| 41 void setPreTranslation(PassRefPtr<TransformPaintPropertyNode> preTranslation
) { m_preTranslation = preTranslation; } |
| 42 const TransformPaintPropertyNode* preTranslation() const { return m_preTrans
lation.get(); } |
| 43 |
33 void setTransform(PassRefPtr<TransformPaintPropertyNode> transform) { m_tran
sform = transform; } | 44 void setTransform(PassRefPtr<TransformPaintPropertyNode> transform) { m_tran
sform = transform; } |
34 const TransformPaintPropertyNode* transform() const { return m_transform.get
(); } | 45 const TransformPaintPropertyNode* transform() const { return m_transform.get
(); } |
35 | 46 |
36 bool hasPerspective() const { return m_perspective; } | |
37 void setPerspective(PassRefPtr<TransformPaintPropertyNode> perspective) { m_
perspective = perspective; } | 47 void setPerspective(PassRefPtr<TransformPaintPropertyNode> perspective) { m_
perspective = perspective; } |
38 const TransformPaintPropertyNode* perspective() const { return m_perspective
.get(); } | 48 const TransformPaintPropertyNode* perspective() const { return m_perspective
.get(); } |
39 | 49 |
| 50 void setScrollTranslation(PassRefPtr<TransformPaintPropertyNode> scrollTrans
lation) { m_scrollTranslation = scrollTranslation; } |
| 51 const TransformPaintPropertyNode* scrollTranslation() const { return m_scrol
lTranslation.get(); } |
| 52 |
40 private: | 53 private: |
41 ObjectPaintProperties() { } | 54 ObjectPaintProperties() { } |
42 | 55 |
| 56 RefPtr<TransformPaintPropertyNode> m_preTranslation; |
43 RefPtr<TransformPaintPropertyNode> m_transform; | 57 RefPtr<TransformPaintPropertyNode> m_transform; |
44 RefPtr<TransformPaintPropertyNode> m_perspective; | 58 RefPtr<TransformPaintPropertyNode> m_perspective; |
| 59 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
45 }; | 60 }; |
46 | 61 |
47 } // namespace blink | 62 } // namespace blink |
48 | 63 |
49 #endif // ObjectPaintProperties_h | 64 #endif // ObjectPaintProperties_h |
OLD | NEW |