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

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

Issue 1853743005: Oilpan: Remove WillBe types (part 13) (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->contentLayoutItem ().isNull()) { 1710 if (targetedEvent.hitTestResult().scrollbar() && !m_frame->contentLayoutItem ().isNull()) {
(...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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); 1953 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t);
1954 1954
1955 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? 1955 // No hit test result, handle in root instance. Perhaps we should just retur n false instead?
1956 return handleGestureEventInFrame(targetedEvent); 1956 return handleGestureEventInFrame(targetedEvent);
1957 } 1957 }
1958 1958
1959 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi thHitTestResults& targetedEvent) 1959 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi thHitTestResults& targetedEvent)
1960 { 1960 {
1961 ASSERT(!targetedEvent.event().isScrollEvent()); 1961 ASSERT(!targetedEvent.event().isScrollEvent());
1962 1962
1963 RefPtrWillBeRawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNo de(); 1963 RawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNode();
1964 RefPtrWillBeRawPtr<Scrollbar> scrollbar = targetedEvent.hitTestResult().scro llbar(); 1964 RawPtr<Scrollbar> scrollbar = targetedEvent.hitTestResult().scrollbar();
1965 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 1965 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
1966 1966
1967 if (scrollbar) { 1967 if (scrollbar) {
1968 bool shouldUpdateCapture = false; 1968 bool shouldUpdateCapture = false;
1969 if (scrollbar->gestureEvent(gestureEvent, &shouldUpdateCapture)) { 1969 if (scrollbar->gestureEvent(gestureEvent, &shouldUpdateCapture)) {
1970 if (shouldUpdateCapture) 1970 if (shouldUpdateCapture)
1971 m_scrollbarHandlingScrollGesture = scrollbar; 1971 m_scrollbarHandlingScrollGesture = scrollbar;
1972 return WebInputEventResult::HandledSuppressed; 1972 return WebInputEventResult::HandledSuppressed;
1973 } 1973 }
1974 } 1974 }
1975 1975
1976 if (eventTarget) { 1976 if (eventTarget) {
1977 RefPtrWillBeRawPtr<GestureEvent> gestureDomEvent = GestureEvent::create( eventTarget->document().domWindow(), gestureEvent); 1977 RawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(eventTarget- >document().domWindow(), gestureEvent);
1978 if (gestureDomEvent.get()) { 1978 if (gestureDomEvent.get()) {
1979 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent); 1979 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent);
1980 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { 1980 if (gestureDomEventResult != DispatchEventResult::NotCanceled) {
1981 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler); 1981 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler);
1982 return toWebInputEventResult(gestureDomEventResult); 1982 return toWebInputEventResult(gestureDomEventResult);
1983 } 1983 }
1984 } 1984 }
1985 } 1985 }
1986 1986
1987 switch (gestureEvent.type()) { 1987 switch (gestureEvent.type()) {
(...skipping 18 matching lines...) Expand all
2006 ASSERT_NOT_REACHED(); 2006 ASSERT_NOT_REACHED();
2007 } 2007 }
2008 2008
2009 return WebInputEventResult::NotHandled; 2009 return WebInputEventResult::NotHandled;
2010 } 2010 }
2011 2011
2012 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture Event& gestureEvent) 2012 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture Event& gestureEvent)
2013 { 2013 {
2014 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); 2014 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent");
2015 2015
2016 RefPtrWillBeRawPtr<Node> eventTarget = nullptr; 2016 RawPtr<Node> eventTarget = nullptr;
2017 RefPtrWillBeRawPtr<Scrollbar> scrollbar = nullptr; 2017 RawPtr<Scrollbar> scrollbar = nullptr;
2018 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { 2018 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) {
2019 scrollbar = m_scrollbarHandlingScrollGesture.get(); 2019 scrollbar = m_scrollbarHandlingScrollGesture.get();
2020 eventTarget = m_scrollGestureHandlingNode.get(); 2020 eventTarget = m_scrollGestureHandlingNode.get();
2021 } 2021 }
2022 2022
2023 if (!eventTarget) { 2023 if (!eventTarget) {
2024 Document* document = m_frame->document(); 2024 Document* document = m_frame->document();
2025 if (!document->layoutView()) 2025 if (!document->layoutView())
2026 return WebInputEventResult::NotHandled; 2026 return WebInputEventResult::NotHandled;
2027 2027
(...skipping 20 matching lines...) Expand all
2048 m_scrollbarHandlingScrollGesture = scrollbar; 2048 m_scrollbarHandlingScrollGesture = scrollbar;
2049 return WebInputEventResult::HandledSuppressed; 2049 return WebInputEventResult::HandledSuppressed;
2050 } 2050 }
2051 m_scrollbarHandlingScrollGesture = nullptr; 2051 m_scrollbarHandlingScrollGesture = nullptr;
2052 } 2052 }
2053 2053
2054 if (eventTarget) { 2054 if (eventTarget) {
2055 if (handleScrollGestureOnResizer(eventTarget.get(), gestureEvent)) 2055 if (handleScrollGestureOnResizer(eventTarget.get(), gestureEvent))
2056 return WebInputEventResult::HandledSuppressed; 2056 return WebInputEventResult::HandledSuppressed;
2057 2057
2058 RefPtrWillBeRawPtr<GestureEvent> gestureDomEvent = GestureEvent::create( eventTarget->document().domWindow(), gestureEvent); 2058 RawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(eventTarget- >document().domWindow(), gestureEvent);
2059 if (gestureDomEvent.get()) { 2059 if (gestureDomEvent.get()) {
2060 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent); 2060 DispatchEventResult gestureDomEventResult = eventTarget->dispatchEve nt(gestureDomEvent);
2061 if (gestureDomEventResult != DispatchEventResult::NotCanceled) { 2061 if (gestureDomEventResult != DispatchEventResult::NotCanceled) {
2062 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler); 2062 ASSERT(gestureDomEventResult != DispatchEventResult::CanceledByE ventHandler);
2063 return toWebInputEventResult(gestureDomEventResult); 2063 return toWebInputEventResult(gestureDomEventResult);
2064 } 2064 }
2065 } 2065 }
2066 } 2066 }
2067 2067
2068 switch (gestureEvent.type()) { 2068 switch (gestureEvent.type()) {
2069 case PlatformEvent::GestureScrollBegin: 2069 case PlatformEvent::GestureScrollBegin:
2070 return handleGestureScrollBegin(gestureEvent); 2070 return handleGestureScrollBegin(gestureEvent);
2071 case PlatformEvent::GestureScrollUpdate: 2071 case PlatformEvent::GestureScrollUpdate:
2072 return handleGestureScrollUpdate(gestureEvent); 2072 return handleGestureScrollUpdate(gestureEvent);
2073 case PlatformEvent::GestureScrollEnd: 2073 case PlatformEvent::GestureScrollEnd:
2074 return handleGestureScrollEnd(gestureEvent); 2074 return handleGestureScrollEnd(gestureEvent);
2075 case PlatformEvent::GestureFlingStart: 2075 case PlatformEvent::GestureFlingStart:
2076 case PlatformEvent::GesturePinchBegin: 2076 case PlatformEvent::GesturePinchBegin:
2077 case PlatformEvent::GesturePinchEnd: 2077 case PlatformEvent::GesturePinchEnd:
2078 case PlatformEvent::GesturePinchUpdate: 2078 case PlatformEvent::GesturePinchUpdate:
2079 return WebInputEventResult::NotHandled; 2079 return WebInputEventResult::NotHandled;
2080 default: 2080 default:
2081 ASSERT_NOT_REACHED(); 2081 ASSERT_NOT_REACHED();
2082 return WebInputEventResult::NotHandled; 2082 return WebInputEventResult::NotHandled;
2083 } 2083 }
2084 } 2084 }
2085 2085
2086 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest Results& targetedEvent) 2086 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest Results& targetedEvent)
2087 { 2087 {
2088 RefPtrWillBeRawPtr<FrameView> frameView(m_frame->view()); 2088 RawPtr<FrameView> frameView(m_frame->view());
2089 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 2089 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
2090 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type()); 2090 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur eEvent.type());
2091 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); 2091 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion();
2092 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); 2092 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion();
2093 2093
2094 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 2094 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
2095 2095
2096 HitTestResult currentHitTest = targetedEvent.hitTestResult(); 2096 HitTestResult currentHitTest = targetedEvent.hitTestResult();
2097 2097
2098 // We use the adjusted position so the application isn't surprised to see a event with 2098 // We use the adjusted position so the application isn't surprised to see a event with
(...skipping 17 matching lines...) Expand all
2116 if (currentHitTest.innerNode()) { 2116 if (currentHitTest.innerNode()) {
2117 LocalFrame* mainFrame = m_frame->localFrameRoot(); 2117 LocalFrame* mainFrame = m_frame->localFrameRoot();
2118 if (mainFrame && mainFrame->view()) 2118 if (mainFrame && mainFrame->view())
2119 mainFrame->view()->updateAllLifecyclePhases(); 2119 mainFrame->view()->updateAllLifecyclePhases();
2120 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); 2120 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position());
2121 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); 2121 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType);
2122 } 2122 }
2123 m_clickNode = currentHitTest.innerNode(); 2123 m_clickNode = currentHitTest.innerNode();
2124 2124
2125 // Capture data for showUnhandledTapUIIfNeeded. 2125 // Capture data for showUnhandledTapUIIfNeeded.
2126 RefPtrWillBeRawPtr<Node> tappedNode = m_clickNode; 2126 RawPtr<Node> tappedNode = m_clickNode;
2127 IntPoint tappedPosition = gestureEvent.position(); 2127 IntPoint tappedPosition = gestureEvent.position();
2128 2128
2129 if (m_clickNode && m_clickNode->isTextNode()) 2129 if (m_clickNode && m_clickNode->isTextNode())
2130 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); 2130 m_clickNode = FlatTreeTraversal::parent(*m_clickNode);
2131 2131
2132 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(), 2132 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa lPosition(),
2133 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), 2133 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
2134 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown), 2134 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut tonDown),
2135 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp erties::PointerType::Mouse); 2135 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp erties::PointerType::Mouse);
2136 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames ::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown) ; 2136 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames ::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown) ;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 m_mouseDown = mouseDownEvent; 2209 m_mouseDown = mouseDownEvent;
2210 2210
2211 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1, 2211 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1,
2212 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown), 2212 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef tButtonDown),
2213 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse); 2213 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W ebPointerProperties::PointerType::Mouse);
2214 HitTestRequest request(HitTestRequest::ReadOnly); 2214 HitTestRequest request(HitTestRequest::ReadOnly);
2215 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); 2215 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent);
2216 m_mouseDownMayStartDrag = true; 2216 m_mouseDownMayStartDrag = true;
2217 dragState().m_dragSrc = nullptr; 2217 dragState().m_dragSrc = nullptr;
2218 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos ition()); 2218 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos ition());
2219 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2219 RawPtr<FrameView> protector(m_frame->view());
2220 if (handleDrag(mev, DragInitiator::Touch)) { 2220 if (handleDrag(mev, DragInitiator::Touch)) {
2221 m_longTapShouldInvokeContextMenu = true; 2221 m_longTapShouldInvokeContextMenu = true;
2222 return WebInputEventResult::HandledSystem; 2222 return WebInputEventResult::HandledSystem;
2223 } 2223 }
2224 } 2224 }
2225 2225
2226 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition()); 2226 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition());
2227 HitTestResult result = hitTestResultAtPoint(hitTestPoint); 2227 HitTestResult result = hitTestResultAtPoint(hitTestPoint);
2228 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2228 RawPtr<FrameView> protector(m_frame->view());
2229 if (selectionController().handleGestureLongPress(gestureEvent, result)) { 2229 if (selectionController().handleGestureLongPress(gestureEvent, result)) {
2230 focusDocumentView(); 2230 focusDocumentView();
2231 return WebInputEventResult::HandledSystem; 2231 return WebInputEventResult::HandledSystem;
2232 } 2232 }
2233 2233
2234 return sendContextMenuEventForGesture(targetedEvent); 2234 return sendContextMenuEventForGesture(targetedEvent);
2235 } 2235 }
2236 2236
2237 WebInputEventResult EventHandler::handleGestureLongTap(const GestureEventWithHit TestResults& targetedEvent) 2237 WebInputEventResult EventHandler::handleGestureLongTap(const GestureEventWithHit TestResults& targetedEvent)
2238 { 2238 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 Widget* widget = toLayoutPart(layoutObject)->widget(); 2282 Widget* widget = toLayoutPart(layoutObject)->widget();
2283 2283
2284 if (!widget || !widget->isFrameView()) 2284 if (!widget || !widget->isFrameView())
2285 return WebInputEventResult::NotHandled; 2285 return WebInputEventResult::NotHandled;
2286 2286
2287 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent( gestureEvent); 2287 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent( gestureEvent);
2288 } 2288 }
2289 2289
2290 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent) 2290 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent)
2291 { 2291 {
2292 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode; 2292 RawPtr<Node> node = m_scrollGestureHandlingNode;
2293 2293
2294 if (node) { 2294 if (node) {
2295 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); 2295 passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
2296 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2296 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2297 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta()); 2297 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2298 scrollStateData->is_ending = true; 2298 scrollStateData->is_ending = true;
2299 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); 2299 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2300 scrollStateData->from_user_input = true; 2300 scrollStateData->from_user_input = true;
2301 scrollStateData->is_direct_manipulation = true; 2301 scrollStateData->is_direct_manipulation = true;
2302 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence; 2302 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2303 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(sc rollStateData.release()); 2303 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateDat a.release());
2304 customizedScroll(*node.get(), *scrollState); 2304 customizedScroll(*node.get(), *scrollState);
2305 } 2305 }
2306 } 2306 }
2307 2307
2308 clearGestureScrollState(); 2308 clearGestureScrollState();
2309 return WebInputEventResult::NotHandled; 2309 return WebInputEventResult::NotHandled;
2310 } 2310 }
2311 2311
2312 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent) 2312 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent)
2313 { 2313 {
(...skipping 20 matching lines...) Expand all
2334 2334
2335 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject()); 2335 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject());
2336 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2336 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2337 m_currentScrollChain.clear(); 2337 m_currentScrollChain.clear();
2338 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData() ); 2338 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData() );
2339 scrollStateData->start_position_x = gestureEvent.position().x(); 2339 scrollStateData->start_position_x = gestureEvent.position().x();
2340 scrollStateData->start_position_y = gestureEvent.position().y(); 2340 scrollStateData->start_position_y = gestureEvent.position().y();
2341 scrollStateData->is_beginning = true; 2341 scrollStateData->is_beginning = true;
2342 scrollStateData->from_user_input = true; 2342 scrollStateData->from_user_input = true;
2343 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedFor ScrollSequence; 2343 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedFor ScrollSequence;
2344 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(scroll StateData.release()); 2344 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateData.re lease());
2345 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); 2345 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState);
2346 } else { 2346 } else {
2347 if (m_frame->isMainFrame()) 2347 if (m_frame->isMainFrame())
2348 m_frame->host()->topControls().scrollBegin(); 2348 m_frame->host()->topControls().scrollBegin();
2349 } 2349 }
2350 return WebInputEventResult::HandledSystem; 2350 return WebInputEventResult::HandledSystem;
2351 } 2351 }
2352 2352
2353 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) 2353 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
2354 { 2354 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 ScrollGranularity granularity = gestureEvent.deltaUnits(); 2397 ScrollGranularity granularity = gestureEvent.deltaUnits();
2398 Node* node = m_scrollGestureHandlingNode.get(); 2398 Node* node = m_scrollGestureHandlingNode.get();
2399 2399
2400 // Scroll customization is only available for touch. 2400 // Scroll customization is only available for touch.
2401 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen; 2401 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen;
2402 if (node) { 2402 if (node) {
2403 LayoutObject* layoutObject = node->layoutObject(); 2403 LayoutObject* layoutObject = node->layoutObject();
2404 if (!layoutObject) 2404 if (!layoutObject)
2405 return WebInputEventResult::NotHandled; 2405 return WebInputEventResult::NotHandled;
2406 2406
2407 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2407 RawPtr<FrameView> protector(m_frame->view());
2408 2408
2409 // Try to send the event to the correct view. 2409 // Try to send the event to the correct view.
2410 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent , layoutObject); 2410 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent , layoutObject);
2411 if (result != WebInputEventResult::NotHandled) { 2411 if (result != WebInputEventResult::NotHandled) {
2412 if (gestureEvent.preventPropagation() 2412 if (gestureEvent.preventPropagation()
2413 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2413 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2414 // This is an optimization which doesn't apply with 2414 // This is an optimization which doesn't apply with
2415 // scroll customization enabled. 2415 // scroll customization enabled.
2416 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; 2416 m_previousGestureScrolledNode = m_scrollGestureHandlingNode;
2417 } 2417 }
2418 // FIXME: we should allow simultaneous scrolling of nested 2418 // FIXME: we should allow simultaneous scrolling of nested
2419 // iframes along perpendicular axes. See crbug.com/466991. 2419 // iframes along perpendicular axes. See crbug.com/466991.
2420 m_deltaConsumedForScrollSequence = true; 2420 m_deltaConsumedForScrollSequence = true;
2421 return result; 2421 return result;
2422 } 2422 }
2423 2423
2424 if (handleScrollCustomization) { 2424 if (handleScrollCustomization) {
2425 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta()); 2425 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2426 scrollStateData->delta_x = delta.width(); 2426 scrollStateData->delta_x = delta.width();
2427 scrollStateData->delta_y = delta.height(); 2427 scrollStateData->delta_y = delta.height();
2428 scrollStateData->velocity_x = velocity.width(); 2428 scrollStateData->velocity_x = velocity.width();
2429 scrollStateData->velocity_y = velocity.height(); 2429 scrollStateData->velocity_y = velocity.height();
2430 scrollStateData->should_propagate = !gestureEvent.preventPropagation (); 2430 scrollStateData->should_propagate = !gestureEvent.preventPropagation ();
2431 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); 2431 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2432 scrollStateData->from_user_input = true; 2432 scrollStateData->from_user_input = true;
2433 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence; 2433 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2434 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(sc rollStateData.release()); 2434 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateDat a.release());
2435 if (m_previousGestureScrolledNode) { 2435 if (m_previousGestureScrolledNode) {
2436 // The ScrollState needs to know what the current 2436 // The ScrollState needs to know what the current
2437 // native scrolling element is, so that for an 2437 // native scrolling element is, so that for an
2438 // inertial scroll that shouldn't propagate, only the 2438 // inertial scroll that shouldn't propagate, only the
2439 // currently scrolling element responds. 2439 // currently scrolling element responds.
2440 ASSERT(m_previousGestureScrolledNode->isElementNode()); 2440 ASSERT(m_previousGestureScrolledNode->isElementNode());
2441 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); 2441 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get()));
2442 } 2442 }
2443 customizedScroll(*node, *scrollState); 2443 customizedScroll(*node, *scrollState);
2444 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); 2444 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 // DOM nodes so a touch over a scrollbar will be adjusted towards nearby nod es. This leads to things like textarea 2506 // DOM nodes so a touch over a scrollbar will be adjusted towards nearby nod es. This leads to things like textarea
2507 // scrollbars being untouchable. 2507 // scrollbars being untouchable.
2508 if (result.scrollbar()) { 2508 if (result.scrollbar()) {
2509 targetNode = 0; 2509 targetNode = 0;
2510 return false; 2510 return false;
2511 } 2511 }
2512 2512
2513 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame()); 2513 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame());
2514 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox()); 2514 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox());
2515 2515
2516 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2516 HeapVector<Member<Node>, 11> nodes;
2517 copyToVector(result.listBasedTestResult(), nodes); 2517 copyToVector(result.listBasedTestResult(), nodes);
2518 2518
2519 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2519 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2520 return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touc hRect, WillBeHeapVector<RefPtrWillBeMember<Node>> (nodes)); 2520 return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touc hRect, HeapVector<Member<Node>> (nodes));
2521 } 2521 }
2522 2522
2523 bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu lt, IntPoint& targetPoint, Node*& targetNode) 2523 bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu lt, IntPoint& targetPoint, Node*& targetNode)
2524 { 2524 {
2525 ASSERT(result.isRectBasedTest()); 2525 ASSERT(result.isRectBasedTest());
2526 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame()); 2526 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo intInMainFrame());
2527 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox()); 2527 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat ion().boundingBox());
2528 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2528 HeapVector<Member<Node>, 11> nodes;
2529 copyToVector(result.listBasedTestResult(), nodes); 2529 copyToVector(result.listBasedTestResult(), nodes);
2530 2530
2531 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2531 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2532 return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, to uchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes)); 2532 return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, to uchRect, HeapVector<Member<Node>>(nodes));
2533 } 2533 }
2534 2534
2535 bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co nst IntSize& touchRadius, IntRect& targetArea, Node*& targetNode) 2535 bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co nst IntSize& touchRadius, IntRect& targetArea, Node*& targetNode)
2536 { 2536 {
2537 if (touchRadius.isEmpty()) 2537 if (touchRadius.isEmpty())
2538 return false; 2538 return false;
2539 2539
2540 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(touchCenter); 2540 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(touchCenter);
2541 2541
2542 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | HitTestRequest::ListBased; 2542 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | HitTestRequest::ListBased;
2543 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSiz e(touchRadius)); 2543 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSiz e(touchRadius));
2544 2544
2545 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius); 2545 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius);
2546 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; 2546 HeapVector<Member<Node>, 11> nodes;
2547 copyToVector(result.listBasedTestResult(), nodes); 2547 copyToVector(result.listBasedTestResult(), nodes);
2548 2548
2549 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful. 2549 // FIXME: the explicit Vector conversion copies into a temporary and is wast eful.
2550 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes)); 2550 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, HeapVector<Member<Node>>(nodes));
2551 } 2551 }
2552 2552
2553 // Update the hover and active state across all frames for this gesture. 2553 // Update the hover and active state across all frames for this gesture.
2554 // This logic is different than the mouse case because mice send MouseLeave even ts to frames as they're exited. 2554 // This logic is different than the mouse case because mice send MouseLeave even ts to frames as they're exited.
2555 // With gestures, a single event conceptually both 'leaves' whatever frame curre ntly had hover and enters a new frame 2555 // With gestures, a single event conceptually both 'leaves' whatever frame curre ntly had hover and enters a new frame
2556 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request, Element* innerElement) 2556 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request, Element* innerElement)
2557 { 2557 {
2558 ASSERT(m_frame == m_frame->localFrameRoot()); 2558 ASSERT(m_frame == m_frame->localFrameRoot());
2559 2559
2560 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> newHoverFrameChain; 2560 HeapVector<Member<LocalFrame>> newHoverFrameChain;
2561 LocalFrame* newHoverFrameInDocument = innerElement ? innerElement->document( ).frame() : nullptr; 2561 LocalFrame* newHoverFrameInDocument = innerElement ? innerElement->document( ).frame() : nullptr;
2562 // Insert the ancestors of the frame having the new hovered node to the fram e chain 2562 // Insert the ancestors of the frame having the new hovered node to the fram e chain
2563 // The frame chain doesn't include the main frame to avoid the redundant wor k that cleans the hover state. 2563 // The frame chain doesn't include the main frame to avoid the redundant wor k that cleans the hover state.
2564 // Because the hover state for the main frame is updated by calling Document ::updateHoverActiveState 2564 // Because the hover state for the main frame is updated by calling Document ::updateHoverActiveState
2565 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) { 2565 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) {
2566 newHoverFrameChain.append(newHoverFrameInDocument); 2566 newHoverFrameChain.append(newHoverFrameInDocument);
2567 Frame* parentFrame = newHoverFrameInDocument->tree().parent(); 2567 Frame* parentFrame = newHoverFrameInDocument->tree().parent();
2568 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? t oLocalFrame(parentFrame) : nullptr; 2568 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? t oLocalFrame(parentFrame) : nullptr;
2569 } 2569 }
2570 2570
2571 RefPtrWillBeRawPtr<Node> oldHoverNodeInCurDoc = m_frame->document()->hoverNo de(); 2571 RawPtr<Node> oldHoverNodeInCurDoc = m_frame->document()->hoverNode();
2572 RefPtrWillBeRawPtr<Node> newInnermostHoverNode = innerElement; 2572 RawPtr<Node> newInnermostHoverNode = innerElement;
2573 2573
2574 if (newInnermostHoverNode != oldHoverNodeInCurDoc) { 2574 if (newInnermostHoverNode != oldHoverNodeInCurDoc) {
2575 size_t indexFrameChain = newHoverFrameChain.size(); 2575 size_t indexFrameChain = newHoverFrameChain.size();
2576 2576
2577 // Clear the hover state on any frames which are no longer in the frame chain of the hovered elemen 2577 // Clear the hover state on any frames which are no longer in the frame chain of the hovered elemen
2578 while (oldHoverNodeInCurDoc && oldHoverNodeInCurDoc->isFrameOwnerElement ()) { 2578 while (oldHoverNodeInCurDoc && oldHoverNodeInCurDoc->isFrameOwnerElement ()) {
2579 LocalFrame* newHoverFrame = nullptr; 2579 LocalFrame* newHoverFrame = nullptr;
2580 // If we can't get the frame from the new hover frame chain, 2580 // If we can't get the frame from the new hover frame chain,
2581 // the newHoverFrame will be null and the old hover state will be cl eared. 2581 // the newHoverFrame will be null and the old hover state will be cl eared.
2582 if (indexFrameChain > 0) 2582 if (indexFrameChain > 0)
(...skipping 27 matching lines...) Expand all
2610 ASSERT(m_frame == m_frame->localFrameRoot()); 2610 ASSERT(m_frame == m_frame->localFrameRoot());
2611 2611
2612 // Behaviour of this function is as follows: 2612 // Behaviour of this function is as follows:
2613 // - Create the chain of all entered frames. 2613 // - Create the chain of all entered frames.
2614 // - Compare the last frame chain under the gesture to newly entered frame c hain from the main frame one by one. 2614 // - Compare the last frame chain under the gesture to newly entered frame c hain from the main frame one by one.
2615 // - If the last frame doesn't match with the entered frame, then create the chain of exited frames from the last frame chain. 2615 // - If the last frame doesn't match with the entered frame, then create the chain of exited frames from the last frame chain.
2616 // - Dispatch mouseout/mouseleave events of the exited frames from the insid e out. 2616 // - Dispatch mouseout/mouseleave events of the exited frames from the insid e out.
2617 // - Dispatch mouseover/mouseenter events of the entered frames into the ins ide. 2617 // - Dispatch mouseover/mouseenter events of the entered frames into the ins ide.
2618 2618
2619 // Insert the ancestors of the frame having the new target node to the enter ed frame chain 2619 // Insert the ancestors of the frame having the new target node to the enter ed frame chain
2620 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> enteredFrameChain; 2620 HeapVector<Member<LocalFrame>> enteredFrameChain;
2621 LocalFrame* enteredFrameInDocument = targetedEvent.hitTestResult().innerNode Frame(); 2621 LocalFrame* enteredFrameInDocument = targetedEvent.hitTestResult().innerNode Frame();
2622 while (enteredFrameInDocument) { 2622 while (enteredFrameInDocument) {
2623 enteredFrameChain.append(enteredFrameInDocument); 2623 enteredFrameChain.append(enteredFrameInDocument);
2624 Frame* parentFrame = enteredFrameInDocument->tree().parent(); 2624 Frame* parentFrame = enteredFrameInDocument->tree().parent();
2625 enteredFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? to LocalFrame(parentFrame) : nullptr; 2625 enteredFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? to LocalFrame(parentFrame) : nullptr;
2626 } 2626 }
2627 2627
2628 size_t indexEnteredFrameChain = enteredFrameChain.size(); 2628 size_t indexEnteredFrameChain = enteredFrameChain.size();
2629 LocalFrame* exitedFrameInDocument = m_frame; 2629 LocalFrame* exitedFrameInDocument = m_frame;
2630 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> exitedFrameChain; 2630 HeapVector<Member<LocalFrame>> exitedFrameChain;
2631 // Insert the frame from the disagreement between last frames and entered fr ames 2631 // Insert the frame from the disagreement between last frames and entered fr ames
2632 while (exitedFrameInDocument) { 2632 while (exitedFrameInDocument) {
2633 Node* lastNodeUnderTap = exitedFrameInDocument->eventHandler().m_nodeUnd erMouse.get(); 2633 Node* lastNodeUnderTap = exitedFrameInDocument->eventHandler().m_nodeUnd erMouse.get();
2634 if (!lastNodeUnderTap) 2634 if (!lastNodeUnderTap)
2635 break; 2635 break;
2636 2636
2637 LocalFrame* nextExitedFrameInDocument = nullptr; 2637 LocalFrame* nextExitedFrameInDocument = nullptr;
2638 if (lastNodeUnderTap->isFrameOwnerElement()) { 2638 if (lastNodeUnderTap->isFrameOwnerElement()) {
2639 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(lastNodeUnder Tap); 2639 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(lastNodeUnder Tap);
2640 if (owner->contentFrame() && owner->contentFrame()->isLocalFrame()) 2640 if (owner->contentFrame() && owner->contentFrame()->isLocalFrame())
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 String key = evt.unmodifiedText(); 3082 String key = evt.unmodifiedText();
3083 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); 3083 Element* elem = m_frame->document()->getElementByAccessKey(key.lower());
3084 if (!elem) 3084 if (!elem)
3085 return false; 3085 return false;
3086 elem->accessKeyAction(false); 3086 elem->accessKeyAction(false);
3087 return true; 3087 return true;
3088 } 3088 }
3089 3089
3090 WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK eyEvent) 3090 WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK eyEvent)
3091 { 3091 {
3092 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 3092 RawPtr<FrameView> protector(m_frame->view());
3093 m_frame->chromeClient().clearToolTip(); 3093 m_frame->chromeClient().clearToolTip();
3094 3094
3095 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) 3095 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL)
3096 capsLockStateMayHaveChanged(); 3096 capsLockStateMayHaveChanged();
3097 3097
3098 #if OS(WIN) 3098 #if OS(WIN)
3099 if (panScrollInProgress()) { 3099 if (panScrollInProgress()) {
3100 // If a key is pressed while the panScroll is in progress then we want t o stop 3100 // If a key is pressed while the panScroll is in progress then we want t o stop
3101 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent. type() == PlatformEvent::RawKeyDown) 3101 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent. type() == PlatformEvent::RawKeyDown)
3102 stopAutoscroll(); 3102 stopAutoscroll();
3103 3103
3104 // If we were in panscroll mode, we swallow the key event 3104 // If we were in panscroll mode, we swallow the key event
3105 return WebInputEventResult::HandledSuppressed; 3105 return WebInputEventResult::HandledSuppressed;
3106 } 3106 }
3107 #endif 3107 #endif
3108 3108
3109 // Check for cases where we are too early for events -- possible unmatched k ey up 3109 // Check for cases where we are too early for events -- possible unmatched k ey up
3110 // from pressing return in the location bar. 3110 // from pressing return in the location bar.
3111 RefPtrWillBeRawPtr<Node> node = eventTargetNodeForDocument(m_frame->document ()); 3111 RawPtr<Node> node = eventTargetNodeForDocument(m_frame->document());
3112 if (!node) 3112 if (!node)
3113 return WebInputEventResult::NotHandled; 3113 return WebInputEventResult::NotHandled;
3114 3114
3115 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); 3115 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
3116 3116
3117 // In IE, access keys are special, they are handled after default keydown pr ocessing, but cannot be canceled - this is hard to match. 3117 // In IE, access keys are special, they are handled after default keydown pr ocessing, but cannot be canceled - this is hard to match.
3118 // On Mac OS X, we process them before dispatching keydown, as the default k eydown handler implements Emacs key bindings, which may conflict 3118 // On Mac OS X, we process them before dispatching keydown, as the default k eydown handler implements Emacs key bindings, which may conflict
3119 // with access keys. Then we dispatch keydown, but suppress its default hand ling. 3119 // with access keys. Then we dispatch keydown, but suppress its default hand ling.
3120 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch ing a keypress event for WM_SYSCHAR messages. 3120 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch ing a keypress event for WM_SYSCHAR messages.
3121 // Other platforms currently match either Mac or Windows behavior, depending on whether they send combined KeyDown events. 3121 // Other platforms currently match either Mac or Windows behavior, depending on whether they send combined KeyDown events.
3122 bool matchedAnAccessKey = false; 3122 bool matchedAnAccessKey = false;
3123 if (initialKeyEvent.type() == PlatformEvent::KeyDown) 3123 if (initialKeyEvent.type() == PlatformEvent::KeyDown)
3124 matchedAnAccessKey = handleAccessKey(initialKeyEvent); 3124 matchedAnAccessKey = handleAccessKey(initialKeyEvent);
3125 3125
3126 // FIXME: it would be fair to let an input method handle KeyUp events before DOM dispatch. 3126 // FIXME: it would be fair to let an input method handle KeyUp events before DOM dispatch.
3127 if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type() == PlatformEvent::Char) { 3127 if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type() == PlatformEvent::Char) {
3128 RefPtrWillBeRawPtr<KeyboardEvent> domEvent = KeyboardEvent::create(initi alKeyEvent, m_frame->document()->domWindow()); 3128 RawPtr<KeyboardEvent> domEvent = KeyboardEvent::create(initialKeyEvent, m_frame->document()->domWindow());
3129 3129
3130 return toWebInputEventResult(node->dispatchEvent(domEvent)); 3130 return toWebInputEventResult(node->dispatchEvent(domEvent));
3131 } 3131 }
3132 3132
3133 PlatformKeyboardEvent keyDownEvent = initialKeyEvent; 3133 PlatformKeyboardEvent keyDownEvent = initialKeyEvent;
3134 if (keyDownEvent.type() != PlatformEvent::RawKeyDown) 3134 if (keyDownEvent.type() != PlatformEvent::RawKeyDown)
3135 keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); 3135 keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
3136 RefPtrWillBeRawPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEve nt, m_frame->document()->domWindow()); 3136 RawPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEvent, m_frame- >document()->domWindow());
3137 if (matchedAnAccessKey) 3137 if (matchedAnAccessKey)
3138 keydown->setDefaultPrevented(true); 3138 keydown->setDefaultPrevented(true);
3139 keydown->setTarget(node); 3139 keydown->setTarget(node);
3140 3140
3141 DispatchEventResult dispatchResult = node->dispatchEvent(keydown); 3141 DispatchEventResult dispatchResult = node->dispatchEvent(keydown);
3142 if (dispatchResult != DispatchEventResult::NotCanceled) 3142 if (dispatchResult != DispatchEventResult::NotCanceled)
3143 return toWebInputEventResult(dispatchResult); 3143 return toWebInputEventResult(dispatchResult);
3144 // If frame changed as a result of keydown dispatch, then return early to av oid sending a subsequent keypress message to the new frame. 3144 // If frame changed as a result of keydown dispatch, then return early to av oid sending a subsequent keypress message to the new frame.
3145 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->fo cusController().focusedOrMainFrame(); 3145 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->fo cusController().focusedOrMainFrame();
3146 if (changedFocusedFrame) 3146 if (changedFocusedFrame)
3147 return WebInputEventResult::HandledSystem; 3147 return WebInputEventResult::HandledSystem;
3148 3148
3149 if (initialKeyEvent.type() == PlatformEvent::RawKeyDown) 3149 if (initialKeyEvent.type() == PlatformEvent::RawKeyDown)
3150 return WebInputEventResult::NotHandled; 3150 return WebInputEventResult::NotHandled;
3151 3151
3152 // Focus may have changed during keydown handling, so refetch node. 3152 // Focus may have changed during keydown handling, so refetch node.
3153 // But if we are dispatching a fake backward compatibility keypress, then we pretend that the keypress happened on the original node. 3153 // But if we are dispatching a fake backward compatibility keypress, then we pretend that the keypress happened on the original node.
3154 node = eventTargetNodeForDocument(m_frame->document()); 3154 node = eventTargetNodeForDocument(m_frame->document());
3155 if (!node) 3155 if (!node)
3156 return WebInputEventResult::NotHandled; 3156 return WebInputEventResult::NotHandled;
3157 3157
3158 PlatformKeyboardEvent keyPressEvent = initialKeyEvent; 3158 PlatformKeyboardEvent keyPressEvent = initialKeyEvent;
3159 keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char); 3159 keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char);
3160 if (keyPressEvent.text().isEmpty()) 3160 if (keyPressEvent.text().isEmpty())
3161 return WebInputEventResult::NotHandled; 3161 return WebInputEventResult::NotHandled;
3162 RefPtrWillBeRawPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressE vent, m_frame->document()->domWindow()); 3162 RawPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressEvent, m_fram e->document()->domWindow());
3163 keypress->setTarget(node); 3163 keypress->setTarget(node);
3164 return toWebInputEventResult(node->dispatchEvent(keypress)); 3164 return toWebInputEventResult(node->dispatchEvent(keypress));
3165 } 3165 }
3166 3166
3167 static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier) 3167 static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier)
3168 { 3168 {
3169 DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down")); 3169 DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down"));
3170 DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up")); 3170 DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up"));
3171 DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left")); 3171 DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left"));
3172 DEFINE_STATIC_LOCAL(AtomicString, Right, ("Right")); 3172 DEFINE_STATIC_LOCAL(AtomicString, Right, ("Right"));
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3396 return false; 3396 return false;
3397 3397
3398 EventTarget* target; 3398 EventTarget* target;
3399 if (underlyingEvent) 3399 if (underlyingEvent)
3400 target = underlyingEvent->target(); 3400 target = underlyingEvent->target();
3401 else 3401 else
3402 target = eventTargetNodeForDocument(m_frame->document()); 3402 target = eventTargetNodeForDocument(m_frame->document());
3403 if (!target) 3403 if (!target)
3404 return false; 3404 return false;
3405 3405
3406 RefPtrWillBeRawPtr<TextEvent> event = TextEvent::create(m_frame->domWindow() , text, inputType); 3406 RawPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inpu tType);
3407 event->setUnderlyingEvent(underlyingEvent); 3407 event->setUnderlyingEvent(underlyingEvent);
3408 3408
3409 target->dispatchEvent(event); 3409 target->dispatchEvent(event);
3410 return event->defaultHandled() || event->defaultPrevented(); 3410 return event->defaultHandled() || event->defaultPrevented();
3411 } 3411 }
3412 3412
3413 void EventHandler::defaultTextInputEventHandler(TextEvent* event) 3413 void EventHandler::defaultTextInputEventHandler(TextEvent* event)
3414 { 3414 {
3415 if (m_frame->editor().handleTextEvent(event)) 3415 if (m_frame->editor().handleTextEvent(event))
3416 event->setDefaultHandled(); 3416 event->setDefaultHandled();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3563 if (frame->view()) { 3563 if (frame->view()) {
3564 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); 3564 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars);
3565 if (!rect.contains(roundedIntPoint(point))) 3565 if (!rect.contains(roundedIntPoint(point)))
3566 return result; 3566 return result;
3567 } 3567 }
3568 frame->contentLayoutItem().hitTest(result); 3568 frame->contentLayoutItem().hitTest(result);
3569 return result; 3569 return result;
3570 } 3570 }
3571 3571
3572 void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, 3572 void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event,
3573 WillBeHeapVector<TouchInfo>& touchInfos) 3573 HeapVector<TouchInfo>& touchInfos)
3574 { 3574 {
3575 if (!RuntimeEnabledFeatures::pointerEventEnabled()) 3575 if (!RuntimeEnabledFeatures::pointerEventEnabled())
3576 return; 3576 return;
3577 3577
3578 // Iterate through the touch points, sending PointerEvents to the targets as required. 3578 // Iterate through the touch points, sending PointerEvents to the targets as required.
3579 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3579 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3580 TouchInfo& touchInfo = touchInfos[i]; 3580 TouchInfo& touchInfo = touchInfos[i];
3581 const PlatformTouchPoint& touchPoint = touchInfo.point; 3581 const PlatformTouchPoint& touchPoint = touchInfo.point;
3582 3582
3583 3583
3584 if (touchPoint.state() == PlatformTouchPoint::TouchStationary 3584 if (touchPoint.state() == PlatformTouchPoint::TouchStationary
3585 || !touchInfo.knownTarget) 3585 || !touchInfo.knownTarget)
3586 continue; 3586 continue;
3587 3587
3588 WebInputEventResult result = 3588 WebInputEventResult result =
3589 m_pointerEventManager.sendTouchPointerEvent( 3589 m_pointerEventManager.sendTouchPointerEvent(
3590 touchInfo.touchTarget, touchPoint, event.getModifiers(), 3590 touchInfo.touchTarget, touchPoint, event.getModifiers(),
3591 touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(), 3591 touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(),
3592 touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y()); 3592 touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y());
3593 touchInfo.consumed = result != WebInputEventResult::NotHandled; 3593 touchInfo.consumed = result != WebInputEventResult::NotHandled;
3594 } 3594 }
3595 } 3595 }
3596 3596
3597 void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos) 3597 void EventHandler::sendPointerCancels(HeapVector<TouchInfo>& touchInfos)
3598 { 3598 {
3599 if (!RuntimeEnabledFeatures::pointerEventEnabled()) 3599 if (!RuntimeEnabledFeatures::pointerEventEnabled())
3600 return; 3600 return;
3601 3601
3602 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3602 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3603 TouchInfo& touchInfo = touchInfos[i]; 3603 TouchInfo& touchInfo = touchInfos[i];
3604 const PlatformTouchPoint& point = touchInfo.point; 3604 const PlatformTouchPoint& point = touchInfo.point;
3605 const PlatformTouchPoint::TouchState pointState = point.state(); 3605 const PlatformTouchPoint::TouchState pointState = point.state();
3606 3606
3607 if (pointState == PlatformTouchPoint::TouchReleased 3607 if (pointState == PlatformTouchPoint::TouchReleased
(...skipping 13 matching lines...) Expand all
3621 // that the local class doesn't provide a local definition for 'operator new'. 3621 // that the local class doesn't provide a local definition for 'operator new'.
3622 // Which it intentionally doesn't and shouldn't. 3622 // Which it intentionally doesn't and shouldn't.
3623 // 3623 //
3624 // Work around such toolchain bugginess by lifting out the type, thereby 3624 // Work around such toolchain bugginess by lifting out the type, thereby
3625 // taking it out of C4822's reach. 3625 // taking it out of C4822's reach.
3626 class ChangedTouches final { 3626 class ChangedTouches final {
3627 STACK_ALLOCATED(); 3627 STACK_ALLOCATED();
3628 public: 3628 public:
3629 // The touches corresponding to the particular change state this struct 3629 // The touches corresponding to the particular change state this struct
3630 // instance represents. 3630 // instance represents.
3631 RefPtrWillBeMember<TouchList> m_touches; 3631 Member<TouchList> m_touches;
3632 3632
3633 using EventTargetSet = WillBeHeapHashSet<RefPtrWillBeMember<EventTarget>>; 3633 using EventTargetSet = HeapHashSet<Member<EventTarget>>;
3634 // Set of targets involved in m_touches. 3634 // Set of targets involved in m_touches.
3635 EventTargetSet m_targets; 3635 EventTargetSet m_targets;
3636 }; 3636 };
3637 3637
3638 } // namespace 3638 } // namespace
3639 3639
3640 WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent& event, 3640 WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent& event,
3641 WillBeHeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouc hReleased) 3641 HeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouchRelea sed)
3642 { 3642 {
3643 // Build up the lists to use for the 'touches', 'targetTouches' and 3643 // Build up the lists to use for the 'touches', 'targetTouches' and
3644 // 'changedTouches' attributes in the JS event. See 3644 // 'changedTouches' attributes in the JS event. See
3645 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these 3645 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these
3646 // lists fit together. 3646 // lists fit together.
3647 3647
3648 // Holds the complete set of touches on the screen. 3648 // Holds the complete set of touches on the screen.
3649 RefPtrWillBeRawPtr<TouchList> touches = TouchList::create(); 3649 RawPtr<TouchList> touches = TouchList::create();
3650 3650
3651 // A different view on the 'touches' list above, filtered and grouped by 3651 // A different view on the 'touches' list above, filtered and grouped by
3652 // event target. Used for the 'targetTouches' list in the JS event. 3652 // event target. Used for the 'targetTouches' list in the JS event.
3653 using TargetTouchesHeapMap = WillBeHeapHashMap<EventTarget*, RefPtrWillBeMem ber<TouchList>>; 3653 using TargetTouchesHeapMap = HeapHashMap<EventTarget*, Member<TouchList>>;
3654 TargetTouchesHeapMap touchesByTarget; 3654 TargetTouchesHeapMap touchesByTarget;
3655 3655
3656 // Array of touches per state, used to assemble the 'changedTouches' list. 3656 // Array of touches per state, used to assemble the 'changedTouches' list.
3657 ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd]; 3657 ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd];
3658 3658
3659 for (unsigned i = 0; i < touchInfos.size(); ++i) { 3659 for (unsigned i = 0; i < touchInfos.size(); ++i) {
3660 const TouchInfo& touchInfo = touchInfos[i]; 3660 const TouchInfo& touchInfo = touchInfos[i];
3661 const PlatformTouchPoint& point = touchInfo.point; 3661 const PlatformTouchPoint& point = touchInfo.point;
3662 PlatformTouchPoint::TouchState pointState = point.state(); 3662 PlatformTouchPoint::TouchState pointState = point.state();
3663 3663
3664 if (touchInfo.consumed) 3664 if (touchInfo.consumed)
3665 continue; 3665 continue;
3666 3666
3667 RefPtrWillBeRawPtr<Touch> touch = Touch::create( 3667 RawPtr<Touch> touch = Touch::create(
3668 touchInfo.targetFrame.get(), 3668 touchInfo.targetFrame.get(),
3669 touchInfo.touchTarget.get(), 3669 touchInfo.touchTarget.get(),
3670 point.id(), 3670 point.id(),
3671 point.screenPos(), 3671 point.screenPos(),
3672 touchInfo.adjustedPagePoint, 3672 touchInfo.adjustedPagePoint,
3673 touchInfo.adjustedRadius, 3673 touchInfo.adjustedRadius,
3674 point.rotationAngle(), 3674 point.rotationAngle(),
3675 point.force(), 3675 point.force(),
3676 touchInfo.region); 3676 touchInfo.region);
3677 3677
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3714 3714
3715 // Now iterate through the changedTouches list and m_targets within it, send ing 3715 // Now iterate through the changedTouches list and m_targets within it, send ing
3716 // TouchEvents to the targets as required. 3716 // TouchEvents to the targets as required.
3717 for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state ) { 3717 for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state ) {
3718 if (!changedTouches[state].m_touches) 3718 if (!changedTouches[state].m_touches)
3719 continue; 3719 continue;
3720 3720
3721 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca st<PlatformTouchPoint::TouchState>(state))); 3721 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca st<PlatformTouchPoint::TouchState>(state)));
3722 for (const auto& eventTarget : changedTouches[state].m_targets) { 3722 for (const auto& eventTarget : changedTouches[state].m_targets) {
3723 EventTarget* touchEventTarget = eventTarget.get(); 3723 EventTarget* touchEventTarget = eventTarget.get();
3724 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create( 3724 RawPtr<TouchEvent> touchEvent = TouchEvent::create(
3725 touches.get(), touchesByTarget.get(touchEventTarget), changedTou ches[state].m_touches.get(), 3725 touches.get(), touchesByTarget.get(touchEventTarget), changedTou ches[state].m_touches.get(),
3726 eventName, touchEventTarget->toNode()->document().domWindow(), 3726 eventName, touchEventTarget->toNode()->document().domWindow(),
3727 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp()); 3727 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp());
3728 3728
3729 eventResult = mergeEventResult(eventResult, toWebInputEventResult(to uchEventTarget->dispatchEvent(touchEvent.get()))); 3729 eventResult = mergeEventResult(eventResult, toWebInputEventResult(to uchEventTarget->dispatchEvent(touchEvent.get())));
3730 } 3730 }
3731 } 3731 }
3732 3732
3733 return eventResult; 3733 return eventResult;
3734 } 3734 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3839 // this work. 3839 // this work.
3840 if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !ha sTouchHandlers(m_touchSequenceDocument->frameHost()->eventHandlerRegistry()) || !m_touchSequenceDocument->frame()) { 3840 if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !ha sTouchHandlers(m_touchSequenceDocument->frameHost()->eventHandlerRegistry()) || !m_touchSequenceDocument->frame()) {
3841 if (allTouchReleased) { 3841 if (allTouchReleased) {
3842 m_touchSequenceDocument.clear(); 3842 m_touchSequenceDocument.clear();
3843 m_touchSequenceUserGestureToken.clear(); 3843 m_touchSequenceUserGestureToken.clear();
3844 } 3844 }
3845 return WebInputEventResult::NotHandled; 3845 return WebInputEventResult::NotHandled;
3846 } 3846 }
3847 3847
3848 // Compute and store the common info used by both PointerEvent and TouchEven t. 3848 // Compute and store the common info used by both PointerEvent and TouchEven t.
3849 WillBeHeapVector<TouchInfo> touchInfos(points.size()); 3849 HeapVector<TouchInfo> touchInfos(points.size());
3850 3850
3851 for (unsigned i = 0; i < points.size(); ++i) { 3851 for (unsigned i = 0; i < points.size(); ++i) {
3852 const PlatformTouchPoint& point = points[i]; 3852 const PlatformTouchPoint& point = points[i];
3853 PlatformTouchPoint::TouchState pointState = point.state(); 3853 PlatformTouchPoint::TouchState pointState = point.state();
3854 RefPtrWillBeRawPtr<EventTarget> touchTarget = nullptr; 3854 RawPtr<EventTarget> touchTarget = nullptr;
3855 String regionID; 3855 String regionID;
3856 3856
3857 if (pointState == PlatformTouchPoint::TouchReleased || pointState == Pla tformTouchPoint::TouchCancelled) { 3857 if (pointState == PlatformTouchPoint::TouchReleased || pointState == Pla tformTouchPoint::TouchCancelled) {
3858 // The target should be the original target for this touch, so get 3858 // The target should be the original target for this touch, so get
3859 // it from the hashmap. As it's a release or cancel we also remove 3859 // it from the hashmap. As it's a release or cancel we also remove
3860 // it from the map. 3860 // it from the map.
3861 touchTarget = m_targetForTouchID.take(point.id()); 3861 touchTarget = m_targetForTouchID.take(point.id());
3862 regionID = m_regionForTouchID.take(point.id()); 3862 regionID = m_regionForTouchID.take(point.id());
3863 } else { 3863 } else {
3864 // No hittest is performed on move or stationary, since the target 3864 // No hittest is performed on move or stationary, since the target
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3992 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3992 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3993 { 3993 {
3994 #if OS(MACOSX) 3994 #if OS(MACOSX)
3995 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3995 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3996 #else 3996 #else
3997 return PlatformEvent::AltKey; 3997 return PlatformEvent::AltKey;
3998 #endif 3998 #endif
3999 } 3999 }
4000 4000
4001 } // namespace blink 4001 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698