| 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 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 Element* elementForId(int elementId) | 15 Element* elementForId(int elementId) |
| 15 { | 16 { |
| 16 Node* node = DOMNodeIds::nodeForId(elementId); | 17 Node* node = DOMNodeIds::nodeForId(elementId); |
| 17 ASSERT(node); | 18 ASSERT(node); |
| 18 if (!node) | 19 if (!node) |
| 19 return nullptr; | 20 return nullptr; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (x) | 86 if (x) |
| 86 m_data->caused_scroll_x = true; | 87 m_data->caused_scroll_x = true; |
| 87 if (y) | 88 if (y) |
| 88 m_data->caused_scroll_y = true; | 89 m_data->caused_scroll_y = true; |
| 89 if (x || y) | 90 if (x || y) |
| 90 m_data->delta_consumed_for_scroll_sequence = true; | 91 m_data->delta_consumed_for_scroll_sequence = true; |
| 91 } | 92 } |
| 92 | 93 |
| 93 Element* ScrollState::currentNativeScrollingElement() const | 94 Element* ScrollState::currentNativeScrollingElement() const |
| 94 { | 95 { |
| 95 uint64_t elementId = m_data->current_native_scrolling_element(); | 96 uint64_t elementId = m_data->current_native_scrolling_element().value; |
| 96 if (elementId == 0) | 97 if (elementId == 0) |
| 97 return nullptr; | 98 return nullptr; |
| 98 return elementForId(elementId); | 99 return elementForId(elementId); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void ScrollState::setCurrentNativeScrollingElement(Element* element) | 102 void ScrollState::setCurrentNativeScrollingElement(Element* element) |
| 102 { | 103 { |
| 103 m_data->set_current_native_scrolling_element(DOMNodeIds::idForNode(element))
; | 104 m_data->set_current_native_scrolling_element(CompositorElementId(DOMNodeIds:
:idForNode(element))); |
| 104 } | 105 } |
| 105 | 106 |
| 106 void ScrollState::setCurrentNativeScrollingElementById(int elementId) | 107 void ScrollState::setCurrentNativeScrollingElementById(int elementId) |
| 107 { | 108 { |
| 108 m_data->set_current_native_scrolling_element(elementId); | 109 m_data->set_current_native_scrolling_element(CompositorElementId(elementId))
; |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |