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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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() const { |
96 uint64_t element_id = data_->current_native_scrolling_element().primaryId; | 96 uint64_t element_id = DomNodeIdFromCompositorElementId( |
suzyh_UTC10 (ex-contributor)
2017/05/08 01:04:15
DOMNodeId instead of uint64_t? Also consider renam
chrishtr
2017/05/08 16:32:13
Done.
| |
97 if (element_id == 0) | 97 data_->current_native_scrolling_element()); |
98 if (!element_id) | |
98 return nullptr; | 99 return nullptr; |
99 return ElementForId(element_id); | 100 return ElementForId(element_id); |
100 } | 101 } |
101 | 102 |
102 void ScrollState::SetCurrentNativeScrollingElement(Element* element) { | 103 void ScrollState::SetCurrentNativeScrollingElement(Element* element) { |
103 data_->set_current_native_scrolling_element(CreateCompositorElementId( | 104 data_->set_current_native_scrolling_element(CreateCompositorElementId( |
104 DOMNodeIds::IdForNode(element), CompositorSubElementId::kScroll)); | 105 DOMNodeIds::IdForNode(element), CompositorSubElementId::kScroll)); |
105 } | 106 } |
106 | 107 |
107 void ScrollState::SetCurrentNativeScrollingElementById(int element_id) { | 108 void ScrollState::SetCurrentNativeScrollingElementById(int element_id) { |
108 data_->set_current_native_scrolling_element( | 109 data_->set_current_native_scrolling_element( |
109 CreateCompositorElementId(element_id, CompositorSubElementId::kScroll)); | 110 CreateCompositorElementId(element_id, CompositorSubElementId::kScroll)); |
110 } | 111 } |
111 | 112 |
112 } // namespace blink | 113 } // namespace blink |
OLD | NEW |