OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 ScrollPaintPropertyNode_h | 5 #ifndef ScrollPaintPropertyNode_h |
6 #define ScrollPaintPropertyNode_h | 6 #define ScrollPaintPropertyNode_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/geometry/FloatSize.h" | 9 #include "platform/geometry/FloatSize.h" |
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 DCHECK(scrollOffsetTranslation->matrix().isIdentityOr2DTranslation()); | 46 DCHECK(scrollOffsetTranslation->matrix().isIdentityOr2DTranslation()); |
47 m_scrollOffsetTranslation = scrollOffsetTranslation; | 47 m_scrollOffsetTranslation = scrollOffsetTranslation; |
48 m_clip = clip; | 48 m_clip = clip; |
49 m_bounds = bounds; | 49 m_bounds = bounds; |
50 m_userScrollableHorizontal = userScrollableHorizontal; | 50 m_userScrollableHorizontal = userScrollableHorizontal; |
51 m_userScrollableVertical = userScrollableVertical; | 51 m_userScrollableVertical = userScrollableVertical; |
52 m_mainThreadScrollingReasons = 0; | 52 m_mainThreadScrollingReasons = 0; |
53 } | 53 } |
54 | 54 |
55 ScrollPaintPropertyNode* parent() const { return m_parent.get(); } | 55 ScrollPaintPropertyNode* parent() const { return m_parent.get(); } |
| 56 bool isRoot() const { return !m_parent; } |
56 | 57 |
57 // Transform that the scroll is relative to. | 58 // Transform that the scroll is relative to. |
58 const TransformPaintPropertyNode* scrollOffsetTranslation() const { return m
_scrollOffsetTranslation.get(); } | 59 const TransformPaintPropertyNode* scrollOffsetTranslation() const { return m
_scrollOffsetTranslation.get(); } |
59 | 60 |
60 // The clipped area that contains the scrolled content. | 61 // The clipped area that contains the scrolled content. |
61 const IntSize& clip() const { return m_clip; } | 62 const IntSize& clip() const { return m_clip; } |
62 | 63 |
63 // The bounds of the content that is scrolled within |clip|. | 64 // The bounds of the content that is scrolled within |clip|. |
64 const IntSize& bounds() const { return m_bounds; } | 65 const IntSize& bounds() const { return m_bounds; } |
65 | 66 |
66 bool userScrollableHorizontal() const { return m_userScrollableHorizontal; } | 67 bool userScrollableHorizontal() const { return m_userScrollableHorizontal; } |
67 bool userScrollableVertical() const { return m_userScrollableVertical; } | 68 bool userScrollableVertical() const { return m_userScrollableVertical; } |
68 | 69 |
69 // Return reason bitfield with values from cc::MainThreadScrollingReason. | 70 // Return reason bitfield with values from cc::MainThreadScrollingReason. |
70 MainThreadScrollingReasons mainThreadScrollingReasons() const | 71 MainThreadScrollingReasons mainThreadScrollingReasons() const |
71 { | 72 { |
72 return m_mainThreadScrollingReasons; | 73 return m_mainThreadScrollingReasons; |
73 } | 74 } |
74 bool hasMainThreadScrollingReasons(MainThreadScrollingReasons reasons) const | 75 bool hasMainThreadScrollingReasons(MainThreadScrollingReasons reasons) const |
75 { | 76 { |
76 return m_mainThreadScrollingReasons & reasons; | 77 return m_mainThreadScrollingReasons & reasons; |
77 } | 78 } |
78 void addMainThreadScrollingReasons(MainThreadScrollingReasons reasons) | 79 void addMainThreadScrollingReasons(MainThreadScrollingReasons reasons) |
79 { | 80 { |
80 m_mainThreadScrollingReasons |= reasons; | 81 m_mainThreadScrollingReasons |= reasons; |
81 } | 82 } |
| 83 void clearMainThreadScrollingReasons() |
| 84 { |
| 85 m_mainThreadScrollingReasons = 0; |
| 86 } |
82 | 87 |
83 private: | 88 private: |
84 ScrollPaintPropertyNode( | 89 ScrollPaintPropertyNode( |
85 PassRefPtr<ScrollPaintPropertyNode> parent, | 90 PassRefPtr<ScrollPaintPropertyNode> parent, |
86 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, | 91 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, |
87 IntSize clip, | 92 IntSize clip, |
88 IntSize bounds, | 93 IntSize bounds, |
89 bool userScrollableHorizontal, | 94 bool userScrollableHorizontal, |
90 bool userScrollableVertical) | 95 bool userScrollableVertical) |
91 : m_parent(parent) | 96 : m_parent(parent) |
(...skipping 19 matching lines...) Expand all Loading... |
111 // TODO(pdr): Add a bit for whether this is affected by page scale. | 116 // TODO(pdr): Add a bit for whether this is affected by page scale. |
112 }; | 117 }; |
113 | 118 |
114 // Redeclared here to avoid ODR issues. | 119 // Redeclared here to avoid ODR issues. |
115 // See platform/testing/PaintPrinters.h. | 120 // See platform/testing/PaintPrinters.h. |
116 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*); | 121 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*); |
117 | 122 |
118 } // namespace blink | 123 } // namespace blink |
119 | 124 |
120 #endif // ScrollPaintPropertyNode_h | 125 #endif // ScrollPaintPropertyNode_h |
OLD | NEW |