OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ScrollPaintPropertyNode_h |
| 6 #define ScrollPaintPropertyNode_h |
| 7 |
| 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/geometry/FloatSize.h" |
| 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 11 #include "wtf/PassRefPtr.h" |
| 12 #include "wtf/RefCounted.h" |
| 13 #include "wtf/RefPtr.h" |
| 14 |
| 15 #include <iosfwd> |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 // A scroll node contains auxillary scrolling information about areas that |
| 20 // respond to user input and how far they can be scrolled. The actual scroll |
| 21 // offset is applied in an associated TransformPaintPropertyNode. |
| 22 class PLATFORM_EXPORT ScrollPaintPropertyNode : public RefCounted<ScrollPaintPro
pertyNode> { |
| 23 public: |
| 24 static PassRefPtr<ScrollPaintPropertyNode> create( |
| 25 PassRefPtr<const ScrollPaintPropertyNode> parent, |
| 26 PassRefPtr<const TransformPaintPropertyNode> transform, |
| 27 const FloatSize& clip, |
| 28 const FloatSize& bounds, |
| 29 bool userScrollableHorizontal, |
| 30 bool userScrollableVertical) |
| 31 { |
| 32 return adoptRef(new ScrollPaintPropertyNode(parent, transform, clip, bou
nds, userScrollableHorizontal, userScrollableVertical)); |
| 33 } |
| 34 |
| 35 void update(PassRefPtr<const ScrollPaintPropertyNode> parent, PassRefPtr<con
st TransformPaintPropertyNode> transform, const FloatSize& clip, const FloatSize
& bounds, bool userScrollableHorizontal, bool userScrollableVertical) |
| 36 { |
| 37 m_parent = parent; |
| 38 m_transform = transform; |
| 39 m_clip = clip; |
| 40 m_bounds = bounds; |
| 41 m_userScrollableHorizontal = userScrollableHorizontal; |
| 42 m_userScrollableVertical = userScrollableVertical; |
| 43 } |
| 44 |
| 45 const ScrollPaintPropertyNode* parent() const { return m_parent.get(); } |
| 46 |
| 47 // Transform that the scroll is relative to. |
| 48 const TransformPaintPropertyNode* transform() const { return m_transform.get
(); } |
| 49 |
| 50 // The clipped area that contains the scrolled content. In the common case |
| 51 // this is the area that could respond to user input. |
| 52 const FloatSize& clip() const { return m_clip; } |
| 53 |
| 54 // The bounds of the content that is scrolled. |
| 55 const FloatSize& bounds() const { return m_bounds; } |
| 56 |
| 57 bool userScrollableHorizontal() const { return m_userScrollableHorizontal; } |
| 58 bool userScrollableVertical() const { return m_userScrollableVertical; } |
| 59 |
| 60 private: |
| 61 ScrollPaintPropertyNode( |
| 62 PassRefPtr<const ScrollPaintPropertyNode> parent, |
| 63 PassRefPtr<const TransformPaintPropertyNode> transform, |
| 64 FloatSize clip, |
| 65 FloatSize bounds, |
| 66 bool userScrollableHorizontal, |
| 67 bool userScrollableVertical) |
| 68 : m_parent(parent) |
| 69 , m_transform(transform) |
| 70 , m_clip(clip) |
| 71 , m_bounds(bounds) |
| 72 , m_userScrollableHorizontal(userScrollableHorizontal) |
| 73 , m_userScrollableVertical(userScrollableVertical) |
| 74 { |
| 75 } |
| 76 |
| 77 RefPtr<const ScrollPaintPropertyNode> m_parent; |
| 78 // TODO(pdr): Refactor as m_scrollOffsetTransform. |
| 79 RefPtr<const TransformPaintPropertyNode> m_transform; |
| 80 // TODO(pdr): Add an offset for the clip and bounds to the transform. |
| 81 FloatSize m_clip; |
| 82 FloatSize m_bounds; |
| 83 bool m_userScrollableHorizontal; |
| 84 bool m_userScrollableVertical; |
| 85 // TODO(pdr): Add main thread scrolling reasons. |
| 86 // TODO(pdr): Add scrollable bit. |
| 87 // TODO(pdr): Add 2 bits for whether this is a viewport scroll node. |
| 88 // TODO(pdr): Add a bit for whether this is affected by page scale. |
| 89 }; |
| 90 |
| 91 // Redeclared here to avoid ODR issues. |
| 92 // See platform/testing/PaintPrinters.h. |
| 93 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*); |
| 94 |
| 95 } // namespace blink |
| 96 |
| 97 #endif // ScrollPaintPropertyNode_h |
OLD | NEW |