Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 2245063006: Revert of Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix patch apply Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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().pointerProperties().button != WebPointerProperties::Button ::Left) 388 if (event.event().button() != LeftButton)
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
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.pointerProperties().button == WebPointerProperties::Button::N oButton) 781 if (mouseEvent.button() == NoButton)
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
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.pointerProperties().button == WebPointerProperties::Button::Left) { 903 if (mev.hitTestResult().innerNode() && mouseEvent.button() == LeftButton) {
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
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.pointerProperties().button == WebPointerProperties::Button::N oButton) 1103 if (mouseEvent.button() == NoButton)
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // We only prevent click event when the click may cause contextmenu to popup . 1153 // We only prevent click event when the click may cause contextmenu to popup .
1154 // However, we always send auxclick. 1154 // However, we always send auxclick.
1155 bool contextMenuEvent = !RuntimeEnabledFeatures::auxclickEnabled() 1155 bool contextMenuEvent = !RuntimeEnabledFeatures::auxclickEnabled() && mouseE vent.button() == RightButton;
1156 && mouseEvent.pointerProperties().button == WebPointerProperties::Button ::Right;
1157 #if OS(MACOSX) 1156 #if OS(MACOSX)
1158 // 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. 1157 // 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.
1159 if (mouseEvent.pointerProperties().button == WebPointerProperties::Button::L eft 1158 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor mEvent::CtrlKey)
1160 && mouseEvent.getModifiers() & PlatformEvent::CtrlKey)
1161 contextMenuEvent = true; 1159 contextMenuEvent = true;
1162 #endif 1160 #endif
1163 1161
1164 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; 1162 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled;
1165 const bool shouldDispatchClickEvent = m_clickCount > 0 1163 const bool shouldDispatchClickEvent = m_clickCount > 0
1166 && !contextMenuEvent 1164 && !contextMenuEvent
1167 && mev.innerNode() && m_clickNode 1165 && mev.innerNode() && m_clickNode
1168 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic ipateInFlatTree() 1166 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic ipateInFlatTree()
1169 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev )); 1167 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev ));
1170 if (shouldDispatchClickEvent) { 1168 if (shouldDispatchClickEvent) {
1171 Node* clickTargetNode = nullptr; 1169 Node* clickTargetNode = nullptr;
1172 // Updates distribution because a 'mouseup' event listener can make the 1170 // Updates distribution because a 'mouseup' event listener can make the
1173 // tree dirty at dispatchMouseEvent() invocation above. 1171 // tree dirty at dispatchMouseEvent() invocation above.
1174 // Unless distribution is updated, commonAncestor would hit ASSERT. 1172 // Unless distribution is updated, commonAncestor would hit ASSERT.
1175 if (m_clickNode == mev.innerNode()) { 1173 if (m_clickNode == mev.innerNode()) {
1176 clickTargetNode = m_clickNode; 1174 clickTargetNode = m_clickNode;
1177 clickTargetNode->updateDistribution(); 1175 clickTargetNode->updateDistribution();
1178 } else if (m_clickNode->document() == mev.innerNode()->document()) { 1176 } else if (m_clickNode->document() == mev.innerNode()->document()) {
1179 m_clickNode->updateDistribution(); 1177 m_clickNode->updateDistribution();
1180 mev.innerNode()->updateDistribution(); 1178 mev.innerNode()->updateDistribution();
1181 clickTargetNode = mev.innerNode()->commonAncestor( 1179 clickTargetNode = mev.innerNode()->commonAncestor(
1182 *m_clickNode, parentForClickEvent); 1180 *m_clickNode, parentForClickEvent);
1183 } 1181 }
1184 if (clickTargetNode) { 1182 if (clickTargetNode) {
1185 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents 1183 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents
1186 // because the mouseup dispatch above has already updated it 1184 // because the mouseup dispatch above has already updated it
1187 // correctly. Moreover, clickTargetNode is different from 1185 // correctly. Moreover, clickTargetNode is different from
1188 // mev.innerNode at drag-release. 1186 // mev.innerNode at drag-release.
1189 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1187 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(),
1190 !RuntimeEnabledFeatures::auxclickEnabled() 1188 !RuntimeEnabledFeatures::auxclickEnabled() || (mev.event().butto n() == MouseButton::LeftButton)
1191 || (mev.event().pointerProperties().button == WebPointerProperti es::Button::Left)
1192 ? EventTypeNames::click 1189 ? EventTypeNames::click
1193 : EventTypeNames::auxclick, 1190 : EventTypeNames::auxclick,
1194 m_clickCount)); 1191 m_clickCount));
1195 } 1192 }
1196 } 1193 }
1197 1194
1198 m_scrollManager.clearResizeScrollableArea(false); 1195 m_scrollManager.clearResizeScrollableArea(false);
1199 1196
1200 if (eventResult == WebInputEventResult::NotHandled) 1197 if (eventResult == WebInputEventResult::NotHandled)
1201 eventResult = handleMouseReleaseEvent(mev); 1198 eventResult = handleMouseReleaseEvent(mev);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 || mouseEventType == EventTypeNames::mousemove 1513 || mouseEventType == EventTypeNames::mousemove
1517 || mouseEventType == EventTypeNames::mouseup); 1514 || mouseEventType == EventTypeNames::mouseup);
1518 1515
1519 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent ); 1516 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent );
1520 1517
1521 if (mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch) 1518 if (mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch)
1522 return dispatchMouseEvent(mouseEventType, m_nodeUnderMouse, clickCount, mouseEvent); 1519 return dispatchMouseEvent(mouseEventType, m_nodeUnderMouse, clickCount, mouseEvent);
1523 1520
1524 Node* newNodeUnderMouse = nullptr; 1521 Node* newNodeUnderMouse = nullptr;
1525 const auto& eventResult = m_pointerEventManager.sendMousePointerEvent( 1522 const auto& eventResult = m_pointerEventManager.sendMousePointerEvent(
1526 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, 1523 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr,
1527 lastNodeUnderMouse, &newNodeUnderMouse); 1524 lastNodeUnderMouse, &newNodeUnderMouse);
1528 m_nodeUnderMouse = newNodeUnderMouse; 1525 m_nodeUnderMouse = newNodeUnderMouse;
1529 return eventResult; 1526 return eventResult;
1530 } 1527 }
1531 1528
1532 void EventHandler::setClickNode(Node* node) 1529 void EventHandler::setClickNode(Node* node)
1533 { 1530 {
1534 m_clickNode = node; 1531 m_clickNode = node;
1535 } 1532 }
1536 1533
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 exitedFrameChain.append(exitedFrameInDocument); 1891 exitedFrameChain.append(exitedFrameInDocument);
1895 else if (nextExitedFrameInDocument && indexEnteredFrameChain) 1892 else if (nextExitedFrameInDocument && indexEnteredFrameChain)
1896 --indexEnteredFrameChain; 1893 --indexEnteredFrameChain;
1897 } 1894 }
1898 exitedFrameInDocument = nextExitedFrameInDocument; 1895 exitedFrameInDocument = nextExitedFrameInDocument;
1899 } 1896 }
1900 1897
1901 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 1898 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
1902 unsigned modifiers = gestureEvent.getModifiers(); 1899 unsigned modifiers = gestureEvent.getModifiers();
1903 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa lPosition(), 1900 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa lPosition(),
1904 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, /* cl ickCount */ 0, 1901 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,
1905 static_cast<PlatformEvent::Modifiers>(modifiers), 1902 static_cast<PlatformEvent::Modifiers>(modifiers),
1906 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse); 1903 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse);
1907 1904
1908 // Update the mouseout/mouseleave event 1905 // Update the mouseout/mouseleave event
1909 size_t indexExitedFrameChain = exitedFrameChain.size(); 1906 size_t indexExitedFrameChain = exitedFrameChain.size();
1910 while (indexExitedFrameChain) { 1907 while (indexExitedFrameChain) {
1911 LocalFrame* leaveFrame = exitedFrameChain[--indexExitedFrameChain]; 1908 LocalFrame* leaveFrame = exitedFrameChain[--indexExitedFrameChain];
1912 leaveFrame->eventHandler().updateMouseEventTargetNodeAndSendEvents(nullp tr, fakeMouseMove); 1909 leaveFrame->eventHandler().updateMouseEventTargetNodeAndSendEvents(nullp tr, fakeMouseMove);
1913 } 1910 }
1914 1911
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 result.setInnerNode(targetNode); 2099 result.setInnerNode(targetNode);
2103 doc->updateHoverActiveState(request, result.innerElement()); 2100 doc->updateHoverActiveState(request, result.innerElement());
2104 2101
2105 // The contextmenu event is a mouse event even when invoked using the keyboa rd. 2102 // The contextmenu event is a mouse event even when invoked using the keyboa rd.
2106 // This is required for web compatibility. 2103 // This is required for web compatibility.
2107 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; 2104 PlatformEvent::EventType eventType = PlatformEvent::MousePressed;
2108 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) 2105 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
2109 eventType = PlatformEvent::MouseReleased; 2106 eventType = PlatformEvent::MouseReleased;
2110 2107
2111 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, 2108 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition,
2112 WebPointerProperties::Button::Right, eventType, 1, 2109 RightButton, eventType, 1,
2113 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, 2110 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable,
2114 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M ouse); 2111 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M ouse);
2115 2112
2116 return sendContextMenuEvent(mouseEvent, overrideTargetElement); 2113 return sendContextMenuEvent(mouseEvent, overrideTargetElement);
2117 } 2114 }
2118 2115
2119 void EventHandler::scheduleHoverStateUpdate() 2116 void EventHandler::scheduleHoverStateUpdate()
2120 { 2117 {
2121 if (!m_hoverTimer.isActive()) 2118 if (!m_hoverTimer.isActive())
2122 m_hoverTimer.startOneShot(0, BLINK_FROM_HERE); 2119 m_hoverTimer.startOneShot(0, BLINK_FROM_HERE);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 if (!view) 2179 if (!view)
2183 return; 2180 return;
2184 2181
2185 if (!m_frame->page() || !m_frame->page()->focusController().isActive()) 2182 if (!m_frame->page() || !m_frame->page()->focusController().isActive())
2186 return; 2183 return;
2187 2184
2188 // Don't dispatch a synthetic mouse move event if the mouse cursor is not vi sible to the user. 2185 // Don't dispatch a synthetic mouse move event if the mouse cursor is not vi sible to the user.
2189 if (!isCursorVisible()) 2186 if (!isCursorVisible())
2190 return; 2187 return;
2191 2188
2192 PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownM ouseGlobalPosition, WebPointerProperties::Button::NoButton, PlatformEvent::Mouse Moved, 0, PlatformKeyboardEvent::getCurrentModifierState(), PlatformMouseEvent:: RealOrIndistinguishable, monotonicallyIncreasingTime(), WebPointerProperties::Po interType::Mouse); 2189 PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownM ouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, PlatformKeyboardEven t::getCurrentModifierState(), PlatformMouseEvent::RealOrIndistinguishable, monot onicallyIncreasingTime(), WebPointerProperties::PointerType::Mouse);
2193 handleMouseMoveEvent(fakeMouseMoveEvent); 2190 handleMouseMoveEvent(fakeMouseMoveEvent);
2194 } 2191 }
2195 2192
2196 void EventHandler::cancelFakeMouseMoveEvent() 2193 void EventHandler::cancelFakeMouseMoveEvent()
2197 { 2194 {
2198 m_fakeMouseMoveEventTimer.stop(); 2195 m_fakeMouseMoveEventTimer.stop();
2199 } 2196 }
2200 2197
2201 bool EventHandler::isCursorVisible() const 2198 bool EventHandler::isCursorVisible() const
2202 { 2199 {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 2336
2340 bool EventHandler::handleDragDropIfPossible(const GestureEventWithHitTestResults & targetedEvent) 2337 bool EventHandler::handleDragDropIfPossible(const GestureEventWithHitTestResults & targetedEvent)
2341 { 2338 {
2342 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) { 2339 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) {
2343 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 2340 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
2344 IntPoint adjustedPoint = gestureEvent.position(); 2341 IntPoint adjustedPoint = gestureEvent.position();
2345 unsigned modifiers = gestureEvent.getModifiers(); 2342 unsigned modifiers = gestureEvent.getModifiers();
2346 2343
2347 // TODO(mustaq): Suppressing long-tap MouseEvents could break 2344 // TODO(mustaq): Suppressing long-tap MouseEvents could break
2348 // drag-drop. Will do separately because of the risk. crbug.com/606938. 2345 // drag-drop. Will do separately because of the risk. crbug.com/606938.
2349 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 1, 2346 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1,
2350 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown), 2347 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2351 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse); 2348 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse);
2352 m_mouseDown = mouseDownEvent; 2349 m_mouseDown = mouseDownEvent;
2353 2350
2354 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), WebPointerProperties::Button::Left, PlatformEvent::MouseMoved, 1, 2351 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1,
2355 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown), 2352 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2356 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse); 2353 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse);
2357 HitTestRequest request(HitTestRequest::ReadOnly); 2354 HitTestRequest request(HitTestRequest::ReadOnly);
2358 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); 2355 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent);
2359 m_mouseDownMayStartDrag = true; 2356 m_mouseDownMayStartDrag = true;
2360 dragState().m_dragSrc = nullptr; 2357 dragState().m_dragSrc = nullptr;
2361 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos ition()); 2358 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos ition());
2362 return handleDrag(mev, DragInitiator::Touch); 2359 return handleDrag(mev, DragInitiator::Touch);
2363 } 2360 }
2364 return false; 2361 return false;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 2597
2601 FrameHost* EventHandler::frameHost() const 2598 FrameHost* EventHandler::frameHost() const
2602 { 2599 {
2603 if (!m_frame->page()) 2600 if (!m_frame->page())
2604 return nullptr; 2601 return nullptr;
2605 2602
2606 return &m_frame->page()->frameHost(); 2603 return &m_frame->page()->frameHost();
2607 } 2604 }
2608 2605
2609 } // namespace blink 2606 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698