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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent & mouseEvent) 977 WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent & mouseEvent)
978 { 978 {
979 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); 979 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent");
980 980
981 // For 4th/5th button in the mouse since Chrome does not yet send 981 // For 4th/5th button in the mouse since Chrome does not yet send
982 // button value to Blink but in some cases it does send the event. 982 // button value to Blink but in some cases it does send the event.
983 // This check is needed to suppress such an event (crbug.com/574959) 983 // This check is needed to suppress such an event (crbug.com/574959)
984 if (mouseEvent.button() == NoButton) 984 if (mouseEvent.button() == NoButton)
985 return WebInputEventResult::HandledSuppressed; 985 return WebInputEventResult::HandledSuppressed;
986 986
987 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 987 RawPtr<FrameView> protector(m_frame->view());
988 988
989 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 989 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
990 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = gestureIndicator.currentToken(); 990 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken = gestureIndicator.currentToken();
991 991
992 cancelFakeMouseMoveEvent(); 992 cancelFakeMouseMoveEvent();
993 if (m_eventHandlerWillResetCapturingMouseEventsNode) 993 if (m_eventHandlerWillResetCapturingMouseEventsNode)
994 m_capturingMouseEventsNode = nullptr; 994 m_capturingMouseEventsNode = nullptr;
995 m_mousePressed = true; 995 m_mousePressed = true;
996 m_capturesDragging = true; 996 m_capturesDragging = true;
997 setLastKnownMousePosition(mouseEvent); 997 setLastKnownMousePosition(mouseEvent);
(...skipping 15 matching lines...) Expand all
1013 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re quest, documentPoint, mouseEvent); 1013 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re quest, documentPoint, mouseEvent);
1014 1014
1015 if (!mev.innerNode()) { 1015 if (!mev.innerNode()) {
1016 invalidateClick(); 1016 invalidateClick();
1017 return WebInputEventResult::NotHandled; 1017 return WebInputEventResult::NotHandled;
1018 } 1018 }
1019 1019
1020 m_mousePressNode = mev.innerNode(); 1020 m_mousePressNode = mev.innerNode();
1021 m_frame->document()->setSequentialFocusNavigationStartingPoint(mev.innerNode ()); 1021 m_frame->document()->setSequentialFocusNavigationStartingPoint(mev.innerNode ());
1022 1022
1023 RefPtrWillBeRawPtr<LocalFrame> subframe = subframeForHitTestResult(mev); 1023 RawPtr<LocalFrame> subframe = subframeForHitTestResult(mev);
1024 if (subframe) { 1024 if (subframe) {
1025 WebInputEventResult result = passMousePressEventToSubframe(mev, subframe .get()); 1025 WebInputEventResult result = passMousePressEventToSubframe(mev, subframe .get());
1026 // Start capturing future events for this frame. We only do this if we didn't clear 1026 // Start capturing future events for this frame. We only do this if we didn't clear
1027 // the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop. 1027 // the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop.
1028 // The capturing should be done only when the result indicates it 1028 // The capturing should be done only when the result indicates it
1029 // has been handled. See crbug.com/269917 1029 // has been handled. See crbug.com/269917
1030 m_capturesDragging = subframe->eventHandler().capturesDragging(); 1030 m_capturesDragging = subframe->eventHandler().capturesDragging();
1031 if (m_mousePressed && m_capturesDragging) { 1031 if (m_mousePressed && m_capturesDragging) {
1032 m_capturingMouseEventsNode = mev.innerNode(); 1032 m_capturingMouseEventsNode = mev.innerNode();
1033 m_eventHandlerWillResetCapturingMouseEventsNode = true; 1033 m_eventHandlerWillResetCapturingMouseEventsNode = true;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 return scrollableArea; 1139 return scrollableArea;
1140 } 1140 }
1141 1141
1142 return nullptr; 1142 return nullptr;
1143 } 1143 }
1144 1144
1145 WebInputEventResult EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event) 1145 WebInputEventResult EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event)
1146 { 1146 {
1147 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent"); 1147 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent");
1148 1148
1149 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 1149 RawPtr<FrameView> protector(m_frame->view());
1150 1150
1151 HitTestResult hoveredNode = HitTestResult(); 1151 HitTestResult hoveredNode = HitTestResult();
1152 WebInputEventResult result = handleMouseMoveOrLeaveEvent(event, &hoveredNode ); 1152 WebInputEventResult result = handleMouseMoveOrLeaveEvent(event, &hoveredNode );
1153 1153
1154 Page* page = m_frame->page(); 1154 Page* page = m_frame->page();
1155 if (!page) 1155 if (!page)
1156 return result; 1156 return result;
1157 1157
1158 if (PaintLayer* layer = layerForNode(hoveredNode.innerNode())) { 1158 if (PaintLayer* layer = layerForNode(hoveredNode.innerNode())) {
1159 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer )) 1159 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer ))
1160 layerScrollableArea->mouseMovedInContentArea(); 1160 layerScrollableArea->mouseMovedInContentArea();
1161 } 1161 }
1162 1162
1163 if (FrameView* frameView = m_frame->view()) 1163 if (FrameView* frameView = m_frame->view())
1164 frameView->mouseMovedInContentArea(); 1164 frameView->mouseMovedInContentArea();
1165 1165
1166 hoveredNode.setToShadowHostIfInUserAgentShadowRoot(); 1166 hoveredNode.setToShadowHostIfInUserAgentShadowRoot();
1167 page->chromeClient().mouseDidMoveOverElement(hoveredNode); 1167 page->chromeClient().mouseDidMoveOverElement(hoveredNode);
1168 1168
1169 return result; 1169 return result;
1170 } 1170 }
1171 1171
1172 void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event) 1172 void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event)
1173 { 1173 {
1174 TRACE_EVENT0("blink", "EventHandler::handleMouseLeaveEvent"); 1174 TRACE_EVENT0("blink", "EventHandler::handleMouseLeaveEvent");
1175 1175
1176 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 1176 RawPtr<FrameView> protector(m_frame->view());
1177 handleMouseMoveOrLeaveEvent(event, 0, false, true); 1177 handleMouseMoveOrLeaveEvent(event, 0, false, true);
1178 } 1178 }
1179 1179
1180 WebInputEventResult EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMous eEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars, bool forceLeave) 1180 WebInputEventResult EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMous eEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars, bool forceLeave)
1181 { 1181 {
1182 ASSERT(m_frame); 1182 ASSERT(m_frame);
1183 ASSERT(m_frame->view()); 1183 ASSERT(m_frame->view());
1184 1184
1185 setLastKnownMousePosition(mouseEvent); 1185 setLastKnownMousePosition(mouseEvent);
1186 1186
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 } else { 1242 } else {
1243 if (!scrollbar) 1243 if (!scrollbar)
1244 scrollbar = mev.scrollbar(); 1244 scrollbar = mev.scrollbar();
1245 1245
1246 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); 1246 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed);
1247 if (onlyUpdateScrollbars) 1247 if (onlyUpdateScrollbars)
1248 return WebInputEventResult::HandledSuppressed; 1248 return WebInputEventResult::HandledSuppressed;
1249 } 1249 }
1250 1250
1251 WebInputEventResult eventResult = WebInputEventResult::NotHandled; 1251 WebInputEventResult eventResult = WebInputEventResult::NotHandled;
1252 RefPtrWillBeRawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get( ) ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTest Result(mev); 1252 RawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev);
1253 1253
1254 // We want mouseouts to happen first, from the inside out. First send a mov e event to the last subframe so that it will fire mouseouts. 1254 // We want mouseouts to happen first, from the inside out. First send a mov e event to the last subframe so that it will fire mouseouts.
1255 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) 1255 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe)
1256 m_lastMouseMoveEventSubframe->eventHandler().handleMouseLeaveEvent(mev.e vent()); 1256 m_lastMouseMoveEventSubframe->eventHandler().handleMouseLeaveEvent(mev.e vent());
1257 1257
1258 if (newSubframe) { 1258 if (newSubframe) {
1259 // Update over/out state before passing the event to the subframe. 1259 // Update over/out state before passing the event to the subframe.
1260 updateMouseEventTargetNodeAndSendEvents(mev.innerNode(), mev.event(), tr ue); 1260 updateMouseEventTargetNodeAndSendEvents(mev.innerNode(), mev.event(), tr ue);
1261 1261
1262 // Event dispatch in updateMouseEventTargetNodeAndSendEvents may have ca used the subframe of the target 1262 // Event dispatch in updateMouseEventTargetNodeAndSendEvents may have ca used the subframe of the target
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve nt& mouseEvent) 1305 WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve nt& mouseEvent)
1306 { 1306 {
1307 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); 1307 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent");
1308 1308
1309 // For 4th/5th button in the mouse since Chrome does not yet send 1309 // For 4th/5th button in the mouse since Chrome does not yet send
1310 // button value to Blink but in some cases it does send the event. 1310 // button value to Blink but in some cases it does send the event.
1311 // This check is needed to suppress such an event (crbug.com/574959) 1311 // This check is needed to suppress such an event (crbug.com/574959)
1312 if (mouseEvent.button() == NoButton) 1312 if (mouseEvent.button() == NoButton)
1313 return WebInputEventResult::HandledSuppressed; 1313 return WebInputEventResult::HandledSuppressed;
1314 1314
1315 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 1315 RawPtr<FrameView> protector(m_frame->view());
1316 1316
1317 m_frame->selection().setCaretBlinkingSuspended(false); 1317 m_frame->selection().setCaretBlinkingSuspended(false);
1318 1318
1319 OwnPtr<UserGestureIndicator> gestureIndicator; 1319 OwnPtr<UserGestureIndicator> gestureIndicator;
1320 1320
1321 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n) 1321 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n)
1322 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->localFrame Root()->eventHandler().m_lastMouseDownUserGestureToken.release())); 1322 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->localFrame Root()->eventHandler().m_lastMouseDownUserGestureToken.release()));
1323 else 1323 else
1324 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gUserGesture)); 1324 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin gUserGesture));
1325 1325
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 } 1406 }
1407 1407
1408 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer ) 1408 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer )
1409 { 1409 {
1410 FrameView* view = m_frame->view(); 1410 FrameView* view = m_frame->view();
1411 1411
1412 // FIXME: We might want to dispatch a dragleave even if the view is gone. 1412 // FIXME: We might want to dispatch a dragleave even if the view is gone.
1413 if (!view) 1413 if (!view)
1414 return WebInputEventResult::NotHandled; 1414 return WebInputEventResult::NotHandled;
1415 1415
1416 RefPtrWillBeRawPtr<DragEvent> me = DragEvent::create(eventType, 1416 RawPtr<DragEvent> me = DragEvent::create(eventType,
1417 true, true, m_frame->document()->domWindow(), 1417 true, true, m_frame->document()->domWindow(),
1418 0, event.globalPosition().x(), event.globalPosition().y(), event.positio n().x(), event.position().y(), 1418 0, event.globalPosition().x(), event.globalPosition().y(), event.positio n().x(), event.position().y(),
1419 event.movementDelta().x(), event.movementDelta().y(), 1419 event.movementDelta().x(), event.movementDelta().y(),
1420 event.getModifiers(), 1420 event.getModifiers(),
1421 0, MouseEvent::platformModifiersToButtons(event.getModifiers()), nullptr , event.timestamp(), dataTransfer, event.getSyntheticEventType()); 1421 0, MouseEvent::platformModifiersToButtons(event.getModifiers()), nullptr , event.timestamp(), dataTransfer, event.getSyntheticEventType());
1422 1422
1423 return toWebInputEventResult(dragTarget->dispatchEvent(me.get())); 1423 return toWebInputEventResult(dragTarget->dispatchEvent(me.get()));
1424 } 1424 }
1425 1425
1426 static bool targetIsFrame(Node* target, LocalFrame*& frame) 1426 static bool targetIsFrame(Node* target, LocalFrame*& frame)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 { 1479 {
1480 WebInputEventResult eventResult = WebInputEventResult::NotHandled; 1480 WebInputEventResult eventResult = WebInputEventResult::NotHandled;
1481 1481
1482 if (!m_frame->view()) 1482 if (!m_frame->view())
1483 return eventResult; 1483 return eventResult;
1484 1484
1485 HitTestRequest request(HitTestRequest::ReadOnly); 1485 HitTestRequest request(HitTestRequest::ReadOnly);
1486 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); 1486 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
1487 1487
1488 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch) 1488 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch)
1489 RefPtrWillBeRawPtr<Node> newTarget = mev.innerNode(); 1489 RawPtr<Node> newTarget = mev.innerNode();
1490 if (newTarget && newTarget->isTextNode()) 1490 if (newTarget && newTarget->isTextNode())
1491 newTarget = FlatTreeTraversal::parent(*newTarget); 1491 newTarget = FlatTreeTraversal::parent(*newTarget);
1492 1492
1493 if (AutoscrollController* controller = autoscrollController()) 1493 if (AutoscrollController* controller = autoscrollController())
1494 controller->updateDragAndDrop(newTarget.get(), event.position(), event.t imestamp()); 1494 controller->updateDragAndDrop(newTarget.get(), event.position(), event.t imestamp());
1495 1495
1496 if (m_dragTarget != newTarget) { 1496 if (m_dragTarget != newTarget) {
1497 // FIXME: this ordering was explicitly chosen to match WinIE. However, 1497 // FIXME: this ordering was explicitly chosen to match WinIE. However,
1498 // it is sometimes incorrect when dragging within subframes, as seen wit h 1498 // it is sometimes incorrect when dragging within subframes, as seen wit h
1499 // LayoutTests/fast/events/drag-in-frames.html. 1499 // LayoutTests/fast/events/drag-in-frames.html.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 } 1577 }
1578 1578
1579 void EventHandler::clearDragState() 1579 void EventHandler::clearDragState()
1580 { 1580 {
1581 stopAutoscroll(); 1581 stopAutoscroll();
1582 m_dragTarget = nullptr; 1582 m_dragTarget = nullptr;
1583 m_capturingMouseEventsNode = nullptr; 1583 m_capturingMouseEventsNode = nullptr;
1584 m_shouldOnlyFireDragOverEvent = false; 1584 m_shouldOnlyFireDragOverEvent = false;
1585 } 1585 }
1586 1586
1587 void EventHandler::setCapturingMouseEventsNode(PassRefPtrWillBeRawPtr<Node> n) 1587 void EventHandler::setCapturingMouseEventsNode(RawPtr<Node> n)
1588 { 1588 {
1589 m_capturingMouseEventsNode = n; 1589 m_capturingMouseEventsNode = n;
1590 m_eventHandlerWillResetCapturingMouseEventsNode = false; 1590 m_eventHandlerWillResetCapturingMouseEventsNode = false;
1591 } 1591 }
1592 1592
1593 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques t& request, const PlatformMouseEvent& mev) 1593 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques t& request, const PlatformMouseEvent& mev)
1594 { 1594 {
1595 ASSERT(m_frame); 1595 ASSERT(m_frame);
1596 ASSERT(m_frame->document()); 1596 ASSERT(m_frame->document());
1597 1597
1598 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF rame(m_frame, mev.position()), mev); 1598 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF rame(m_frame, mev.position()), mev);
1599 } 1599 }
1600 1600
1601 PassRefPtrWillBeRawPtr<Node> EventHandler::updateMouseEventTargetNode(Node* targ etNode, 1601 RawPtr<Node> EventHandler::updateMouseEventTargetNode(Node* targetNode,
1602 const PlatformMouseEvent& mouseEvent) 1602 const PlatformMouseEvent& mouseEvent)
1603 { 1603 {
1604 Node* result = targetNode; 1604 Node* result = targetNode;
1605 1605
1606 // If we're capturing, we always go right to that node. 1606 // If we're capturing, we always go right to that node.
1607 if (m_capturingMouseEventsNode) { 1607 if (m_capturingMouseEventsNode) {
1608 result = m_capturingMouseEventsNode.get(); 1608 result = m_capturingMouseEventsNode.get();
1609 } else { 1609 } else {
1610 // If the target node is a text node, dispatch on the parent node - rdar ://4196646 1610 // If the target node is a text node, dispatch on the parent node - rdar ://4196646
1611 if (result && result->isTextNode()) 1611 if (result && result->isTextNode())
1612 result = FlatTreeTraversal::parent(*result); 1612 result = FlatTreeTraversal::parent(*result);
1613 } 1613 }
1614 RefPtrWillBeMember<Node> lastNodeUnderMouse = m_nodeUnderMouse; 1614 Member<Node> lastNodeUnderMouse = m_nodeUnderMouse;
1615 m_nodeUnderMouse = result; 1615 m_nodeUnderMouse = result;
1616 1616
1617 PaintLayer* layerForLastNode = layerForNode(lastNodeUnderMouse.get()); 1617 PaintLayer* layerForLastNode = layerForNode(lastNodeUnderMouse.get());
1618 PaintLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get()); 1618 PaintLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get());
1619 Page* page = m_frame->page(); 1619 Page* page = m_frame->page();
1620 1620
1621 if (lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document() != m_frame->document())) { 1621 if (lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document() != m_frame->document())) {
1622 // The mouse has moved between frames. 1622 // The mouse has moved between frames.
1623 if (LocalFrame* frame = lastNodeUnderMouse->document().frame()) { 1623 if (LocalFrame* frame = lastNodeUnderMouse->document().frame()) {
1624 if (FrameView* frameView = frame->view()) 1624 if (FrameView* frameView = frame->view())
(...skipping 21 matching lines...) Expand all
1646 lastNodeUnderMouse = nullptr; 1646 lastNodeUnderMouse = nullptr;
1647 m_lastScrollbarUnderMouse = nullptr; 1647 m_lastScrollbarUnderMouse = nullptr;
1648 } 1648 }
1649 1649
1650 return lastNodeUnderMouse; 1650 return lastNodeUnderMouse;
1651 } 1651 }
1652 1652
1653 void EventHandler::updateMouseEventTargetNodeAndSendEvents(Node* targetNode, 1653 void EventHandler::updateMouseEventTargetNodeAndSendEvents(Node* targetNode,
1654 const PlatformMouseEvent& mouseEvent, bool isFrameBoundaryTransition) 1654 const PlatformMouseEvent& mouseEvent, bool isFrameBoundaryTransition)
1655 { 1655 {
1656 RefPtrWillBeRawPtr<Node> lastNodeUnderMouse = updateMouseEventTargetNode(tar getNode, mouseEvent); 1656 RawPtr<Node> lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mou seEvent);
1657 m_pointerEventManager.sendMouseAndPossiblyPointerNodeTransitionEvents( 1657 m_pointerEventManager.sendMouseAndPossiblyPointerNodeTransitionEvents(
1658 lastNodeUnderMouse, m_nodeUnderMouse, mouseEvent, 1658 lastNodeUnderMouse, m_nodeUnderMouse, mouseEvent,
1659 m_frame->document()->domWindow(), isFrameBoundaryTransition); 1659 m_frame->document()->domWindow(), isFrameBoundaryTransition);
1660 } 1660 }
1661 1661
1662 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent) 1662 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent)
1663 { 1663 {
1664 updateMouseEventTargetNodeAndSendEvents(targetNode, mouseEvent); 1664 updateMouseEventTargetNodeAndSendEvents(targetNode, mouseEvent);
1665 if (!m_nodeUnderMouse) 1665 if (!m_nodeUnderMouse)
1666 return WebInputEventResult::NotHandled; 1666 return WebInputEventResult::NotHandled;
1667 1667
1668 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, m_nodeU nderMouse->document().domWindow(), mouseEvent, clickCount, nullptr); 1668 RawPtr<MouseEvent> event = MouseEvent::create(eventType, m_nodeUnderMouse->d ocument().domWindow(), mouseEvent, clickCount, nullptr);
1669 return toWebInputEventResult(m_nodeUnderMouse->dispatchEvent(event)); 1669 return toWebInputEventResult(m_nodeUnderMouse->dispatchEvent(event));
1670 } 1670 }
1671 1671
1672 bool EventHandler::isPointerEventActive(int pointerId) 1672 bool EventHandler::isPointerEventActive(int pointerId)
1673 { 1673 {
1674 return m_pointerEventManager.isActive(pointerId); 1674 return m_pointerEventManager.isActive(pointerId);
1675 } 1675 }
1676 1676
1677 void EventHandler::setPointerCapture(int pointerId, EventTarget* target) 1677 void EventHandler::setPointerCapture(int pointerId, EventTarget* target)
1678 { 1678 {
(...skipping 11 matching lines...) Expand all
1690 m_pointerEventManager.elementRemoved(target); 1690 m_pointerEventManager.elementRemoved(target);
1691 } 1691 }
1692 1692
1693 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler. 1693 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler.
1694 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse Event& mouseEvent) 1694 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse Event& mouseEvent)
1695 { 1695 {
1696 ASSERT(mouseEventType == EventTypeNames::mousedown 1696 ASSERT(mouseEventType == EventTypeNames::mousedown
1697 || mouseEventType == EventTypeNames::mousemove 1697 || mouseEventType == EventTypeNames::mousemove
1698 || mouseEventType == EventTypeNames::mouseup); 1698 || mouseEventType == EventTypeNames::mouseup);
1699 1699
1700 RefPtrWillBeRawPtr<Node> lastNodeUnderMouse = updateMouseEventTargetNode(tar getNode, mouseEvent); 1700 RawPtr<Node> lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mou seEvent);
1701 1701
1702 return m_pointerEventManager.sendMousePointerEvent( 1702 return m_pointerEventManager.sendMousePointerEvent(
1703 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr, 1703 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr,
1704 m_frame->document()->domWindow(), lastNodeUnderMouse); 1704 m_frame->document()->domWindow(), lastNodeUnderMouse);
1705 } 1705 }
1706 1706
1707 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) 1707 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities)
1708 { 1708 {
1709 // If clicking on a frame scrollbar, do not mess up with content focus. 1709 // If clicking on a frame scrollbar, do not mess up with content focus.
1710 if (targetedEvent.hitTestResult().scrollbar() && m_frame->contentLayoutObjec t()) { 1710 if (targetedEvent.hitTestResult().scrollbar() && m_frame->contentLayoutObjec t()) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 return false; 1789 return false;
1790 } 1790 }
1791 1791
1792 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve nt) 1792 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve nt)
1793 { 1793 {
1794 Document* doc = m_frame->document(); 1794 Document* doc = m_frame->document();
1795 1795
1796 if (!doc->layoutView()) 1796 if (!doc->layoutView())
1797 return WebInputEventResult::NotHandled; 1797 return WebInputEventResult::NotHandled;
1798 1798
1799 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 1799 RawPtr<FrameView> protector(m_frame->view());
1800 1800
1801 FrameView* view = m_frame->view(); 1801 FrameView* view = m_frame->view();
1802 if (!view) 1802 if (!view)
1803 return WebInputEventResult::NotHandled; 1803 return WebInputEventResult::NotHandled;
1804 1804
1805 LayoutPoint vPoint = view->rootFrameToContents(event.position()); 1805 LayoutPoint vPoint = view->rootFrameToContents(event.position());
1806 1806
1807 HitTestRequest request(HitTestRequest::ReadOnly); 1807 HitTestRequest request(HitTestRequest::ReadOnly);
1808 HitTestResult result(request, vPoint); 1808 HitTestResult result(request, vPoint);
1809 doc->layoutView()->hitTest(result); 1809 doc->layoutView()->hitTest(result);
(...skipping 17 matching lines...) Expand all
1827 } 1827 }
1828 // TODO(dtapuska): Remove this once wheel gesture scroll has 1828 // TODO(dtapuska): Remove this once wheel gesture scroll has
1829 // been enabled everywhere; as we can just return early. 1829 // been enabled everywhere; as we can just return early.
1830 // http://crbug.com/568183 1830 // http://crbug.com/568183
1831 // Don't propagate the DOM event into the parent iframe 1831 // Don't propagate the DOM event into the parent iframe
1832 // but do dispatch the scroll event. 1832 // but do dispatch the scroll event.
1833 sendDOMEvent = false; 1833 sendDOMEvent = false;
1834 } 1834 }
1835 1835
1836 if (node) { 1836 if (node) {
1837 RefPtrWillBeRawPtr<WheelEvent> domEvent = WheelEvent::create(event, node ->document().domWindow()); 1837 RawPtr<WheelEvent> domEvent = WheelEvent::create(event, node->document() .domWindow());
1838 if (sendDOMEvent) { 1838 if (sendDOMEvent) {
1839 DispatchEventResult domEventResult = node->dispatchEvent(domEvent); 1839 DispatchEventResult domEventResult = node->dispatchEvent(domEvent);
1840 if (domEventResult != DispatchEventResult::NotCanceled) 1840 if (domEventResult != DispatchEventResult::NotCanceled)
1841 return toWebInputEventResult(domEventResult); 1841 return toWebInputEventResult(domEventResult);
1842 } else { 1842 } else {
1843 defaultWheelEventHandler(node, domEvent.get()); 1843 defaultWheelEventHandler(node, domEvent.get());
1844 if (domEvent->defaultHandled()) 1844 if (domEvent->defaultHandled())
1845 return WebInputEventResult::HandledSystem; 1845 return WebInputEventResult::HandledSystem;
1846 } 1846 }
1847 } 1847 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); 1949 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t);
1950 1950
1951 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? 1951 // No hit test result, handle in root instance. Perhaps we should just retur n false instead?
1952 return handleGestureEventInFrame(targetedEvent); 1952 return handleGestureEventInFrame(targetedEvent);
1953 } 1953 }
1954 1954
1955 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi thHitTestResults& targetedEvent) 1955 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi thHitTestResults& targetedEvent)
1956 { 1956 {
1957 ASSERT(!targetedEvent.event().isScrollEvent()); 1957 ASSERT(!targetedEvent.event().isScrollEvent());
1958 1958
1959 RefPtrWillBeRawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNo de(); 1959 RawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNode();
1960 RefPtrWillBeRawPtr<Scrollbar> scrollbar = targetedEvent.hitTestResult().scro llbar(); 1960 RawPtr<Scrollbar> scrollbar = targetedEvent.hitTestResult().scrollbar();
1961 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 1961 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
1962 1962
1963 if (scrollbar) { 1963 if (scrollbar) {
1964 bool shouldUpdateCapture = false; 1964 bool shouldUpdateCapture = false;
1965 if (scrollbar->gestureEvent(gestureEvent, &shouldUpdateCapture)) { 1965 if (scrollbar->gestureEvent(gestureEvent, &shouldUpdateCapture)) {
1966 if (shouldUpdateCapture) 1966 if (shouldUpdateCapture)
1967 m_scrollbarHandlingScrollGesture = scrollbar; 1967 m_scrollbarHandlingScrollGesture = scrollbar;
1968 return WebInputEventResult::HandledSuppressed; 1968 return WebInputEventResult::HandledSuppressed;
1969 } 1969 }
1970 } 1970 }
1971 1971
1972 if (eventTarget) { 1972 if (eventTarget) {
1973 RefPtrWillBeRawPtr<GestureEvent> gestureDomEvent = GestureEvent::create( eventTarget->document().domWindow(), gestureEvent); 1973 RawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(eventTarget- >document().domWindow(), gestureEvent);
1974 if (gestureDomEvent.get()) { 1974 if (gestureDomEvent.get()) {
1975 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent); 1975 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent);
1976 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { 1976 if (gestureDomEventResult != DispatchEventResult::NotCanceled) {
1977 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler); 1977 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler);
1978 return toWebInputEventResult(gestureDomEventResult); 1978 return toWebInputEventResult(gestureDomEventResult);
1979 } 1979 }
1980 } 1980 }
1981 } 1981 }
1982 1982
1983 switch (gestureEvent.type()) { 1983 switch (gestureEvent.type()) {
(...skipping 18 matching lines...) Expand all
2002 ASSERT_NOT_REACHED(); 2002 ASSERT_NOT_REACHED();
2003 } 2003 }
2004 2004
2005 return WebInputEventResult::NotHandled; 2005 return WebInputEventResult::NotHandled;
2006 } 2006 }
2007 2007
2008 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture Event& gestureEvent) 2008 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture Event& gestureEvent)
2009 { 2009 {
2010 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); 2010 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent");
2011 2011
2012 RefPtrWillBeRawPtr<Node> eventTarget = nullptr; 2012 RawPtr<Node> eventTarget = nullptr;
2013 RefPtrWillBeRawPtr<Scrollbar> scrollbar = nullptr; 2013 RawPtr<Scrollbar> scrollbar = nullptr;
2014 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { 2014 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) {
2015 scrollbar = m_scrollbarHandlingScrollGesture.get(); 2015 scrollbar = m_scrollbarHandlingScrollGesture.get();
2016 eventTarget = m_scrollGestureHandlingNode.get(); 2016 eventTarget = m_scrollGestureHandlingNode.get();
2017 } 2017 }
2018 2018
2019 if (!eventTarget) { 2019 if (!eventTarget) {
2020 Document* document = m_frame->document(); 2020 Document* document = m_frame->document();
2021 if (!document->layoutView()) 2021 if (!document->layoutView())
2022 return WebInputEventResult::NotHandled; 2022 return WebInputEventResult::NotHandled;
2023 2023
(...skipping 20 matching lines...) Expand all
2044 m_scrollbarHandlingScrollGesture = scrollbar; 2044 m_scrollbarHandlingScrollGesture = scrollbar;
2045 return WebInputEventResult::HandledSuppressed; 2045 return WebInputEventResult::HandledSuppressed;
2046 } 2046 }
2047 m_scrollbarHandlingScrollGesture = nullptr; 2047 m_scrollbarHandlingScrollGesture = nullptr;
2048 } 2048 }
2049 2049
2050 if (eventTarget) { 2050 if (eventTarget) {
2051 if (handleScrollGestureOnResizer(eventTarget.get(), gestureEvent)) 2051 if (handleScrollGestureOnResizer(eventTarget.get(), gestureEvent))
2052 return WebInputEventResult::HandledSuppressed; 2052 return WebInputEventResult::HandledSuppressed;
2053 2053
2054 RefPtrWillBeRawPtr<GestureEvent> gestureDomEvent = GestureEvent::create( eventTarget->document().domWindow(), gestureEvent); 2054 RawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(eventTarget- >document().domWindow(), gestureEvent);
2055 if (gestureDomEvent.get()) { 2055 if (gestureDomEvent.get()) {
2056 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent); 2056 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent);
2057 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { 2057 if (gestureDomEventResult != DispatchEventResult::NotCanceled) {
2058 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler); 2058 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler);
2059 return toWebInputEventResult(gestureDomEventResult); 2059 return toWebInputEventResult(gestureDomEventResult);
2060 } 2060 }
2061 } 2061 }
2062 } 2062 }
2063 2063
2064 switch (gestureEvent.type()) { 2064 switch (gestureEvent.type()) {
2065 case PlatformEvent::GestureScrollBegin: 2065 case PlatformEvent::GestureScrollBegin:
2066 return handleGestureScrollBegin(gestureEvent); 2066 return handleGestureScrollBegin(gestureEvent);
2067 case PlatformEvent::GestureScrollUpdate: 2067 case PlatformEvent::GestureScrollUpdate:
2068 return handleGestureScrollUpdate(gestureEvent); 2068 return handleGestureScrollUpdate(gestureEvent);
2069 case PlatformEvent::GestureScrollEnd: 2069 case PlatformEvent::GestureScrollEnd:
2070 return handleGestureScrollEnd(gestureEvent); 2070 return handleGestureScrollEnd(gestureEvent);
2071 case PlatformEvent::GestureFlingStart: 2071 case PlatformEvent::GestureFlingStart:
2072 case PlatformEvent::GesturePinchBegin: 2072 case PlatformEvent::GesturePinchBegin:
2073 case PlatformEvent::GesturePinchEnd: 2073 case PlatformEvent::GesturePinchEnd:
2074 case PlatformEvent::GesturePinchUpdate: 2074 case PlatformEvent::GesturePinchUpdate:
2075 return WebInputEventResult::NotHandled; 2075 return WebInputEventResult::NotHandled;
2076 default: 2076 default:
2077 ASSERT_NOT_REACHED(); 2077 ASSERT_NOT_REACHED();
2078 return WebInputEventResult::NotHandled; 2078 return WebInputEventResult::NotHandled;
2079 } 2079 }
2080 } 2080 }
2081 2081
2082 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest Results& targetedEvent) 2082 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest Results& targetedEvent)
2083 { 2083 {
2084 RefPtrWillBeRawPtr<FrameView> frameView(m_frame->view()); 2084 RawPtr<FrameView> frameView(m_frame->view());
2085 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 2085 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
2086 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type()); 2086 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type());
2087 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); 2087 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion();
2088 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); 2088 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion();
2089 2089
2090 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 2090 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
2091 2091
2092 HitTestResult currentHitTest = targetedEvent.hitTestResult(); 2092 HitTestResult currentHitTest = targetedEvent.hitTestResult();
2093 2093
2094 // We use the adjusted position so the application isn't surprised to see a event with 2094 // We use the adjusted position so the application isn't surprised to see a event with
(...skipping 17 matching lines...) Expand all
2112 if (currentHitTest.innerNode()) { 2112 if (currentHitTest.innerNode()) {
2113 LocalFrame* mainFrame = m_frame->localFrameRoot(); 2113 LocalFrame* mainFrame = m_frame->localFrameRoot();
2114 if (mainFrame && mainFrame->view()) 2114 if (mainFrame && mainFrame->view())
2115 mainFrame->view()->updateAllLifecyclePhases(); 2115 mainFrame->view()->updateAllLifecyclePhases();
2116 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 2116 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
2117 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2117 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2118 } 2118 }
2119 m_clickNode = currentHitTest.innerNode(); 2119 m_clickNode = currentHitTest.innerNode();
2120 2120
2121 // Capture data for showUnhandledTapUIIfNeeded. 2121 // Capture data for showUnhandledTapUIIfNeeded.
2122 RefPtrWillBeRawPtr<Node> tappedNode = m_clickNode; 2122 RawPtr<Node> tappedNode = m_clickNode;
2123 IntPoint tappedPosition = gestureEvent.position(); 2123 IntPoint tappedPosition = gestureEvent.position();
2124 2124
2125 if (m_clickNode && m_clickNode->isTextNode()) 2125 if (m_clickNode && m_clickNode->isTextNode())
2126 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); 2126 m_clickNode = FlatTreeTraversal::parent(*m_clickNode);
2127 2127
2128 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(), 2128 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(),
2129 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), 2129 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
2130 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown), 2130 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown),
2131 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp erties::PointerType::Mouse); 2131 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp erties::PointerType::Mouse);
2132 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames ::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown) ; 2132 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames ::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown) ;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 m_mouseDown = mouseDownEvent; 2205 m_mouseDown = mouseDownEvent;
2206 2206
2207 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1, 2207 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1,
2208 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown), 2208 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2209 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse); 2209 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse);
2210 HitTestRequest request(HitTestRequest::ReadOnly); 2210 HitTestRequest request(HitTestRequest::ReadOnly);
2211 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); 2211 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent);
2212 m_mouseDownMayStartDrag = true; 2212 m_mouseDownMayStartDrag = true;
2213 dragState().m_dragSrc = nullptr; 2213 dragState().m_dragSrc = nullptr;
2214 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos ition()); 2214 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos ition());
2215 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2215 RawPtr<FrameView> protector(m_frame->view());
2216 if (handleDrag(mev, DragInitiator::Touch)) { 2216 if (handleDrag(mev, DragInitiator::Touch)) {
2217 m_longTapShouldInvokeContextMenu = true; 2217 m_longTapShouldInvokeContextMenu = true;
2218 return WebInputEventResult::HandledSystem; 2218 return WebInputEventResult::HandledSystem;
2219 } 2219 }
2220 } 2220 }
2221 2221
2222 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition()); 2222 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition());
2223 HitTestResult result = hitTestResultAtPoint(hitTestPoint); 2223 HitTestResult result = hitTestResultAtPoint(hitTestPoint);
2224 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2224 RawPtr<FrameView> protector(m_frame->view());
2225 if (selectionController().handleGestureLongPress(gestureEvent, result)) { 2225 if (selectionController().handleGestureLongPress(gestureEvent, result)) {
2226 focusDocumentView(); 2226 focusDocumentView();
2227 return WebInputEventResult::HandledSystem; 2227 return WebInputEventResult::HandledSystem;
2228 } 2228 }
2229 2229
2230 return sendContextMenuEventForGesture(targetedEvent); 2230 return sendContextMenuEventForGesture(targetedEvent);
2231 } 2231 }
2232 2232
2233 WebInputEventResult EventHandler::handleGestureLongTap(const GestureEventWithHit TestResults& targetedEvent) 2233 WebInputEventResult EventHandler::handleGestureLongTap(const GestureEventWithHit TestResults& targetedEvent)
2234 { 2234 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 Widget* widget = toLayoutPart(layoutObject)->widget(); 2278 Widget* widget = toLayoutPart(layoutObject)->widget();
2279 2279
2280 if (!widget || !widget->isFrameView()) 2280 if (!widget || !widget->isFrameView())
2281 return WebInputEventResult::NotHandled; 2281 return WebInputEventResult::NotHandled;
2282 2282
2283 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent( gestureEvent); 2283 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent( gestureEvent);
2284 } 2284 }
2285 2285
2286 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent) 2286 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent)
2287 { 2287 {
2288 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode; 2288 RawPtr<Node> node = m_scrollGestureHandlingNode;
2289 2289
2290 if (node) { 2290 if (node) {
2291 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); 2291 passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
2292 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2292 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2293 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta()); 2293 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2294 scrollStateData->is_ending = true; 2294 scrollStateData->is_ending = true;
2295 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); 2295 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2296 scrollStateData->from_user_input = true; 2296 scrollStateData->from_user_input = true;
2297 scrollStateData->is_direct_manipulation = true; 2297 scrollStateData->is_direct_manipulation = true;
2298 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence; 2298 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2299 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(sc rollStateData.release()); 2299 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateDat a.release());
2300 customizedScroll(*node.get(), *scrollState); 2300 customizedScroll(*node.get(), *scrollState);
2301 } 2301 }
2302 } 2302 }
2303 2303
2304 clearGestureScrollState(); 2304 clearGestureScrollState();
2305 return WebInputEventResult::NotHandled; 2305 return WebInputEventResult::NotHandled;
2306 } 2306 }
2307 2307
2308 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent) 2308 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent)
2309 { 2309 {
(...skipping 20 matching lines...) Expand all
2330 2330
2331 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject()); 2331 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject());
2332 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2332 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2333 m_currentScrollChain.clear(); 2333 m_currentScrollChain.clear();
2334 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData() ); 2334 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData() );
2335 scrollStateData->start_position_x = gestureEvent.position().x(); 2335 scrollStateData->start_position_x = gestureEvent.position().x();
2336 scrollStateData->start_position_y = gestureEvent.position().y(); 2336 scrollStateData->start_position_y = gestureEvent.position().y();
2337 scrollStateData->is_beginning = true; 2337 scrollStateData->is_beginning = true;
2338 scrollStateData->from_user_input = true; 2338 scrollStateData->from_user_input = true;
2339 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedFor ScrollSequence; 2339 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedFor ScrollSequence;
2340 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(scroll StateData.release()); 2340 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateData.re lease());
2341 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); 2341 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState);
2342 } else { 2342 } else {
2343 if (m_frame->isMainFrame()) 2343 if (m_frame->isMainFrame())
2344 m_frame->host()->topControls().scrollBegin(); 2344 m_frame->host()->topControls().scrollBegin();
2345 } 2345 }
2346 return WebInputEventResult::HandledSystem; 2346 return WebInputEventResult::HandledSystem;
2347 } 2347 }
2348 2348
2349 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) 2349 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
2350 { 2350 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 ScrollGranularity granularity = gestureEvent.deltaUnits(); 2393 ScrollGranularity granularity = gestureEvent.deltaUnits();
2394 Node* node = m_scrollGestureHandlingNode.get(); 2394 Node* node = m_scrollGestureHandlingNode.get();
2395 2395
2396 // Scroll customization is only available for touch. 2396 // Scroll customization is only available for touch.
2397 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen; 2397 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen;
2398 if (node) { 2398 if (node) {
2399 LayoutObject* layoutObject = node->layoutObject(); 2399 LayoutObject* layoutObject = node->layoutObject();
2400 if (!layoutObject) 2400 if (!layoutObject)
2401 return WebInputEventResult::NotHandled; 2401 return WebInputEventResult::NotHandled;
2402 2402
2403 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2403 RawPtr<FrameView> protector(m_frame->view());
2404 2404
2405 // Try to send the event to the correct view. 2405 // Try to send the event to the correct view.
2406 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent , layoutObject); 2406 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent , layoutObject);
2407 if (result != WebInputEventResult::NotHandled) { 2407 if (result != WebInputEventResult::NotHandled) {
2408 if (gestureEvent.preventPropagation() 2408 if (gestureEvent.preventPropagation()
2409 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2409 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2410 // This is an optimization which doesn't apply with 2410 // This is an optimization which doesn't apply with
2411 // scroll customization enabled. 2411 // scroll customization enabled.
2412 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; 2412 m_previousGestureScrolledNode = m_scrollGestureHandlingNode;
2413 } 2413 }
2414 // FIXME: we should allow simultaneous scrolling of nested 2414 // FIXME: we should allow simultaneous scrolling of nested
2415 // iframes along perpendicular axes. See crbug.com/466991. 2415 // iframes along perpendicular axes. See crbug.com/466991.
2416 m_deltaConsumedForScrollSequence = true; 2416 m_deltaConsumedForScrollSequence = true;
2417 return result; 2417 return result;
2418 } 2418 }
2419 2419
2420 if (handleScrollCustomization) { 2420 if (handleScrollCustomization) {
2421 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta()); 2421 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2422 scrollStateData->delta_x = delta.width(); 2422 scrollStateData->delta_x = delta.width();
2423 scrollStateData->delta_y = delta.height(); 2423 scrollStateData->delta_y = delta.height();
2424 scrollStateData->velocity_x = velocity.width(); 2424 scrollStateData->velocity_x = velocity.width();
2425 scrollStateData->velocity_y = velocity.height(); 2425 scrollStateData->velocity_y = velocity.height();
2426 scrollStateData->should_propagate = !gestureEvent.preventPropagation (); 2426 scrollStateData->should_propagate = !gestureEvent.preventPropagation ();
2427 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); 2427 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2428 scrollStateData->from_user_input = true; 2428 scrollStateData->from_user_input = true;
2429 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence; 2429 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2430 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(sc rollStateData.release()); 2430 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateDat a.release());
2431 if (m_previousGestureScrolledNode) { 2431 if (m_previousGestureScrolledNode) {
2432 // The ScrollState needs to know what the current 2432 // The ScrollState needs to know what the current
2433 // native scrolling element is, so that for an 2433 // native scrolling element is, so that for an
2434 // inertial scroll that shouldn't propagate, only the 2434 // inertial scroll that shouldn't propagate, only the
2435 // currently scrolling element responds. 2435 // currently scrolling element responds.
2436 ASSERT(m_previousGestureScrolledNode->isElementNode()); 2436 ASSERT(m_previousGestureScrolledNode->isElementNode());
2437 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); 2437 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get()));
2438 } 2438 }
2439 customizedScroll(*node, *scrollState); 2439 customizedScroll(*node, *scrollState);
2440 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); 2440 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 // DOM nodes so a touch over a scrollbar will be adjusted towards nearby nod es. This leads to things like textarea 2502 // DOM nodes so a touch over a scrollbar will be adjusted towards nearby nod es. This leads to things like textarea
2503 // scrollbars being untouchable. 2503 // scrollbars being untouchable.
2504 if (result.scrollbar()) { 2504 if (result.scrollbar()) {
2505 targetNode = 0; 2505 targetNode = 0;
2506 return false; 2506 return false;
2507 } 2507 }
2508 2508
2509 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame()); 2509 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame());
2510 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox()); 2510 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox());
2511 2511
2512 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2512 HeapVector<Member<Node>, 11> nodes;
2513 copyToVector(result.listBasedTestResult(), nodes); 2513 copyToVector(result.listBasedTestResult(), nodes);
2514 2514
2515 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2515 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2516 return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touc hRect, WillBeHeapVector<RefPtrWillBeMember<Node>> (nodes)); 2516 return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touc hRect, HeapVector<Member<Node>> (nodes));
2517 } 2517 }
2518 2518
2519 bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu lt, IntPoint& targetPoint, Node*& targetNode) 2519 bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu lt, IntPoint& targetPoint, Node*& targetNode)
2520 { 2520 {
2521 ASSERT(result.isRectBasedTest()); 2521 ASSERT(result.isRectBasedTest());
2522 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame()); 2522 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame());
2523 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox()); 2523 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox());
2524 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2524 HeapVector<Member<Node>, 11> nodes;
2525 copyToVector(result.listBasedTestResult(), nodes); 2525 copyToVector(result.listBasedTestResult(), nodes);
2526 2526
2527 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2527 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2528 return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, to uchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes)); 2528 return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, to uchRect, HeapVector<Member<Node>>(nodes));
2529 } 2529 }
2530 2530
2531 bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co nst IntSize& touchRadius, IntRect& targetArea, Node*& targetNode) 2531 bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co nst IntSize& touchRadius, IntRect& targetArea, Node*& targetNode)
2532 { 2532 {
2533 if (touchRadius.isEmpty()) 2533 if (touchRadius.isEmpty())
2534 return false; 2534 return false;
2535 2535
2536 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(touchCenter); 2536 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(touchCenter);
2537 2537
2538 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | HitTestRequest::ListBased; 2538 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | HitTestRequest::ListBased;
2539 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSiz e(touchRadius)); 2539 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSiz e(touchRadius));
2540 2540
2541 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius); 2541 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
2542 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2542 HeapVector<Member<Node>, 11> nodes;
2543 copyToVector(result.listBasedTestResult(), nodes); 2543 copyToVector(result.listBasedTestResult(), nodes);
2544 2544
2545 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2545 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2546 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes)); 2546 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, HeapVector<Member<Node>>(nodes));
2547 } 2547 }
2548 2548
2549 // Update the hover and active state across all frames for this gesture. 2549 // Update the hover and active state across all frames for this gesture.
2550 // This logic is different than the mouse case because mice send MouseLeave even ts to frames as they're exited. 2550 // This logic is different than the mouse case because mice send MouseLeave even ts to frames as they're exited.
2551 // With gestures, a single event conceptually both 'leaves' whatever frame curre ntly had hover and enters a new frame 2551 // With gestures, a single event conceptually both 'leaves' whatever frame curre ntly had hover and enters a new frame
2552 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request, Element* innerElement) 2552 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request, Element* innerElement)
2553 { 2553 {
2554 ASSERT(m_frame == m_frame->localFrameRoot()); 2554 ASSERT(m_frame == m_frame->localFrameRoot());
2555 2555
2556 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> newHoverFrameChain; 2556 HeapVector<Member<LocalFrame>> newHoverFrameChain;
2557 LocalFrame* newHoverFrameInDocument = innerElement ? innerElement->document( ).frame() : nullptr; 2557 LocalFrame* newHoverFrameInDocument = innerElement ? innerElement->document( ).frame() : nullptr;
2558 // Insert the ancestors of the frame having the new hovered node to the fram e chain 2558 // Insert the ancestors of the frame having the new hovered node to the fram e chain
2559 // The frame chain doesn't include the main frame to avoid the redundant wor k that cleans the hover state. 2559 // The frame chain doesn't include the main frame to avoid the redundant wor k that cleans the hover state.
2560 // Because the hover state for the main frame is updated by calling Document ::updateHoverActiveState 2560 // Because the hover state for the main frame is updated by calling Document ::updateHoverActiveState
2561 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) { 2561 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) {
2562 newHoverFrameChain.append(newHoverFrameInDocument); 2562 newHoverFrameChain.append(newHoverFrameInDocument);
2563 Frame* parentFrame = newHoverFrameInDocument->tree().parent(); 2563 Frame* parentFrame = newHoverFrameInDocument->tree().parent();
2564 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? t oLocalFrame(parentFrame) : nullptr; 2564 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? t oLocalFrame(parentFrame) : nullptr;
2565 } 2565 }
2566 2566
2567 RefPtrWillBeRawPtr<Node> oldHoverNodeInCurDoc = m_frame->document()->hoverNo de(); 2567 RawPtr<Node> oldHoverNodeInCurDoc = m_frame->document()->hoverNode();
2568 RefPtrWillBeRawPtr<Node> newInnermostHoverNode = innerElement; 2568 RawPtr<Node> newInnermostHoverNode = innerElement;
2569 2569
2570 if (newInnermostHoverNode != oldHoverNodeInCurDoc) { 2570 if (newInnermostHoverNode != oldHoverNodeInCurDoc) {
2571 size_t indexFrameChain = newHoverFrameChain.size(); 2571 size_t indexFrameChain = newHoverFrameChain.size();
2572 2572
2573 // Clear the hover state on any frames which are no longer in the frame chain of the hovered elemen 2573 // Clear the hover state on any frames which are no longer in the frame chain of the hovered elemen
2574 while (oldHoverNodeInCurDoc && oldHoverNodeInCurDoc->isFrameOwnerElement ()) { 2574 while (oldHoverNodeInCurDoc && oldHoverNodeInCurDoc->isFrameOwnerElement ()) {
2575 LocalFrame* newHoverFrame = nullptr; 2575 LocalFrame* newHoverFrame = nullptr;
2576 // If we can't get the frame from the new hover frame chain, 2576 // If we can't get the frame from the new hover frame chain,
2577 // the newHoverFrame will be null and the old hover state will be cl eared. 2577 // the newHoverFrame will be null and the old hover state will be cl eared.
2578 if (indexFrameChain > 0) 2578 if (indexFrameChain > 0)
(...skipping 27 matching lines...) Expand all
2606 ASSERT(m_frame == m_frame->localFrameRoot()); 2606 ASSERT(m_frame == m_frame->localFrameRoot());
2607 2607
2608 // Behaviour of this function is as follows: 2608 // Behaviour of this function is as follows:
2609 // - Create the chain of all entered frames. 2609 // - Create the chain of all entered frames.
2610 // - Compare the last frame chain under the gesture to newly entered frame c hain from the main frame one by one. 2610 // - Compare the last frame chain under the gesture to newly entered frame c hain from the main frame one by one.
2611 // - If the last frame doesn't match with the entered frame, then create the chain of exited frames from the last frame chain. 2611 // - If the last frame doesn't match with the entered frame, then create the chain of exited frames from the last frame chain.
2612 // - Dispatch mouseout/mouseleave events of the exited frames from the insid e out. 2612 // - Dispatch mouseout/mouseleave events of the exited frames from the insid e out.
2613 // - Dispatch mouseover/mouseenter events of the entered frames into the ins ide. 2613 // - Dispatch mouseover/mouseenter events of the entered frames into the ins ide.
2614 2614
2615 // Insert the ancestors of the frame having the new target node to the enter ed frame chain 2615 // Insert the ancestors of the frame having the new target node to the enter ed frame chain
2616 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> enteredFrameChain; 2616 HeapVector<Member<LocalFrame>> enteredFrameChain;
2617 LocalFrame* enteredFrameInDocument = targetedEvent.hitTestResult().innerNode Frame(); 2617 LocalFrame* enteredFrameInDocument = targetedEvent.hitTestResult().innerNode Frame();
2618 while (enteredFrameInDocument) { 2618 while (enteredFrameInDocument) {
2619 enteredFrameChain.append(enteredFrameInDocument); 2619 enteredFrameChain.append(enteredFrameInDocument);
2620 Frame* parentFrame = enteredFrameInDocument->tree().parent(); 2620 Frame* parentFrame = enteredFrameInDocument->tree().parent();
2621 enteredFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? to LocalFrame(parentFrame) : nullptr; 2621 enteredFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? to LocalFrame(parentFrame) : nullptr;
2622 } 2622 }
2623 2623
2624 size_t indexEnteredFrameChain = enteredFrameChain.size(); 2624 size_t indexEnteredFrameChain = enteredFrameChain.size();
2625 LocalFrame* exitedFrameInDocument = m_frame; 2625 LocalFrame* exitedFrameInDocument = m_frame;
2626 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> exitedFrameChain; 2626 HeapVector<Member<LocalFrame>> exitedFrameChain;
2627 // Insert the frame from the disagreement between last frames and entered fr ames 2627 // Insert the frame from the disagreement between last frames and entered fr ames
2628 while (exitedFrameInDocument) { 2628 while (exitedFrameInDocument) {
2629 Node* lastNodeUnderTap = exitedFrameInDocument->eventHandler().m_nodeUnd erMouse.get(); 2629 Node* lastNodeUnderTap = exitedFrameInDocument->eventHandler().m_nodeUnd erMouse.get();
2630 if (!lastNodeUnderTap) 2630 if (!lastNodeUnderTap)
2631 break; 2631 break;
2632 2632
2633 LocalFrame* nextExitedFrameInDocument = nullptr; 2633 LocalFrame* nextExitedFrameInDocument = nullptr;
2634 if (lastNodeUnderTap->isFrameOwnerElement()) { 2634 if (lastNodeUnderTap->isFrameOwnerElement()) {
2635 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(lastNodeUnder Tap); 2635 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(lastNodeUnder Tap);
2636 if (owner->contentFrame() && owner->contentFrame()->isLocalFrame()) 2636 if (owner->contentFrame() && owner->contentFrame()->isLocalFrame())
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 String key = evt.unmodifiedText(); 3078 String key = evt.unmodifiedText();
3079 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); 3079 Element* elem = m_frame->document()->getElementByAccessKey(key.lower());
3080 if (!elem) 3080 if (!elem)
3081 return false; 3081 return false;
3082 elem->accessKeyAction(false); 3082 elem->accessKeyAction(false);
3083 return true; 3083 return true;
3084 } 3084 }
3085 3085
3086 WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK eyEvent) 3086 WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK eyEvent)
3087 { 3087 {
3088 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 3088 RawPtr<FrameView> protector(m_frame->view());
3089 m_frame->chromeClient().clearToolTip(); 3089 m_frame->chromeClient().clearToolTip();
3090 3090
3091 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) 3091 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL)
3092 capsLockStateMayHaveChanged(); 3092 capsLockStateMayHaveChanged();
3093 3093
3094 #if OS(WIN) 3094 #if OS(WIN)
3095 if (panScrollInProgress()) { 3095 if (panScrollInProgress()) {
3096 // If a key is pressed while the panScroll is in progress then we want t o stop 3096 // If a key is pressed while the panScroll is in progress then we want t o stop
3097 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent. type() == PlatformEvent::RawKeyDown) 3097 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent. type() == PlatformEvent::RawKeyDown)
3098 stopAutoscroll(); 3098 stopAutoscroll();
3099 3099
3100 // If we were in panscroll mode, we swallow the key event 3100 // If we were in panscroll mode, we swallow the key event
3101 return WebInputEventResult::HandledSuppressed; 3101 return WebInputEventResult::HandledSuppressed;
3102 } 3102 }
3103 #endif 3103 #endif
3104 3104
3105 // Check for cases where we are too early for events -- possible unmatched k ey up 3105 // Check for cases where we are too early for events -- possible unmatched k ey up
3106 // from pressing return in the location bar. 3106 // from pressing return in the location bar.
3107 RefPtrWillBeRawPtr<Node> node = eventTargetNodeForDocument(m_frame->document ()); 3107 RawPtr<Node> node = eventTargetNodeForDocument(m_frame->document());
3108 if (!node) 3108 if (!node)
3109 return WebInputEventResult::NotHandled; 3109 return WebInputEventResult::NotHandled;
3110 3110
3111 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 3111 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
3112 3112
3113 // In IE, access keys are special, they are handled after default keydown pr ocessing, but cannot be canceled - this is hard to match. 3113 // In IE, access keys are special, they are handled after default keydown pr ocessing, but cannot be canceled - this is hard to match.
3114 // On Mac OS X, we process them before dispatching keydown, as the default k eydown handler implements Emacs key bindings, which may conflict 3114 // On Mac OS X, we process them before dispatching keydown, as the default k eydown handler implements Emacs key bindings, which may conflict
3115 // with access keys. Then we dispatch keydown, but suppress its default hand ling. 3115 // with access keys. Then we dispatch keydown, but suppress its default hand ling.
3116 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch ing a keypress event for WM_SYSCHAR messages. 3116 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch ing a keypress event for WM_SYSCHAR messages.
3117 // Other platforms currently match either Mac or Windows behavior, depending on whether they send combined KeyDown events. 3117 // Other platforms currently match either Mac or Windows behavior, depending on whether they send combined KeyDown events.
3118 bool matchedAnAccessKey = false; 3118 bool matchedAnAccessKey = false;
3119 if (initialKeyEvent.type() == PlatformEvent::KeyDown) 3119 if (initialKeyEvent.type() == PlatformEvent::KeyDown)
3120 matchedAnAccessKey = handleAccessKey(initialKeyEvent); 3120 matchedAnAccessKey = handleAccessKey(initialKeyEvent);
3121 3121
3122 // FIXME: it would be fair to let an input method handle KeyUp events before DOM dispatch. 3122 // FIXME: it would be fair to let an input method handle KeyUp events before DOM dispatch.
3123 if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type() == PlatformEvent::Char) { 3123 if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type() == PlatformEvent::Char) {
3124 RefPtrWillBeRawPtr<KeyboardEvent> domEvent = KeyboardEvent::create(initi alKeyEvent, m_frame->document()->domWindow()); 3124 RawPtr<KeyboardEvent> domEvent = KeyboardEvent::create(initialKeyEvent, m_frame->document()->domWindow());
3125 3125
3126 return toWebInputEventResult(node->dispatchEvent(domEvent)); 3126 return toWebInputEventResult(node->dispatchEvent(domEvent));
3127 } 3127 }
3128 3128
3129 PlatformKeyboardEvent keyDownEvent = initialKeyEvent; 3129 PlatformKeyboardEvent keyDownEvent = initialKeyEvent;
3130 if (keyDownEvent.type() != PlatformEvent::RawKeyDown) 3130 if (keyDownEvent.type() != PlatformEvent::RawKeyDown)
3131 keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); 3131 keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
3132 RefPtrWillBeRawPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEve nt, m_frame->document()->domWindow()); 3132 RawPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEvent, m_frame- >document()->domWindow());
3133 if (matchedAnAccessKey) 3133 if (matchedAnAccessKey)
3134 keydown->setDefaultPrevented(true); 3134 keydown->setDefaultPrevented(true);
3135 keydown->setTarget(node); 3135 keydown->setTarget(node);
3136 3136
3137 DispatchEventResult dispatchResult = node->dispatchEvent(keydown); 3137 DispatchEventResult dispatchResult = node->dispatchEvent(keydown);
3138 if (dispatchResult != DispatchEventResult::NotCanceled) 3138 if (dispatchResult != DispatchEventResult::NotCanceled)
3139 return toWebInputEventResult(dispatchResult); 3139 return toWebInputEventResult(dispatchResult);
3140 // If frame changed as a result of keydown dispatch, then return early to av oid sending a subsequent keypress message to the new frame. 3140 // If frame changed as a result of keydown dispatch, then return early to av oid sending a subsequent keypress message to the new frame.
3141 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->fo cusController().focusedOrMainFrame(); 3141 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->fo cusController().focusedOrMainFrame();
3142 if (changedFocusedFrame) 3142 if (changedFocusedFrame)
3143 return WebInputEventResult::HandledSystem; 3143 return WebInputEventResult::HandledSystem;
3144 3144
3145 if (initialKeyEvent.type() == PlatformEvent::RawKeyDown) 3145 if (initialKeyEvent.type() == PlatformEvent::RawKeyDown)
3146 return WebInputEventResult::NotHandled; 3146 return WebInputEventResult::NotHandled;
3147 3147
3148 // Focus may have changed during keydown handling, so refetch node. 3148 // Focus may have changed during keydown handling, so refetch node.
3149 // But if we are dispatching a fake backward compatibility keypress, then we pretend that the keypress happened on the original node. 3149 // But if we are dispatching a fake backward compatibility keypress, then we pretend that the keypress happened on the original node.
3150 node = eventTargetNodeForDocument(m_frame->document()); 3150 node = eventTargetNodeForDocument(m_frame->document());
3151 if (!node) 3151 if (!node)
3152 return WebInputEventResult::NotHandled; 3152 return WebInputEventResult::NotHandled;
3153 3153
3154 PlatformKeyboardEvent keyPressEvent = initialKeyEvent; 3154 PlatformKeyboardEvent keyPressEvent = initialKeyEvent;
3155 keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char); 3155 keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char);
3156 if (keyPressEvent.text().isEmpty()) 3156 if (keyPressEvent.text().isEmpty())
3157 return WebInputEventResult::NotHandled; 3157 return WebInputEventResult::NotHandled;
3158 RefPtrWillBeRawPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressE vent, m_frame->document()->domWindow()); 3158 RawPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressEvent, m_fram e->document()->domWindow());
3159 keypress->setTarget(node); 3159 keypress->setTarget(node);
3160 return toWebInputEventResult(node->dispatchEvent(keypress)); 3160 return toWebInputEventResult(node->dispatchEvent(keypress));
3161 } 3161 }
3162 3162
3163 static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier) 3163 static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier)
3164 { 3164 {
3165 DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down", AtomicString::ConstructFrom Literal)); 3165 DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down", AtomicString::ConstructFrom Literal));
3166 DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up", AtomicString::ConstructFromLite ral)); 3166 DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up", AtomicString::ConstructFromLite ral));
3167 DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left", AtomicString::ConstructFrom Literal)); 3167 DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left", AtomicString::ConstructFrom Literal));
3168 DEFINE_STATIC_LOCAL(AtomicString, Right, ("Right", AtomicString::ConstructFr omLiteral)); 3168 DEFINE_STATIC_LOCAL(AtomicString, Right, ("Right", AtomicString::ConstructFr omLiteral));
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3392 return false; 3392 return false;
3393 3393
3394 EventTarget* target; 3394 EventTarget* target;
3395 if (underlyingEvent) 3395 if (underlyingEvent)
3396 target = underlyingEvent->target(); 3396 target = underlyingEvent->target();
3397 else 3397 else
3398 target = eventTargetNodeForDocument(m_frame->document()); 3398 target = eventTargetNodeForDocument(m_frame->document());
3399 if (!target) 3399 if (!target)
3400 return false; 3400 return false;
3401 3401
3402 RefPtrWillBeRawPtr<TextEvent> event = TextEvent::create(m_frame->domWindow() , text, inputType); 3402 RawPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inpu tType);
3403 event->setUnderlyingEvent(underlyingEvent); 3403 event->setUnderlyingEvent(underlyingEvent);
3404 3404
3405 target->dispatchEvent(event); 3405 target->dispatchEvent(event);
3406 return event->defaultHandled() || event->defaultPrevented(); 3406 return event->defaultHandled() || event->defaultPrevented();
3407 } 3407 }
3408 3408
3409 void EventHandler::defaultTextInputEventHandler(TextEvent* event) 3409 void EventHandler::defaultTextInputEventHandler(TextEvent* event)
3410 { 3410 {
3411 if (m_frame->editor().handleTextEvent(event)) 3411 if (m_frame->editor().handleTextEvent(event))
3412 event->setDefaultHandled(); 3412 event->setDefaultHandled();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 if (frame->view()) { 3559 if (frame->view()) {
3560 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); 3560 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars);
3561 if (!rect.contains(roundedIntPoint(point))) 3561 if (!rect.contains(roundedIntPoint(point)))
3562 return result; 3562 return result;
3563 } 3563 }
3564 frame->contentLayoutObject()->hitTest(result); 3564 frame->contentLayoutObject()->hitTest(result);
3565 return result; 3565 return result;
3566 } 3566 }
3567 3567
3568 void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, 3568 void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event,
3569 WillBeHeapVector<TouchInfo>& touchInfos) 3569 HeapVector<TouchInfo>& touchInfos)
3570 { 3570 {
3571 if (!RuntimeEnabledFeatures::pointerEventEnabled()) 3571 if (!RuntimeEnabledFeatures::pointerEventEnabled())
3572 return; 3572 return;
3573 3573
3574 // Iterate through the touch points, sending PointerEvents to the targets as required. 3574 // Iterate through the touch points, sending PointerEvents to the targets as required.
3575 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3575 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3576 TouchInfo& touchInfo = touchInfos[i]; 3576 TouchInfo& touchInfo = touchInfos[i];
3577 const PlatformTouchPoint& touchPoint = touchInfo.point; 3577 const PlatformTouchPoint& touchPoint = touchInfo.point;
3578 3578
3579 3579
3580 if (touchPoint.state() == PlatformTouchPoint::TouchStationary 3580 if (touchPoint.state() == PlatformTouchPoint::TouchStationary
3581 || !touchInfo.knownTarget) 3581 || !touchInfo.knownTarget)
3582 continue; 3582 continue;
3583 3583
3584 WebInputEventResult result = 3584 WebInputEventResult result =
3585 m_pointerEventManager.sendTouchPointerEvent( 3585 m_pointerEventManager.sendTouchPointerEvent(
3586 touchInfo.touchTarget, touchPoint, event.getModifiers(), 3586 touchInfo.touchTarget, touchPoint, event.getModifiers(),
3587 touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(), 3587 touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(),
3588 touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y()); 3588 touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y());
3589 touchInfo.consumed = result != WebInputEventResult::NotHandled; 3589 touchInfo.consumed = result != WebInputEventResult::NotHandled;
3590 } 3590 }
3591 } 3591 }
3592 3592
3593 void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos) 3593 void EventHandler::sendPointerCancels(HeapVector<TouchInfo>& touchInfos)
3594 { 3594 {
3595 if (!RuntimeEnabledFeatures::pointerEventEnabled()) 3595 if (!RuntimeEnabledFeatures::pointerEventEnabled())
3596 return; 3596 return;
3597 3597
3598 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3598 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3599 TouchInfo& touchInfo = touchInfos[i]; 3599 TouchInfo& touchInfo = touchInfos[i];
3600 const PlatformTouchPoint& point = touchInfo.point; 3600 const PlatformTouchPoint& point = touchInfo.point;
3601 const PlatformTouchPoint::TouchState pointState = point.state(); 3601 const PlatformTouchPoint::TouchState pointState = point.state();
3602 3602
3603 if (pointState == PlatformTouchPoint::TouchReleased 3603 if (pointState == PlatformTouchPoint::TouchReleased
(...skipping 13 matching lines...) Expand all
3617 // that the local class doesn't provide a local definition for 'operator new'. 3617 // that the local class doesn't provide a local definition for 'operator new'.
3618 // Which it intentionally doesn't and shouldn't. 3618 // Which it intentionally doesn't and shouldn't.
3619 // 3619 //
3620 // Work around such toolchain bugginess by lifting out the type, thereby 3620 // Work around such toolchain bugginess by lifting out the type, thereby
3621 // taking it out of C4822's reach. 3621 // taking it out of C4822's reach.
3622 class ChangedTouches final { 3622 class ChangedTouches final {
3623 STACK_ALLOCATED(); 3623 STACK_ALLOCATED();
3624 public: 3624 public:
3625 // The touches corresponding to the particular change state this struct 3625 // The touches corresponding to the particular change state this struct
3626 // instance represents. 3626 // instance represents.
3627 RefPtrWillBeMember<TouchList> m_touches; 3627 Member<TouchList> m_touches;
3628 3628
3629 using EventTargetSet = WillBeHeapHashSet<RefPtrWillBeMember<EventTarget>>; 3629 using EventTargetSet = HeapHashSet<Member<EventTarget>>;
3630 // Set of targets involved in m_touches. 3630 // Set of targets involved in m_touches.
3631 EventTargetSet m_targets; 3631 EventTargetSet m_targets;
3632 }; 3632 };
3633 3633
3634 } // namespace 3634 } // namespace
3635 3635
3636 WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent& event, 3636 WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent& event,
3637 WillBeHeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouc hReleased) 3637 HeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouchRelea sed)
3638 { 3638 {
3639 // Build up the lists to use for the 'touches', 'targetTouches' and 3639 // Build up the lists to use for the 'touches', 'targetTouches' and
3640 // 'changedTouches' attributes in the JS event. See 3640 // 'changedTouches' attributes in the JS event. See
3641 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these 3641 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these
3642 // lists fit together. 3642 // lists fit together.
3643 3643
3644 // Holds the complete set of touches on the screen. 3644 // Holds the complete set of touches on the screen.
3645 RefPtrWillBeRawPtr<TouchList> touches = TouchList::create(); 3645 RawPtr<TouchList> touches = TouchList::create();
3646 3646
3647 // A different view on the 'touches' list above, filtered and grouped by 3647 // A different view on the 'touches' list above, filtered and grouped by
3648 // event target. Used for the 'targetTouches' list in the JS event. 3648 // event target. Used for the 'targetTouches' list in the JS event.
3649 using TargetTouchesHeapMap = WillBeHeapHashMap<EventTarget*, RefPtrWillBeMem ber<TouchList>>; 3649 using TargetTouchesHeapMap = HeapHashMap<EventTarget*, Member<TouchList>>;
3650 TargetTouchesHeapMap touchesByTarget; 3650 TargetTouchesHeapMap touchesByTarget;
3651 3651
3652 // Array of touches per state, used to assemble the 'changedTouches' list. 3652 // Array of touches per state, used to assemble the 'changedTouches' list.
3653 ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd]; 3653 ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd];
3654 3654
3655 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3655 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3656 const TouchInfo& touchInfo = touchInfos[i]; 3656 const TouchInfo& touchInfo = touchInfos[i];
3657 const PlatformTouchPoint& point = touchInfo.point; 3657 const PlatformTouchPoint& point = touchInfo.point;
3658 PlatformTouchPoint::TouchState pointState = point.state(); 3658 PlatformTouchPoint::TouchState pointState = point.state();
3659 3659
3660 if (touchInfo.consumed) 3660 if (touchInfo.consumed)
3661 continue; 3661 continue;
3662 3662
3663 RefPtrWillBeRawPtr<Touch> touch = Touch::create( 3663 RawPtr<Touch> touch = Touch::create(
3664 touchInfo.targetFrame.get(), 3664 touchInfo.targetFrame.get(),
3665 touchInfo.touchTarget.get(), 3665 touchInfo.touchTarget.get(),
3666 point.id(), 3666 point.id(),
3667 point.screenPos(), 3667 point.screenPos(),
3668 touchInfo.adjustedPagePoint, 3668 touchInfo.adjustedPagePoint,
3669 touchInfo.adjustedRadius, 3669 touchInfo.adjustedRadius,
3670 point.rotationAngle(), 3670 point.rotationAngle(),
3671 point.force(), 3671 point.force(),
3672 touchInfo.region); 3672 touchInfo.region);
3673 3673
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3710 3710
3711 // Now iterate through the changedTouches list and m_targets within it, send ing 3711 // Now iterate through the changedTouches list and m_targets within it, send ing
3712 // TouchEvents to the targets as required. 3712 // TouchEvents to the targets as required.
3713 for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state ) { 3713 for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state ) {
3714 if (!changedTouches[state].m_touches) 3714 if (!changedTouches[state].m_touches)
3715 continue; 3715 continue;
3716 3716
3717 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca st<PlatformTouchPoint::TouchState>(state))); 3717 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca st<PlatformTouchPoint::TouchState>(state)));
3718 for (const auto& eventTarget : changedTouches[state].m_targets) { 3718 for (const auto& eventTarget : changedTouches[state].m_targets) {
3719 EventTarget* touchEventTarget = eventTarget.get(); 3719 EventTarget* touchEventTarget = eventTarget.get();
3720 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create( 3720 RawPtr<TouchEvent> touchEvent = TouchEvent::create(
3721 touches.get(), touchesByTarget.get(touchEventTarget), changedTou ches[state].m_touches.get(), 3721 touches.get(), touchesByTarget.get(touchEventTarget), changedTou ches[state].m_touches.get(),
3722 eventName, touchEventTarget->toNode()->document().domWindow(), 3722 eventName, touchEventTarget->toNode()->document().domWindow(),
3723 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp()); 3723 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp());
3724 3724
3725 eventResult = mergeEventResult(eventResult, toWebInputEventResult(to uchEventTarget->dispatchEvent(touchEvent.get()))); 3725 eventResult = mergeEventResult(eventResult, toWebInputEventResult(to uchEventTarget->dispatchEvent(touchEvent.get())));
3726 } 3726 }
3727 } 3727 }
3728 3728
3729 return eventResult; 3729 return eventResult;
3730 } 3730 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 // this work. 3835 // this work.
3836 if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !ha sTouchHandlers(m_touchSequenceDocument->frameHost()->eventHandlerRegistry()) || !m_touchSequenceDocument->frame()) { 3836 if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !ha sTouchHandlers(m_touchSequenceDocument->frameHost()->eventHandlerRegistry()) || !m_touchSequenceDocument->frame()) {
3837 if (allTouchReleased) { 3837 if (allTouchReleased) {
3838 m_touchSequenceDocument.clear(); 3838 m_touchSequenceDocument.clear();
3839 m_touchSequenceUserGestureToken.clear(); 3839 m_touchSequenceUserGestureToken.clear();
3840 } 3840 }
3841 return WebInputEventResult::NotHandled; 3841 return WebInputEventResult::NotHandled;
3842 } 3842 }
3843 3843
3844 // Compute and store the common info used by both PointerEvent and TouchEven t. 3844 // Compute and store the common info used by both PointerEvent and TouchEven t.
3845 WillBeHeapVector<TouchInfo> touchInfos(points.size()); 3845 HeapVector<TouchInfo> touchInfos(points.size());
3846 3846
3847 for (unsigned i = 0; i < points.size(); ++i) { 3847 for (unsigned i = 0; i < points.size(); ++i) {
3848 const PlatformTouchPoint& point = points[i]; 3848 const PlatformTouchPoint& point = points[i];
3849 PlatformTouchPoint::TouchState pointState = point.state(); 3849 PlatformTouchPoint::TouchState pointState = point.state();
3850 RefPtrWillBeRawPtr<EventTarget> touchTarget = nullptr; 3850 RawPtr<EventTarget> touchTarget = nullptr;
3851 String regionID; 3851 String regionID;
3852 3852
3853 if (pointState == PlatformTouchPoint::TouchReleased || pointState == Pla tformTouchPoint::TouchCancelled) { 3853 if (pointState == PlatformTouchPoint::TouchReleased || pointState == Pla tformTouchPoint::TouchCancelled) {
3854 // The target should be the original target for this touch, so get 3854 // The target should be the original target for this touch, so get
3855 // it from the hashmap. As it's a release or cancel we also remove 3855 // it from the hashmap. As it's a release or cancel we also remove
3856 // it from the map. 3856 // it from the map.
3857 touchTarget = m_targetForTouchID.take(point.id()); 3857 touchTarget = m_targetForTouchID.take(point.id());
3858 regionID = m_regionForTouchID.take(point.id()); 3858 regionID = m_regionForTouchID.take(point.id());
3859 } else { 3859 } else {
3860 // No hittest is performed on move or stationary, since the target 3860 // No hittest is performed on move or stationary, since the target
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3988 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3988 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3989 { 3989 {
3990 #if OS(MACOSX) 3990 #if OS(MACOSX)
3991 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3991 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3992 #else 3992 #else
3993 return PlatformEvent::AltKey; 3993 return PlatformEvent::AltKey;
3994 #endif 3994 #endif
3995 } 3995 }
3996 3996
3997 } // namespace blink 3997 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/input/EventHandlerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698