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 <deque> | 8 #include <deque> |
9 #include <memory> | 9 #include <memory> |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
11 #include "core/CoreExport.h" | 11 #include "core/CoreExport.h" |
| 12 #include "core/dom/Element.h" |
12 #include "core/page/scrolling/ScrollStateInit.h" | 13 #include "core/page/scrolling/ScrollStateInit.h" |
13 #include "platform/bindings/ScriptWrappable.h" | 14 #include "platform/bindings/ScriptWrappable.h" |
14 #include "platform/scroll/ScrollStateData.h" | 15 #include "platform/scroll/ScrollStateData.h" |
15 #include "platform/wtf/Forward.h" | 16 #include "platform/wtf/Forward.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class Element; | 20 class Element; |
20 | 21 |
21 class CORE_EXPORT ScrollState final | 22 class CORE_EXPORT ScrollState final |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 bool shouldPropagate() const { return data_->should_propagate; }; | 65 bool shouldPropagate() const { return data_->should_propagate; }; |
65 | 66 |
66 // Non web exposed methods. | 67 // Non web exposed methods. |
67 void ConsumeDeltaNative(double x, double y); | 68 void ConsumeDeltaNative(double x, double y); |
68 | 69 |
69 // TODO(tdresser): this needs to be web exposed. See crbug.com/483091. | 70 // TODO(tdresser): this needs to be web exposed. See crbug.com/483091. |
70 void SetScrollChain(std::deque<int> scroll_chain) { | 71 void SetScrollChain(std::deque<int> scroll_chain) { |
71 scroll_chain_ = scroll_chain; | 72 scroll_chain_ = scroll_chain; |
72 } | 73 } |
73 | 74 |
74 Element* CurrentNativeScrollingElement() const; | 75 Element* CurrentNativeScrollingElement(); |
75 void SetCurrentNativeScrollingElement(Element*); | 76 void SetCurrentNativeScrollingElement(Element*); |
76 | 77 |
77 void SetCurrentNativeScrollingElementById(int element_id); | |
78 | |
79 bool DeltaConsumedForScrollSequence() const { | 78 bool DeltaConsumedForScrollSequence() const { |
80 return data_->delta_consumed_for_scroll_sequence; | 79 return data_->delta_consumed_for_scroll_sequence; |
81 } | 80 } |
82 | 81 |
83 // Scroll begin and end must propagate to all nodes to ensure | 82 // Scroll begin and end must propagate to all nodes to ensure |
84 // their state is updated. | 83 // their state is updated. |
85 bool FullyConsumed() const { | 84 bool FullyConsumed() const { |
86 return !data_->delta_x && !data_->delta_y && !data_->is_ending && | 85 return !data_->delta_x && !data_->delta_y && !data_->is_ending && |
87 !data_->is_beginning; | 86 !data_->is_beginning; |
88 } | 87 } |
89 | 88 |
90 ScrollStateData* Data() const { return data_.get(); } | 89 ScrollStateData* Data() const { return data_.get(); } |
91 | 90 |
92 DEFINE_INLINE_TRACE() {} | 91 DEFINE_INLINE_TRACE() { visitor->Trace(element_); } |
93 | 92 |
94 private: | 93 private: |
95 ScrollState(); | 94 ScrollState(); |
96 explicit ScrollState(std::unique_ptr<ScrollStateData>); | 95 explicit ScrollState(std::unique_ptr<ScrollStateData>); |
97 | 96 |
98 std::unique_ptr<ScrollStateData> data_; | 97 std::unique_ptr<ScrollStateData> data_; |
99 std::deque<int> scroll_chain_; | 98 std::deque<int> scroll_chain_; |
| 99 Member<Element> element_; |
100 }; | 100 }; |
101 | 101 |
102 } // namespace blink | 102 } // namespace blink |
103 | 103 |
104 #endif // ScrollState_h | 104 #endif // ScrollState_h |
OLD | NEW |