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 #include "core/page/scrolling/ScrollState.h" | 5 #include "core/page/scrolling/ScrollState.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/dom/DOMNodeIds.h" | 8 #include "core/dom/DOMNodeIds.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 data_->delta_y -= y; | 85 data_->delta_y -= y; |
86 | 86 |
87 if (x) | 87 if (x) |
88 data_->caused_scroll_x = true; | 88 data_->caused_scroll_x = true; |
89 if (y) | 89 if (y) |
90 data_->caused_scroll_y = true; | 90 data_->caused_scroll_y = true; |
91 if (x || y) | 91 if (x || y) |
92 data_->delta_consumed_for_scroll_sequence = true; | 92 data_->delta_consumed_for_scroll_sequence = true; |
93 } | 93 } |
94 | 94 |
95 Element* ScrollState::CurrentNativeScrollingElement() const { | 95 Element* ScrollState::CurrentNativeScrollingElement() { |
96 uint64_t dom_node_id = | 96 if (data_->current_native_scrolling_element() == CompositorElementId()) { |
97 IdFromCompositorElementId(data_->current_native_scrolling_element()); | 97 element_.Clear(); |
98 if (dom_node_id == kInvalidDOMNodeId) | |
99 return nullptr; | 98 return nullptr; |
100 return ElementForId(dom_node_id); | 99 } |
| 100 return element_; |
101 } | 101 } |
102 | 102 |
103 void ScrollState::SetCurrentNativeScrollingElement(Element* element) { | 103 void ScrollState::SetCurrentNativeScrollingElement(Element* element) { |
| 104 element_ = element; |
104 data_->set_current_native_scrolling_element(CompositorElementIdFromDOMNodeId( | 105 data_->set_current_native_scrolling_element(CompositorElementIdFromDOMNodeId( |
105 DOMNodeIds::IdForNode(element), CompositorElementIdNamespace::kScroll)); | 106 DOMNodeIds::IdForNode(element), CompositorElementIdNamespace::kScroll)); |
106 } | 107 } |
107 | 108 |
108 void ScrollState::SetCurrentNativeScrollingElementById(int element_id) { | |
109 data_->set_current_native_scrolling_element(CompositorElementIdFromDOMNodeId( | |
110 element_id, CompositorElementIdNamespace::kScroll)); | |
111 } | |
112 | |
113 } // namespace blink | 109 } // namespace blink |
OLD | NEW |