| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // is on a mouse press. The problem is the <embed> node only starts | 378 // is on a mouse press. The problem is the <embed> node only starts |
| 379 // capturing mouse events *after* m_mousePressed for the containing frame | 379 // capturing mouse events *after* m_mousePressed for the containing frame |
| 380 // has already been set to true. As a result, the frame's EventHandler | 380 // has already been set to true. As a result, the frame's EventHandler |
| 381 // never sees the mouse release event, which is supposed to reset | 381 // never sees the mouse release event, which is supposed to reset |
| 382 // m_mousePressed... so m_mousePressed ends up remaining true until the | 382 // m_mousePressed... so m_mousePressed ends up remaining true until the |
| 383 // event handler finally gets another mouse released event. Oops. | 383 // event handler finally gets another mouse released event. Oops. |
| 384 // 2. Dragging doesn't start until after a mouse press event, but a drag | 384 // 2. Dragging doesn't start until after a mouse press event, but a drag |
| 385 // that ends as a result of a mouse release does not send a mouse release | 385 // that ends as a result of a mouse release does not send a mouse release |
| 386 // event. As a result, m_mousePressed also ends up remaining true until | 386 // event. As a result, m_mousePressed also ends up remaining true until |
| 387 // the next mouse release event seen by the EventHandler. | 387 // the next mouse release event seen by the EventHandler. |
| 388 if (event.event().button() != LeftButton) | 388 if (event.event().pointerProperties().button != WebPointerProperties::Button
::Left) |
| 389 m_mousePressed = false; | 389 m_mousePressed = false; |
| 390 | 390 |
| 391 if (!m_mousePressed) | 391 if (!m_mousePressed) |
| 392 return WebInputEventResult::NotHandled; | 392 return WebInputEventResult::NotHandled; |
| 393 | 393 |
| 394 if (handleDrag(event, DragInitiator::Mouse)) | 394 if (handleDrag(event, DragInitiator::Mouse)) |
| 395 return WebInputEventResult::HandledSystem; | 395 return WebInputEventResult::HandledSystem; |
| 396 | 396 |
| 397 Node* targetNode = event.innerNode(); | 397 Node* targetNode = event.innerNode(); |
| 398 if (!targetNode) | 398 if (!targetNode) |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame
; | 771 return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame
; |
| 772 } | 772 } |
| 773 | 773 |
| 774 WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
& mouseEvent) | 774 WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
& mouseEvent) |
| 775 { | 775 { |
| 776 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); | 776 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); |
| 777 | 777 |
| 778 // For 4th/5th button in the mouse since Chrome does not yet send | 778 // For 4th/5th button in the mouse since Chrome does not yet send |
| 779 // button value to Blink but in some cases it does send the event. | 779 // button value to Blink but in some cases it does send the event. |
| 780 // This check is needed to suppress such an event (crbug.com/574959) | 780 // This check is needed to suppress such an event (crbug.com/574959) |
| 781 if (mouseEvent.button() == NoButton) | 781 if (mouseEvent.pointerProperties().button == WebPointerProperties::Button::N
oButton) |
| 782 return WebInputEventResult::HandledSuppressed; | 782 return WebInputEventResult::HandledSuppressed; |
| 783 | 783 |
| 784 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 784 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 785 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken =
UserGestureIndicator::currentToken(); | 785 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken =
UserGestureIndicator::currentToken(); |
| 786 | 786 |
| 787 cancelFakeMouseMoveEvent(); | 787 cancelFakeMouseMoveEvent(); |
| 788 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 788 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 789 m_capturingMouseEventsNode = nullptr; | 789 m_capturingMouseEventsNode = nullptr; |
| 790 m_mousePressed = true; | 790 m_mousePressed = true; |
| 791 m_capturesDragging = true; | 791 m_capturesDragging = true; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Ac
tive); | 893 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Ac
tive); |
| 894 mev = m_frame->document()->prepareMouseEvent(request, documentPoint,
mouseEvent); | 894 mev = m_frame->document()->prepareMouseEvent(request, documentPoint,
mouseEvent); |
| 895 } | 895 } |
| 896 | 896 |
| 897 if (passMousePressEventToScrollbar(mev)) | 897 if (passMousePressEventToScrollbar(mev)) |
| 898 eventResult = WebInputEventResult::HandledSystem; | 898 eventResult = WebInputEventResult::HandledSystem; |
| 899 else | 899 else |
| 900 eventResult = handleMousePressEvent(mev); | 900 eventResult = handleMousePressEvent(mev); |
| 901 } | 901 } |
| 902 | 902 |
| 903 if (mev.hitTestResult().innerNode() && mouseEvent.button() == LeftButton) { | 903 if (mev.hitTestResult().innerNode() && mouseEvent.pointerProperties().button
== WebPointerProperties::Button::Left) { |
| 904 ASSERT(mouseEvent.type() == PlatformEvent::MousePressed); | 904 ASSERT(mouseEvent.type() == PlatformEvent::MousePressed); |
| 905 HitTestResult result = mev.hitTestResult(); | 905 HitTestResult result = mev.hitTestResult(); |
| 906 result.setToShadowHostIfInUserAgentShadowRoot(); | 906 result.setToShadowHostIfInUserAgentShadowRoot(); |
| 907 m_frame->chromeClient().onMouseDown(result.innerNode()); | 907 m_frame->chromeClient().onMouseDown(result.innerNode()); |
| 908 } | 908 } |
| 909 | 909 |
| 910 return eventResult; | 910 return eventResult; |
| 911 } | 911 } |
| 912 | 912 |
| 913 static PaintLayer* layerForNode(Node* node) | 913 static PaintLayer* layerForNode(Node* node) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 return FlatTreeTraversal::parent(node); | 1093 return FlatTreeTraversal::parent(node); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
nt& mouseEvent) | 1096 WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
nt& mouseEvent) |
| 1097 { | 1097 { |
| 1098 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); | 1098 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); |
| 1099 | 1099 |
| 1100 // For 4th/5th button in the mouse since Chrome does not yet send | 1100 // For 4th/5th button in the mouse since Chrome does not yet send |
| 1101 // button value to Blink but in some cases it does send the event. | 1101 // button value to Blink but in some cases it does send the event. |
| 1102 // This check is needed to suppress such an event (crbug.com/574959) | 1102 // This check is needed to suppress such an event (crbug.com/574959) |
| 1103 if (mouseEvent.button() == NoButton) | 1103 if (mouseEvent.pointerProperties().button == WebPointerProperties::Button::N
oButton) |
| 1104 return WebInputEventResult::HandledSuppressed; | 1104 return WebInputEventResult::HandledSuppressed; |
| 1105 | 1105 |
| 1106 if (!mouseEvent.fromTouch()) | 1106 if (!mouseEvent.fromTouch()) |
| 1107 m_frame->selection().setCaretBlinkingSuspended(false); | 1107 m_frame->selection().setCaretBlinkingSuspended(false); |
| 1108 | 1108 |
| 1109 std::unique_ptr<UserGestureIndicator> gestureIndicator; | 1109 std::unique_ptr<UserGestureIndicator> gestureIndicator; |
| 1110 | 1110 |
| 1111 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke
n) | 1111 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke
n) |
| 1112 gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFra
meRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); | 1112 gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFra
meRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); |
| 1113 else | 1113 else |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1143 HitTestRequest request(hitType); | 1143 HitTestRequest request(hitType); |
| 1144 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1144 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
| 1145 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN
ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1145 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN
ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
| 1146 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1146 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 1147 m_capturingMouseEventsNode = nullptr; | 1147 m_capturingMouseEventsNode = nullptr; |
| 1148 if (subframe) | 1148 if (subframe) |
| 1149 return passMouseReleaseEventToSubframe(mev, subframe); | 1149 return passMouseReleaseEventToSubframe(mev, subframe); |
| 1150 | 1150 |
| 1151 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event
TypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event()); | 1151 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event
TypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event()); |
| 1152 | 1152 |
| 1153 bool contextMenuEvent = mouseEvent.button() == RightButton; | 1153 bool contextMenuEvent = mouseEvent.pointerProperties().button == WebPointerP
roperties::Button::Right; |
| 1154 #if OS(MACOSX) | 1154 #if OS(MACOSX) |
| 1155 // FIXME: The Mac port achieves the same behavior by checking whether the co
ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl
ementations. | 1155 // FIXME: The Mac port achieves the same behavior by checking whether the co
ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl
ementations. |
| 1156 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor
mEvent::CtrlKey) | 1156 if (mouseEvent.pointerProperties().button == WebPointerProperties::Button::L
eft |
| 1157 && mouseEvent.getModifiers() & PlatformEvent::CtrlKey) |
| 1157 contextMenuEvent = true; | 1158 contextMenuEvent = true; |
| 1158 #endif | 1159 #endif |
| 1159 | 1160 |
| 1160 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; | 1161 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; |
| 1161 const bool shouldDispatchClickEvent = m_clickCount > 0 | 1162 const bool shouldDispatchClickEvent = m_clickCount > 0 |
| 1162 && !contextMenuEvent | 1163 && !contextMenuEvent |
| 1163 && mev.innerNode() && m_clickNode | 1164 && mev.innerNode() && m_clickNode |
| 1164 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic
ipateInFlatTree() | 1165 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic
ipateInFlatTree() |
| 1165 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev
)); | 1166 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev
)); |
| 1166 if (shouldDispatchClickEvent) { | 1167 if (shouldDispatchClickEvent) { |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 || mouseEventType == EventTypeNames::mousemove | 1509 || mouseEventType == EventTypeNames::mousemove |
| 1509 || mouseEventType == EventTypeNames::mouseup); | 1510 || mouseEventType == EventTypeNames::mouseup); |
| 1510 | 1511 |
| 1511 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent
); | 1512 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent
); |
| 1512 | 1513 |
| 1513 if (mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch) | 1514 if (mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch) |
| 1514 return dispatchMouseEvent(mouseEventType, m_nodeUnderMouse, clickCount,
mouseEvent); | 1515 return dispatchMouseEvent(mouseEventType, m_nodeUnderMouse, clickCount,
mouseEvent); |
| 1515 | 1516 |
| 1516 Node* newNodeUnderMouse = nullptr; | 1517 Node* newNodeUnderMouse = nullptr; |
| 1517 const auto& eventResult = m_pointerEventManager.sendMousePointerEvent( | 1518 const auto& eventResult = m_pointerEventManager.sendMousePointerEvent( |
| 1518 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr, | 1519 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, |
| 1519 lastNodeUnderMouse, &newNodeUnderMouse); | 1520 lastNodeUnderMouse, &newNodeUnderMouse); |
| 1520 m_nodeUnderMouse = newNodeUnderMouse; | 1521 m_nodeUnderMouse = newNodeUnderMouse; |
| 1521 return eventResult; | 1522 return eventResult; |
| 1522 } | 1523 } |
| 1523 | 1524 |
| 1524 void EventHandler::setClickNode(Node* node) | 1525 void EventHandler::setClickNode(Node* node) |
| 1525 { | 1526 { |
| 1526 m_clickNode = node; | 1527 m_clickNode = node; |
| 1527 } | 1528 } |
| 1528 | 1529 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 exitedFrameChain.append(exitedFrameInDocument); | 1887 exitedFrameChain.append(exitedFrameInDocument); |
| 1887 else if (nextExitedFrameInDocument && indexEnteredFrameChain) | 1888 else if (nextExitedFrameInDocument && indexEnteredFrameChain) |
| 1888 --indexEnteredFrameChain; | 1889 --indexEnteredFrameChain; |
| 1889 } | 1890 } |
| 1890 exitedFrameInDocument = nextExitedFrameInDocument; | 1891 exitedFrameInDocument = nextExitedFrameInDocument; |
| 1891 } | 1892 } |
| 1892 | 1893 |
| 1893 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 1894 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 1894 unsigned modifiers = gestureEvent.getModifiers(); | 1895 unsigned modifiers = gestureEvent.getModifiers(); |
| 1895 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa
lPosition(), | 1896 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa
lPosition(), |
| 1896 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | 1897 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, /* cl
ickCount */ 0, |
| 1897 static_cast<PlatformEvent::Modifiers>(modifiers), | 1898 static_cast<PlatformEvent::Modifiers>(modifiers), |
| 1898 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); | 1899 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); |
| 1899 | 1900 |
| 1900 // Update the mouseout/mouseleave event | 1901 // Update the mouseout/mouseleave event |
| 1901 size_t indexExitedFrameChain = exitedFrameChain.size(); | 1902 size_t indexExitedFrameChain = exitedFrameChain.size(); |
| 1902 while (indexExitedFrameChain) { | 1903 while (indexExitedFrameChain) { |
| 1903 LocalFrame* leaveFrame = exitedFrameChain[--indexExitedFrameChain]; | 1904 LocalFrame* leaveFrame = exitedFrameChain[--indexExitedFrameChain]; |
| 1904 leaveFrame->eventHandler().updateMouseEventTargetNodeAndSendEvents(nullp
tr, fakeMouseMove); | 1905 leaveFrame->eventHandler().updateMouseEventTargetNodeAndSendEvents(nullp
tr, fakeMouseMove); |
| 1905 } | 1906 } |
| 1906 | 1907 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 result.setInnerNode(targetNode); | 2095 result.setInnerNode(targetNode); |
| 2095 doc->updateHoverActiveState(request, result.innerElement()); | 2096 doc->updateHoverActiveState(request, result.innerElement()); |
| 2096 | 2097 |
| 2097 // The contextmenu event is a mouse event even when invoked using the keyboa
rd. | 2098 // The contextmenu event is a mouse event even when invoked using the keyboa
rd. |
| 2098 // This is required for web compatibility. | 2099 // This is required for web compatibility. |
| 2099 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; | 2100 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; |
| 2100 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) | 2101 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) |
| 2101 eventType = PlatformEvent::MouseReleased; | 2102 eventType = PlatformEvent::MouseReleased; |
| 2102 | 2103 |
| 2103 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, | 2104 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, |
| 2104 RightButton, eventType, 1, | 2105 WebPointerProperties::Button::Right, eventType, 1, |
| 2105 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, | 2106 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, |
| 2106 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M
ouse); | 2107 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M
ouse); |
| 2107 | 2108 |
| 2108 return sendContextMenuEvent(mouseEvent, overrideTargetElement); | 2109 return sendContextMenuEvent(mouseEvent, overrideTargetElement); |
| 2109 } | 2110 } |
| 2110 | 2111 |
| 2111 void EventHandler::scheduleHoverStateUpdate() | 2112 void EventHandler::scheduleHoverStateUpdate() |
| 2112 { | 2113 { |
| 2113 if (!m_hoverTimer.isActive()) | 2114 if (!m_hoverTimer.isActive()) |
| 2114 m_hoverTimer.startOneShot(0, BLINK_FROM_HERE); | 2115 m_hoverTimer.startOneShot(0, BLINK_FROM_HERE); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 if (!view) | 2175 if (!view) |
| 2175 return; | 2176 return; |
| 2176 | 2177 |
| 2177 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) | 2178 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) |
| 2178 return; | 2179 return; |
| 2179 | 2180 |
| 2180 // Don't dispatch a synthetic mouse move event if the mouse cursor is not vi
sible to the user. | 2181 // Don't dispatch a synthetic mouse move event if the mouse cursor is not vi
sible to the user. |
| 2181 if (!isCursorVisible()) | 2182 if (!isCursorVisible()) |
| 2182 return; | 2183 return; |
| 2183 | 2184 |
| 2184 PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownM
ouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, PlatformKeyboardEven
t::getCurrentModifierState(), PlatformMouseEvent::RealOrIndistinguishable, monot
onicallyIncreasingTime(), WebPointerProperties::PointerType::Mouse); | 2185 PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownM
ouseGlobalPosition, WebPointerProperties::Button::NoButton, PlatformEvent::Mouse
Moved, 0, PlatformKeyboardEvent::getCurrentModifierState(), PlatformMouseEvent::
RealOrIndistinguishable, monotonicallyIncreasingTime(), WebPointerProperties::Po
interType::Mouse); |
| 2185 handleMouseMoveEvent(fakeMouseMoveEvent); | 2186 handleMouseMoveEvent(fakeMouseMoveEvent); |
| 2186 } | 2187 } |
| 2187 | 2188 |
| 2188 void EventHandler::cancelFakeMouseMoveEvent() | 2189 void EventHandler::cancelFakeMouseMoveEvent() |
| 2189 { | 2190 { |
| 2190 m_fakeMouseMoveEventTimer.stop(); | 2191 m_fakeMouseMoveEventTimer.stop(); |
| 2191 } | 2192 } |
| 2192 | 2193 |
| 2193 bool EventHandler::isCursorVisible() const | 2194 bool EventHandler::isCursorVisible() const |
| 2194 { | 2195 { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2331 | 2332 |
| 2332 bool EventHandler::handleDragDropIfPossible(const GestureEventWithHitTestResults
& targetedEvent) | 2333 bool EventHandler::handleDragDropIfPossible(const GestureEventWithHitTestResults
& targetedEvent) |
| 2333 { | 2334 { |
| 2334 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_
frame->view()) { | 2335 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_
frame->view()) { |
| 2335 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2336 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 2336 IntPoint adjustedPoint = gestureEvent.position(); | 2337 IntPoint adjustedPoint = gestureEvent.position(); |
| 2337 unsigned modifiers = gestureEvent.getModifiers(); | 2338 unsigned modifiers = gestureEvent.getModifiers(); |
| 2338 | 2339 |
| 2339 // TODO(mustaq): Suppressing long-tap MouseEvents could break | 2340 // TODO(mustaq): Suppressing long-tap MouseEvents could break |
| 2340 // drag-drop. Will do separately because of the risk. crbug.com/606938. | 2341 // drag-drop. Will do separately because of the risk. crbug.com/606938. |
| 2341 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MousePressed, 1, | 2342 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi
tion(), WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 1, |
| 2342 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), | 2343 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), |
| 2343 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); | 2344 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); |
| 2344 m_mouseDown = mouseDownEvent; | 2345 m_mouseDown = mouseDownEvent; |
| 2345 | 2346 |
| 2346 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, | 2347 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), WebPointerProperties::Button::Left, PlatformEvent::MouseMoved, 1, |
| 2347 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), | 2348 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), |
| 2348 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); | 2349 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); |
| 2349 HitTestRequest request(HitTestRequest::ReadOnly); | 2350 HitTestRequest request(HitTestRequest::ReadOnly); |
| 2350 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); | 2351 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); |
| 2351 m_mouseDownMayStartDrag = true; | 2352 m_mouseDownMayStartDrag = true; |
| 2352 dragState().m_dragSrc = nullptr; | 2353 dragState().m_dragSrc = nullptr; |
| 2353 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos
ition()); | 2354 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos
ition()); |
| 2354 return handleDrag(mev, DragInitiator::Touch); | 2355 return handleDrag(mev, DragInitiator::Touch); |
| 2355 } | 2356 } |
| 2356 return false; | 2357 return false; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 | 2593 |
| 2593 FrameHost* EventHandler::frameHost() const | 2594 FrameHost* EventHandler::frameHost() const |
| 2594 { | 2595 { |
| 2595 if (!m_frame->page()) | 2596 if (!m_frame->page()) |
| 2596 return nullptr; | 2597 return nullptr; |
| 2597 | 2598 |
| 2598 return &m_frame->page()->frameHost(); | 2599 return &m_frame->page()->frameHost(); |
| 2599 } | 2600 } |
| 2600 | 2601 |
| 2601 } // namespace blink | 2602 } // namespace blink |
| OLD | NEW |