| 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 ScrollState_h | 5 #ifndef ScrollState_h |
| 6 #define ScrollState_h | 6 #define ScrollState_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "core/page/scrolling/ScrollStateInit.h" | 11 #include "core/page/scrolling/ScrollStateInit.h" |
| 12 #include "platform/scroll/ScrollStateData.h" | 12 #include "platform/scroll/ScrollStateData.h" |
| 13 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
| 14 #include <deque> | 14 #include <deque> |
| 15 #include <memory> |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 class Element; | 19 class Element; |
| 19 | 20 |
| 20 class CORE_EXPORT ScrollState final : public GarbageCollectedFinalized<ScrollSta
te>, public ScriptWrappable { | 21 class CORE_EXPORT ScrollState final : public GarbageCollectedFinalized<ScrollSta
te>, public ScriptWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 22 | 23 |
| 23 public: | 24 public: |
| 24 static ScrollState* create(ScrollStateInit); | 25 static ScrollState* create(ScrollStateInit); |
| 25 static ScrollState* create(PassOwnPtr<ScrollStateData>); | 26 static ScrollState* create(std::unique_ptr<ScrollStateData>); |
| 26 | 27 |
| 27 ~ScrollState() | 28 ~ScrollState() |
| 28 { | 29 { |
| 29 } | 30 } |
| 30 | 31 |
| 31 // Web exposed methods. | 32 // Web exposed methods. |
| 32 | 33 |
| 33 // Reduce deltas by x, y. | 34 // Reduce deltas by x, y. |
| 34 void consumeDelta(double x, double y, ExceptionState&); | 35 void consumeDelta(double x, double y, ExceptionState&); |
| 35 // Pops the first element off of |m_scrollChain| and calls |distributeScroll
| on it. | 36 // Pops the first element off of |m_scrollChain| and calls |distributeScroll
| on it. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 { | 86 { |
| 86 return !m_data->delta_x && !m_data->delta_y && !m_data->is_ending && !m_
data->is_beginning; | 87 return !m_data->delta_x && !m_data->delta_y && !m_data->is_ending && !m_
data->is_beginning; |
| 87 } | 88 } |
| 88 | 89 |
| 89 ScrollStateData* data() const { return m_data.get(); } | 90 ScrollStateData* data() const { return m_data.get(); } |
| 90 | 91 |
| 91 DEFINE_INLINE_TRACE() {} | 92 DEFINE_INLINE_TRACE() {} |
| 92 | 93 |
| 93 private: | 94 private: |
| 94 ScrollState(); | 95 ScrollState(); |
| 95 explicit ScrollState(PassOwnPtr<ScrollStateData>); | 96 explicit ScrollState(std::unique_ptr<ScrollStateData>); |
| 96 | 97 |
| 97 OwnPtr<ScrollStateData> m_data; | 98 std::unique_ptr<ScrollStateData> m_data; |
| 98 std::deque<int> m_scrollChain; | 99 std::deque<int> m_scrollChain; |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace blink | 102 } // namespace blink |
| 102 | 103 |
| 103 #endif // ScrollState_h | 104 #endif // ScrollState_h |
| OLD | NEW |