| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return m_mainThreadScrollingReasons; | 82 return m_mainThreadScrollingReasons; |
| 83 } | 83 } |
| 84 bool hasMainThreadScrollingReasons(MainThreadScrollingReasons reasons) const { | 84 bool hasMainThreadScrollingReasons(MainThreadScrollingReasons reasons) const { |
| 85 return m_mainThreadScrollingReasons & reasons; | 85 return m_mainThreadScrollingReasons & reasons; |
| 86 } | 86 } |
| 87 void addMainThreadScrollingReasons(MainThreadScrollingReasons reasons) { | 87 void addMainThreadScrollingReasons(MainThreadScrollingReasons reasons) { |
| 88 m_mainThreadScrollingReasons |= reasons; | 88 m_mainThreadScrollingReasons |= reasons; |
| 89 } | 89 } |
| 90 void clearMainThreadScrollingReasons() { m_mainThreadScrollingReasons = 0; } | 90 void clearMainThreadScrollingReasons() { m_mainThreadScrollingReasons = 0; } |
| 91 | 91 |
| 92 #if DCHECK_IS_ON() |
| 93 // The clone function is used by FindPropertiesNeedingUpdate.h for recording |
| 94 // a scroll node before it has been updated, to later detect changes. |
| 95 PassRefPtr<ScrollPaintPropertyNode> clone() const { |
| 96 RefPtr<ScrollPaintPropertyNode> cloned = |
| 97 adoptRef(new ScrollPaintPropertyNode( |
| 98 m_parent, m_scrollOffsetTranslation, m_clip, m_bounds, |
| 99 m_userScrollableHorizontal, m_userScrollableVertical)); |
| 100 cloned->addMainThreadScrollingReasons(m_mainThreadScrollingReasons); |
| 101 return cloned; |
| 102 } |
| 103 |
| 104 // The equality operator is used by FindPropertiesNeedingUpdate.h for checking |
| 105 // if a scroll node has changed. |
| 106 bool operator==(const ScrollPaintPropertyNode& o) const { |
| 107 // TODO(pdr): Check main thread scrolling reason equality as well. We do |
| 108 // not yet mark nodes as needing a paint property update on main thread |
| 109 // scrolling reason changes. |
| 110 return m_parent == o.m_parent && |
| 111 m_scrollOffsetTranslation == o.m_scrollOffsetTranslation && |
| 112 m_clip == o.m_clip && m_bounds == o.m_bounds && |
| 113 m_userScrollableHorizontal == o.m_userScrollableHorizontal && |
| 114 m_userScrollableVertical == o.m_userScrollableVertical; |
| 115 } |
| 116 #endif |
| 117 |
| 92 private: | 118 private: |
| 93 ScrollPaintPropertyNode( | 119 ScrollPaintPropertyNode( |
| 94 PassRefPtr<ScrollPaintPropertyNode> parent, | 120 PassRefPtr<ScrollPaintPropertyNode> parent, |
| 95 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, | 121 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, |
| 96 IntSize clip, | 122 IntSize clip, |
| 97 IntSize bounds, | 123 IntSize bounds, |
| 98 bool userScrollableHorizontal, | 124 bool userScrollableHorizontal, |
| 99 bool userScrollableVertical) | 125 bool userScrollableVertical) |
| 100 : m_parent(parent), | 126 : m_parent(parent), |
| 101 m_scrollOffsetTranslation(scrollOffsetTranslation), | 127 m_scrollOffsetTranslation(scrollOffsetTranslation), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 119 // TODO(pdr): Add a bit for whether this is affected by page scale. | 145 // TODO(pdr): Add a bit for whether this is affected by page scale. |
| 120 }; | 146 }; |
| 121 | 147 |
| 122 // Redeclared here to avoid ODR issues. | 148 // Redeclared here to avoid ODR issues. |
| 123 // See platform/testing/PaintPrinters.h. | 149 // See platform/testing/PaintPrinters.h. |
| 124 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*); | 150 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*); |
| 125 | 151 |
| 126 } // namespace blink | 152 } // namespace blink |
| 127 | 153 |
| 128 #endif // ScrollPaintPropertyNode_h | 154 #endif // ScrollPaintPropertyNode_h |
| OLD | NEW |