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

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

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

Powered by Google App Engine
This is Rietveld 408576698