| 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/MouseEventManager.h" | 5 #include "core/input/MouseEventManager.h" |
| 6 | 6 |
| 7 #include "core/clipboard/DataObject.h" | 7 #include "core/clipboard/DataObject.h" |
| 8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
| 11 #include "core/dom/TaskRunnerHelper.h" | 11 #include "core/dom/TaskRunnerHelper.h" |
| 12 #include "core/editing/FrameSelection.h" | 12 #include "core/editing/FrameSelection.h" |
| 13 #include "core/editing/SelectionController.h" | 13 #include "core/editing/SelectionController.h" |
| 14 #include "core/events/DragEvent.h" | 14 #include "core/events/DragEvent.h" |
| 15 #include "core/events/MouseEvent.h" | 15 #include "core/events/MouseEvent.h" |
| 16 #include "core/frame/FrameView.h" | 16 #include "core/frame/FrameView.h" |
| 17 #include "core/frame/LocalFrame.h" | 17 #include "core/frame/LocalFrame.h" |
| 18 #include "core/frame/Settings.h" | 18 #include "core/frame/Settings.h" |
| 19 #include "core/html/HTMLCanvasElement.h" | 19 #include "core/html/HTMLCanvasElement.h" |
| 20 #include "core/input/EventHandler.h" | 20 #include "core/input/EventHandler.h" |
| 21 #include "core/input/EventHandlingUtil.h" | 21 #include "core/input/EventHandlingUtil.h" |
| 22 #include "core/input/InputDeviceCapabilities.h" | |
| 23 #include "core/input/KeyboardEventManager.h" | 22 #include "core/input/KeyboardEventManager.h" |
| 24 #include "core/layout/HitTestResult.h" | 23 #include "core/layout/HitTestResult.h" |
| 25 #include "core/layout/api/LayoutViewItem.h" | 24 #include "core/layout/api/LayoutViewItem.h" |
| 26 #include "core/page/AutoscrollController.h" | 25 #include "core/page/AutoscrollController.h" |
| 27 #include "core/page/DragController.h" | 26 #include "core/page/DragController.h" |
| 28 #include "core/page/DragState.h" | 27 #include "core/page/DragState.h" |
| 29 #include "core/page/FocusController.h" | 28 #include "core/page/FocusController.h" |
| 30 #include "core/paint/PaintLayer.h" | 29 #include "core/paint/PaintLayer.h" |
| 31 #include "core/svg/SVGDocumentExtensions.h" | 30 #include "core/svg/SVGDocumentExtensions.h" |
| 32 #include "platform/geometry/FloatQuad.h" | 31 #include "platform/geometry/FloatQuad.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 m_clickNode = nullptr; | 387 m_clickNode = nullptr; |
| 389 } | 388 } |
| 390 } | 389 } |
| 391 | 390 |
| 392 Node* MouseEventManager::getNodeUnderMouse() { | 391 Node* MouseEventManager::getNodeUnderMouse() { |
| 393 return m_nodeUnderMouse; | 392 return m_nodeUnderMouse; |
| 394 } | 393 } |
| 395 | 394 |
| 396 WebInputEventResult MouseEventManager::handleMouseFocus( | 395 WebInputEventResult MouseEventManager::handleMouseFocus( |
| 397 const HitTestResult& hitTestResult, | 396 const HitTestResult& hitTestResult, |
| 398 InputDeviceCapabilities* sourceCapabilities) { | 397 const InputDeviceCapabilitiesValue& sourceCapabilities) { |
| 399 // If clicking on a frame scrollbar, do not mess up with content focus. | 398 // If clicking on a frame scrollbar, do not mess up with content focus. |
| 400 if (hitTestResult.scrollbar() && !m_frame->contentLayoutItem().isNull()) { | 399 if (hitTestResult.scrollbar() && !m_frame->contentLayoutItem().isNull()) { |
| 401 if (hitTestResult.scrollbar()->getScrollableArea() == | 400 if (hitTestResult.scrollbar()->getScrollableArea() == |
| 402 m_frame->contentLayoutItem().getScrollableArea()) | 401 m_frame->contentLayoutItem().getScrollableArea()) |
| 403 return WebInputEventResult::NotHandled; | 402 return WebInputEventResult::NotHandled; |
| 404 } | 403 } |
| 405 | 404 |
| 406 // The layout needs to be up to date to determine if an element is focusable. | 405 // The layout needs to be up to date to determine if an element is focusable. |
| 407 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 406 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 408 | 407 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 // If the host has a focusable inner element, focus it. Otherwise, the host | 480 // If the host has a focusable inner element, focus it. Otherwise, the host |
| 482 // takes focus. | 481 // takes focus. |
| 483 Page* page = m_frame->page(); | 482 Page* page = m_frame->page(); |
| 484 DCHECK(page); | 483 DCHECK(page); |
| 485 Element* found = | 484 Element* found = |
| 486 page->focusController().findFocusableElementInShadowHost(element); | 485 page->focusController().findFocusableElementInShadowHost(element); |
| 487 if (found && element.isShadowIncludingInclusiveAncestorOf(found)) { | 486 if (found && element.isShadowIncludingInclusiveAncestorOf(found)) { |
| 488 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean the | 487 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean the |
| 489 // focus has slided. | 488 // focus has slided. |
| 490 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, | 489 found->focus(FocusParams(SelectionBehaviorOnFocus::Reset, |
| 491 WebFocusTypeForward, nullptr)); | 490 WebFocusTypeForward, |
| 491 InputDeviceCapabilities::Null)); |
| 492 return true; | 492 return true; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 return false; | 495 return false; |
| 496 } | 496 } |
| 497 | 497 |
| 498 void MouseEventManager::handleMousePressEventUpdateStates( | 498 void MouseEventManager::handleMousePressEventUpdateStates( |
| 499 const WebMouseEvent& mouseEvent) { | 499 const WebMouseEvent& mouseEvent) { |
| 500 cancelFakeMouseMoveEvent(); | 500 cancelFakeMouseMoveEvent(); |
| 501 m_mousePressed = true; | 501 m_mousePressed = true; |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 void MouseEventManager::setClickCount(int clickCount) { | 1004 void MouseEventManager::setClickCount(int clickCount) { |
| 1005 m_clickCount = clickCount; | 1005 m_clickCount = clickCount; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 bool MouseEventManager::mouseDownMayStartDrag() { | 1008 bool MouseEventManager::mouseDownMayStartDrag() { |
| 1009 return m_mouseDownMayStartDrag; | 1009 return m_mouseDownMayStartDrag; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 } // namespace blink | 1012 } // namespace blink |
| OLD | NEW |