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