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 "core/dom/DOMNodeIds.h" | 7 #include "core/dom/DOMNodeIds.h" |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "platform/graphics/CompositorElementId.h" |
10 #include "wtf/PtrUtil.h" | 11 #include "wtf/PtrUtil.h" |
11 #include <memory> | 12 #include <memory> |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 namespace { | 16 namespace { |
16 Element* elementForId(int elementId) | 17 Element* elementForId(int elementId) |
17 { | 18 { |
18 Node* node = DOMNodeIds::nodeForId(elementId); | 19 Node* node = DOMNodeIds::nodeForId(elementId); |
19 ASSERT(node); | 20 ASSERT(node); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (x) | 88 if (x) |
88 m_data->caused_scroll_x = true; | 89 m_data->caused_scroll_x = true; |
89 if (y) | 90 if (y) |
90 m_data->caused_scroll_y = true; | 91 m_data->caused_scroll_y = true; |
91 if (x || y) | 92 if (x || y) |
92 m_data->delta_consumed_for_scroll_sequence = true; | 93 m_data->delta_consumed_for_scroll_sequence = true; |
93 } | 94 } |
94 | 95 |
95 Element* ScrollState::currentNativeScrollingElement() const | 96 Element* ScrollState::currentNativeScrollingElement() const |
96 { | 97 { |
97 uint64_t elementId = m_data->current_native_scrolling_element(); | 98 uint64_t elementId = m_data->current_native_scrolling_element().primaryId; |
98 if (elementId == 0) | 99 if (elementId == 0) |
99 return nullptr; | 100 return nullptr; |
100 return elementForId(elementId); | 101 return elementForId(elementId); |
101 } | 102 } |
102 | 103 |
103 void ScrollState::setCurrentNativeScrollingElement(Element* element) | 104 void ScrollState::setCurrentNativeScrollingElement(Element* element) |
104 { | 105 { |
105 m_data->set_current_native_scrolling_element(DOMNodeIds::idForNode(element))
; | 106 m_data->set_current_native_scrolling_element(createCompositorElementId(DOMNo
deIds::idForNode(element), CompositorSubElementId::Scroll)); |
106 } | 107 } |
107 | 108 |
108 void ScrollState::setCurrentNativeScrollingElementById(int elementId) | 109 void ScrollState::setCurrentNativeScrollingElementById(int elementId) |
109 { | 110 { |
110 m_data->set_current_native_scrolling_element(elementId); | 111 m_data->set_current_native_scrolling_element(createCompositorElementId(eleme
ntId, CompositorSubElementId::Scroll)); |
111 } | 112 } |
112 | 113 |
113 } // namespace blink | 114 } // namespace blink |
OLD | NEW |