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