| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/input/ScrollManager.h" | 5 #include "core/input/ScrollManager.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMNodeIds.h" | 7 #include "core/dom/DOMNodeIds.h" |
| 8 #include "core/events/GestureEvent.h" | 8 #include "core/events/GestureEvent.h" |
| 9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 scrollState.distributeToScrollChainDescendant(); | 187 scrollState.distributeToScrollChainDescendant(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 WebInputEventResult ScrollManager::handleGestureScrollBegin(const PlatformGestur
eEvent& gestureEvent) | 190 WebInputEventResult ScrollManager::handleGestureScrollBegin(const PlatformGestur
eEvent& gestureEvent) |
| 191 { | 191 { |
| 192 Document* document = m_frame->document(); | 192 Document* document = m_frame->document(); |
| 193 | 193 |
| 194 if (document->layoutViewItem().isNull()) | 194 if (document->layoutViewItem().isNull()) |
| 195 return WebInputEventResult::NotHandled; | 195 return WebInputEventResult::NotHandled; |
| 196 | 196 |
| 197 FrameView* view = m_frame->view(); | |
| 198 if (!view) | |
| 199 return WebInputEventResult::NotHandled; | |
| 200 | |
| 201 // If there's no layoutObject on the node, send the event to the nearest anc
estor with a layoutObject. | 197 // If there's no layoutObject on the node, send the event to the nearest anc
estor with a layoutObject. |
| 202 // Needed for <option> and <optgroup> elements so we can touch scroll <selec
t>s | 198 // Needed for <option> and <optgroup> elements so we can touch scroll <selec
t>s |
| 203 while (m_scrollGestureHandlingNode && !m_scrollGestureHandlingNode->layoutOb
ject()) | 199 while (m_scrollGestureHandlingNode && !m_scrollGestureHandlingNode->layoutOb
ject()) |
| 204 m_scrollGestureHandlingNode = m_scrollGestureHandlingNode->parentOrShado
wHostNode(); | 200 m_scrollGestureHandlingNode = m_scrollGestureHandlingNode->parentOrShado
wHostNode(); |
| 205 | 201 |
| 206 if (!m_scrollGestureHandlingNode) | 202 if (!m_scrollGestureHandlingNode) |
| 207 m_scrollGestureHandlingNode = m_frame->document()->documentElement(); | 203 m_scrollGestureHandlingNode = m_frame->document()->documentElement(); |
| 208 | 204 |
| 209 if (!m_scrollGestureHandlingNode) | 205 if (!m_scrollGestureHandlingNode) |
| 210 return WebInputEventResult::NotHandled; | 206 return WebInputEventResult::NotHandled; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 345 |
| 350 if (!node.isElementNode()) | 346 if (!node.isElementNode()) |
| 351 return false; | 347 return false; |
| 352 | 348 |
| 353 return node.isSameNode(m_frame->document()->effectiveRootScroller()); | 349 return node.isSameNode(m_frame->document()->effectiveRootScroller()); |
| 354 } | 350 } |
| 355 | 351 |
| 356 | 352 |
| 357 WebInputEventResult ScrollManager::handleGestureScrollEvent(const PlatformGestur
eEvent& gestureEvent) | 353 WebInputEventResult ScrollManager::handleGestureScrollEvent(const PlatformGestur
eEvent& gestureEvent) |
| 358 { | 354 { |
| 355 if (!m_frame->view()) |
| 356 return WebInputEventResult::NotHandled; |
| 357 |
| 359 Node* eventTarget = nullptr; | 358 Node* eventTarget = nullptr; |
| 360 Scrollbar* scrollbar = nullptr; | 359 Scrollbar* scrollbar = nullptr; |
| 361 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { | 360 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { |
| 362 scrollbar = m_scrollbarHandlingScrollGesture.get(); | 361 scrollbar = m_scrollbarHandlingScrollGesture.get(); |
| 363 eventTarget = m_scrollGestureHandlingNode.get(); | 362 eventTarget = m_scrollGestureHandlingNode.get(); |
| 364 } | 363 } |
| 365 | 364 |
| 366 if (!eventTarget) { | 365 if (!eventTarget) { |
| 367 Document* document = m_frame->document(); | 366 Document* document = m_frame->document(); |
| 368 if (document->layoutViewItem().isNull()) | 367 if (document->layoutViewItem().isNull()) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 DEFINE_TRACE(ScrollManager) | 503 DEFINE_TRACE(ScrollManager) |
| 505 { | 504 { |
| 506 visitor->trace(m_frame); | 505 visitor->trace(m_frame); |
| 507 visitor->trace(m_scrollGestureHandlingNode); | 506 visitor->trace(m_scrollGestureHandlingNode); |
| 508 visitor->trace(m_previousGestureScrolledNode); | 507 visitor->trace(m_previousGestureScrolledNode); |
| 509 visitor->trace(m_scrollbarHandlingScrollGesture); | 508 visitor->trace(m_scrollbarHandlingScrollGesture); |
| 510 visitor->trace(m_resizeScrollableArea); | 509 visitor->trace(m_resizeScrollableArea); |
| 511 } | 510 } |
| 512 | 511 |
| 513 } // namespace blink | 512 } // namespace blink |
| OLD | NEW |