| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // is most significant. The enumeration is ordered with smaller specified | 118 // is most significant. The enumeration is ordered with smaller specified |
| 119 // numbers first. Examples of merged results are: | 119 // numbers first. Examples of merged results are: |
| 120 // (HandledApplication, HandledSystem) -> HandledSystem | 120 // (HandledApplication, HandledSystem) -> HandledSystem |
| 121 // (NotHandled, HandledApplication) -> HandledApplication | 121 // (NotHandled, HandledApplication) -> HandledApplication |
| 122 static_assert(static_cast<int>(WebInputEventResult::NotHandled) == 0, "WebIn
putEventResult not ordered"); | 122 static_assert(static_cast<int>(WebInputEventResult::NotHandled) == 0, "WebIn
putEventResult not ordered"); |
| 123 static_assert(static_cast<int>(WebInputEventResult::HandledSuppressed) < sta
tic_cast<int>(WebInputEventResult::HandledApplication), "WebInputEventResult not
ordered"); | 123 static_assert(static_cast<int>(WebInputEventResult::HandledSuppressed) < sta
tic_cast<int>(WebInputEventResult::HandledApplication), "WebInputEventResult not
ordered"); |
| 124 static_assert(static_cast<int>(WebInputEventResult::HandledApplication) < st
atic_cast<int>(WebInputEventResult::HandledSystem), "WebInputEventResult not ord
ered"); | 124 static_assert(static_cast<int>(WebInputEventResult::HandledApplication) < st
atic_cast<int>(WebInputEventResult::HandledSystem), "WebInputEventResult not ord
ered"); |
| 125 return static_cast<WebInputEventResult>(max(static_cast<int>(responseA), sta
tic_cast<int>(responseB))); | 125 return static_cast<WebInputEventResult>(max(static_cast<int>(responseA), sta
tic_cast<int>(responseB))); |
| 126 } | 126 } |
| 127 | 127 |
| 128 WebInputEventResult eventToEventResult(PassRefPtrWillBeRawPtr<Event> event, bool
res) | 128 WebInputEventResult eventToEventResult(RawPtr<Event> event, bool res) |
| 129 { | 129 { |
| 130 if (event->defaultPrevented()) | 130 if (event->defaultPrevented()) |
| 131 return WebInputEventResult::HandledApplication; | 131 return WebInputEventResult::HandledApplication; |
| 132 if (event->defaultHandled()) | 132 if (event->defaultHandled()) |
| 133 return WebInputEventResult::HandledSystem; | 133 return WebInputEventResult::HandledSystem; |
| 134 | 134 |
| 135 // TODO(dtapuska): There are cases in the code where dispatchEvent | 135 // TODO(dtapuska): There are cases in the code where dispatchEvent |
| 136 // returns false (indicated handled) but event is not marked | 136 // returns false (indicated handled) but event is not marked |
| 137 // as default handled or default prevented. crbug.com/560355 | 137 // as default handled or default prevented. crbug.com/560355 |
| 138 if (!res) | 138 if (!res) |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 FrameView* view = frame->view(); | 982 FrameView* view = frame->view(); |
| 983 // FIXME: Is it really OK to use the wrong coordinates here when view is 0? | 983 // FIXME: Is it really OK to use the wrong coordinates here when view is 0? |
| 984 // Historically the code would just crash; this is clearly no worse than tha
t. | 984 // Historically the code would just crash; this is clearly no worse than tha
t. |
| 985 return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame
; | 985 return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame
; |
| 986 } | 986 } |
| 987 | 987 |
| 988 WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
& mouseEvent) | 988 WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
& mouseEvent) |
| 989 { | 989 { |
| 990 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); | 990 TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); |
| 991 | 991 |
| 992 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 992 RawPtr<FrameView> protector(m_frame->view()); |
| 993 | 993 |
| 994 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 994 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 995 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken =
gestureIndicator.currentToken(); | 995 m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToken =
gestureIndicator.currentToken(); |
| 996 | 996 |
| 997 cancelFakeMouseMoveEvent(); | 997 cancelFakeMouseMoveEvent(); |
| 998 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 998 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
| 999 m_capturingMouseEventsNode = nullptr; | 999 m_capturingMouseEventsNode = nullptr; |
| 1000 m_mousePressed = true; | 1000 m_mousePressed = true; |
| 1001 m_capturesDragging = true; | 1001 m_capturesDragging = true; |
| 1002 setLastKnownMousePosition(mouseEvent); | 1002 setLastKnownMousePosition(mouseEvent); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1017 LayoutPoint documentPoint = contentPointFromRootFrame(m_frame, mouseEvent.po
sition()); | 1017 LayoutPoint documentPoint = contentPointFromRootFrame(m_frame, mouseEvent.po
sition()); |
| 1018 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re
quest, documentPoint, mouseEvent); | 1018 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re
quest, documentPoint, mouseEvent); |
| 1019 | 1019 |
| 1020 if (!mev.innerNode()) { | 1020 if (!mev.innerNode()) { |
| 1021 invalidateClick(); | 1021 invalidateClick(); |
| 1022 return WebInputEventResult::NotHandled; | 1022 return WebInputEventResult::NotHandled; |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 m_mousePressNode = mev.innerNode(); | 1025 m_mousePressNode = mev.innerNode(); |
| 1026 | 1026 |
| 1027 RefPtrWillBeRawPtr<LocalFrame> subframe = subframeForHitTestResult(mev); | 1027 RawPtr<LocalFrame> subframe = subframeForHitTestResult(mev); |
| 1028 if (subframe) { | 1028 if (subframe) { |
| 1029 WebInputEventResult result = passMousePressEventToSubframe(mev, subframe
.get()); | 1029 WebInputEventResult result = passMousePressEventToSubframe(mev, subframe
.get()); |
| 1030 // Start capturing future events for this frame. We only do this if we
didn't clear | 1030 // Start capturing future events for this frame. We only do this if we
didn't clear |
| 1031 // the m_mousePressed flag, which may happen if an AppKit widget entered
a modal event loop. | 1031 // the m_mousePressed flag, which may happen if an AppKit widget entered
a modal event loop. |
| 1032 // The capturing should be done only when the result indicates it | 1032 // The capturing should be done only when the result indicates it |
| 1033 // has been handled. See crbug.com/269917 | 1033 // has been handled. See crbug.com/269917 |
| 1034 m_capturesDragging = subframe->eventHandler().capturesDragging(); | 1034 m_capturesDragging = subframe->eventHandler().capturesDragging(); |
| 1035 if (m_mousePressed && m_capturesDragging) { | 1035 if (m_mousePressed && m_capturesDragging) { |
| 1036 m_capturingMouseEventsNode = mev.innerNode(); | 1036 m_capturingMouseEventsNode = mev.innerNode(); |
| 1037 m_eventHandlerWillResetCapturingMouseEventsNode = true; | 1037 m_eventHandlerWillResetCapturingMouseEventsNode = true; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1145 |
| 1146 return nullptr; | 1146 return nullptr; |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 WebInputEventResult EventHandler::handleMouseMoveEvent(const PlatformMouseEvent&
event) | 1149 WebInputEventResult EventHandler::handleMouseMoveEvent(const PlatformMouseEvent&
event) |
| 1150 { | 1150 { |
| 1151 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent"); | 1151 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent"); |
| 1152 | 1152 |
| 1153 conditionallyEnableMouseEventForPointerTypeMouse(event); | 1153 conditionallyEnableMouseEventForPointerTypeMouse(event); |
| 1154 | 1154 |
| 1155 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 1155 RawPtr<FrameView> protector(m_frame->view()); |
| 1156 | 1156 |
| 1157 HitTestResult hoveredNode = HitTestResult(); | 1157 HitTestResult hoveredNode = HitTestResult(); |
| 1158 WebInputEventResult result = handleMouseMoveOrLeaveEvent(event, &hoveredNode
); | 1158 WebInputEventResult result = handleMouseMoveOrLeaveEvent(event, &hoveredNode
); |
| 1159 | 1159 |
| 1160 Page* page = m_frame->page(); | 1160 Page* page = m_frame->page(); |
| 1161 if (!page) | 1161 if (!page) |
| 1162 return result; | 1162 return result; |
| 1163 | 1163 |
| 1164 if (PaintLayer* layer = layerForNode(hoveredNode.innerNode())) { | 1164 if (PaintLayer* layer = layerForNode(hoveredNode.innerNode())) { |
| 1165 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer
)) | 1165 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer
)) |
| 1166 layerScrollableArea->mouseMovedInContentArea(); | 1166 layerScrollableArea->mouseMovedInContentArea(); |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 if (FrameView* frameView = m_frame->view()) | 1169 if (FrameView* frameView = m_frame->view()) |
| 1170 frameView->mouseMovedInContentArea(); | 1170 frameView->mouseMovedInContentArea(); |
| 1171 | 1171 |
| 1172 hoveredNode.setToShadowHostIfInUserAgentShadowRoot(); | 1172 hoveredNode.setToShadowHostIfInUserAgentShadowRoot(); |
| 1173 page->chromeClient().mouseDidMoveOverElement(hoveredNode); | 1173 page->chromeClient().mouseDidMoveOverElement(hoveredNode); |
| 1174 | 1174 |
| 1175 return result; | 1175 return result; |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event) | 1178 void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event) |
| 1179 { | 1179 { |
| 1180 TRACE_EVENT0("blink", "EventHandler::handleMouseLeaveEvent"); | 1180 TRACE_EVENT0("blink", "EventHandler::handleMouseLeaveEvent"); |
| 1181 | 1181 |
| 1182 conditionallyEnableMouseEventForPointerTypeMouse(event); | 1182 conditionallyEnableMouseEventForPointerTypeMouse(event); |
| 1183 | 1183 |
| 1184 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 1184 RawPtr<FrameView> protector(m_frame->view()); |
| 1185 handleMouseMoveOrLeaveEvent(event, 0, false, true); | 1185 handleMouseMoveOrLeaveEvent(event, 0, false, true); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 WebInputEventResult EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMous
eEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars, bool
forceLeave) | 1188 WebInputEventResult EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMous
eEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars, bool
forceLeave) |
| 1189 { | 1189 { |
| 1190 ASSERT(m_frame); | 1190 ASSERT(m_frame); |
| 1191 ASSERT(m_frame->view()); | 1191 ASSERT(m_frame->view()); |
| 1192 | 1192 |
| 1193 setLastKnownMousePosition(mouseEvent); | 1193 setLastKnownMousePosition(mouseEvent); |
| 1194 | 1194 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 } else { | 1250 } else { |
| 1251 if (!scrollbar) | 1251 if (!scrollbar) |
| 1252 scrollbar = mev.scrollbar(); | 1252 scrollbar = mev.scrollbar(); |
| 1253 | 1253 |
| 1254 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); | 1254 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); |
| 1255 if (onlyUpdateScrollbars) | 1255 if (onlyUpdateScrollbars) |
| 1256 return WebInputEventResult::HandledSuppressed; | 1256 return WebInputEventResult::HandledSuppressed; |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 WebInputEventResult eventResult = WebInputEventResult::NotHandled; | 1259 WebInputEventResult eventResult = WebInputEventResult::NotHandled; |
| 1260 RefPtrWillBeRawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get(
) ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTest
Result(mev); | 1260 RawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get() ? subframe
ForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
| 1261 | 1261 |
| 1262 // 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. | 1262 // 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. |
| 1263 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD
escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) | 1263 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD
escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) |
| 1264 m_lastMouseMoveEventSubframe->eventHandler().handleMouseLeaveEvent(mouse
Event); | 1264 m_lastMouseMoveEventSubframe->eventHandler().handleMouseLeaveEvent(mouse
Event); |
| 1265 | 1265 |
| 1266 if (newSubframe) { | 1266 if (newSubframe) { |
| 1267 // Update over/out state before passing the event to the subframe. | 1267 // Update over/out state before passing the event to the subframe. |
| 1268 updateMouseEventTargetNode(mev.innerNode(), mouseEvent); | 1268 updateMouseEventTargetNode(mev.innerNode(), mouseEvent); |
| 1269 | 1269 |
| 1270 // Event dispatch in updateMouseEventTargetNode may have caused the subf
rame of the target | 1270 // Event dispatch in updateMouseEventTargetNode may have caused the subf
rame of the target |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 if (node.isHTMLElement() && toHTMLElement(node).isInteractiveContent()) | 1307 if (node.isHTMLElement() && toHTMLElement(node).isInteractiveContent()) |
| 1308 return nullptr; | 1308 return nullptr; |
| 1309 | 1309 |
| 1310 return FlatTreeTraversal::parent(node); | 1310 return FlatTreeTraversal::parent(node); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
nt& mouseEvent) | 1313 WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
nt& mouseEvent) |
| 1314 { | 1314 { |
| 1315 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); | 1315 TRACE_EVENT0("blink", "EventHandler::handleMouseReleaseEvent"); |
| 1316 | 1316 |
| 1317 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 1317 RawPtr<FrameView> protector(m_frame->view()); |
| 1318 | 1318 |
| 1319 m_frame->selection().setCaretBlinkingSuspended(false); | 1319 m_frame->selection().setCaretBlinkingSuspended(false); |
| 1320 | 1320 |
| 1321 OwnPtr<UserGestureIndicator> gestureIndicator; | 1321 OwnPtr<UserGestureIndicator> gestureIndicator; |
| 1322 | 1322 |
| 1323 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke
n) | 1323 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke
n) |
| 1324 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->localFrame
Root()->eventHandler().m_lastMouseDownUserGestureToken.release())); | 1324 gestureIndicator = adoptPtr(new UserGestureIndicator(m_frame->localFrame
Root()->eventHandler().m_lastMouseDownUserGestureToken.release())); |
| 1325 else | 1325 else |
| 1326 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin
gUserGesture)); | 1326 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessin
gUserGesture)); |
| 1327 | 1327 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp
e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer
) | 1410 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp
e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer
) |
| 1411 { | 1411 { |
| 1412 FrameView* view = m_frame->view(); | 1412 FrameView* view = m_frame->view(); |
| 1413 | 1413 |
| 1414 // FIXME: We might want to dispatch a dragleave even if the view is gone. | 1414 // FIXME: We might want to dispatch a dragleave even if the view is gone. |
| 1415 if (!view) | 1415 if (!view) |
| 1416 return WebInputEventResult::NotHandled; | 1416 return WebInputEventResult::NotHandled; |
| 1417 | 1417 |
| 1418 RefPtrWillBeRawPtr<DragEvent> me = DragEvent::create(eventType, | 1418 RawPtr<DragEvent> me = DragEvent::create(eventType, |
| 1419 true, true, m_frame->document()->domWindow(), | 1419 true, true, m_frame->document()->domWindow(), |
| 1420 0, event.globalPosition().x(), event.globalPosition().y(), event.positio
n().x(), event.position().y(), | 1420 0, event.globalPosition().x(), event.globalPosition().y(), event.positio
n().x(), event.position().y(), |
| 1421 event.movementDelta().x(), event.movementDelta().y(), | 1421 event.movementDelta().x(), event.movementDelta().y(), |
| 1422 event.modifiers(), | 1422 event.modifiers(), |
| 1423 0, MouseEvent::platformModifiersToButtons(event.modifiers()), nullptr, e
vent.timestamp(), dataTransfer, event.syntheticEventType()); | 1423 0, MouseEvent::platformModifiersToButtons(event.modifiers()), nullptr, e
vent.timestamp(), dataTransfer, event.syntheticEventType()); |
| 1424 | 1424 |
| 1425 bool dispatchResult = dragTarget->dispatchEvent(me.get()); | 1425 bool dispatchResult = dragTarget->dispatchEvent(me.get()); |
| 1426 return eventToEventResult(me, dispatchResult); | 1426 return eventToEventResult(me, dispatchResult); |
| 1427 } | 1427 } |
| 1428 | 1428 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 { | 1482 { |
| 1483 WebInputEventResult eventResult = WebInputEventResult::NotHandled; | 1483 WebInputEventResult eventResult = WebInputEventResult::NotHandled; |
| 1484 | 1484 |
| 1485 if (!m_frame->view()) | 1485 if (!m_frame->view()) |
| 1486 return eventResult; | 1486 return eventResult; |
| 1487 | 1487 |
| 1488 HitTestRequest request(HitTestRequest::ReadOnly); | 1488 HitTestRequest request(HitTestRequest::ReadOnly); |
| 1489 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); | 1489 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); |
| 1490 | 1490 |
| 1491 // Drag events should never go to text nodes (following IE, and proper mouse
over/out dispatch) | 1491 // Drag events should never go to text nodes (following IE, and proper mouse
over/out dispatch) |
| 1492 RefPtrWillBeRawPtr<Node> newTarget = mev.innerNode(); | 1492 RawPtr<Node> newTarget = mev.innerNode(); |
| 1493 if (newTarget && newTarget->isTextNode()) | 1493 if (newTarget && newTarget->isTextNode()) |
| 1494 newTarget = FlatTreeTraversal::parent(*newTarget); | 1494 newTarget = FlatTreeTraversal::parent(*newTarget); |
| 1495 | 1495 |
| 1496 if (AutoscrollController* controller = autoscrollController()) | 1496 if (AutoscrollController* controller = autoscrollController()) |
| 1497 controller->updateDragAndDrop(newTarget.get(), event.position(), event.t
imestamp()); | 1497 controller->updateDragAndDrop(newTarget.get(), event.position(), event.t
imestamp()); |
| 1498 | 1498 |
| 1499 if (m_dragTarget != newTarget) { | 1499 if (m_dragTarget != newTarget) { |
| 1500 // FIXME: this ordering was explicitly chosen to match WinIE. However, | 1500 // FIXME: this ordering was explicitly chosen to match WinIE. However, |
| 1501 // it is sometimes incorrect when dragging within subframes, as seen wit
h | 1501 // it is sometimes incorrect when dragging within subframes, as seen wit
h |
| 1502 // LayoutTests/fast/events/drag-in-frames.html. | 1502 // LayoutTests/fast/events/drag-in-frames.html. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 void EventHandler::clearDragState() | 1582 void EventHandler::clearDragState() |
| 1583 { | 1583 { |
| 1584 stopAutoscroll(); | 1584 stopAutoscroll(); |
| 1585 m_dragTarget = nullptr; | 1585 m_dragTarget = nullptr; |
| 1586 m_capturingMouseEventsNode = nullptr; | 1586 m_capturingMouseEventsNode = nullptr; |
| 1587 m_shouldOnlyFireDragOverEvent = false; | 1587 m_shouldOnlyFireDragOverEvent = false; |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 void EventHandler::setCapturingMouseEventsNode(PassRefPtrWillBeRawPtr<Node> n) | 1590 void EventHandler::setCapturingMouseEventsNode(RawPtr<Node> n) |
| 1591 { | 1591 { |
| 1592 m_capturingMouseEventsNode = n; | 1592 m_capturingMouseEventsNode = n; |
| 1593 m_eventHandlerWillResetCapturingMouseEventsNode = false; | 1593 m_eventHandlerWillResetCapturingMouseEventsNode = false; |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) | 1596 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) |
| 1597 { | 1597 { |
| 1598 ASSERT(m_frame); | 1598 ASSERT(m_frame); |
| 1599 ASSERT(m_frame->document()); | 1599 ASSERT(m_frame->document()); |
| 1600 | 1600 |
| 1601 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF
rame(m_frame, mev.position()), mev); | 1601 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF
rame(m_frame, mev.position()), mev); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent) | 1604 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent) |
| 1605 { | 1605 { |
| 1606 Node* result = targetNode; | 1606 Node* result = targetNode; |
| 1607 | 1607 |
| 1608 // If we're capturing, we always go right to that node. | 1608 // If we're capturing, we always go right to that node. |
| 1609 if (m_capturingMouseEventsNode) { | 1609 if (m_capturingMouseEventsNode) { |
| 1610 result = m_capturingMouseEventsNode.get(); | 1610 result = m_capturingMouseEventsNode.get(); |
| 1611 } else { | 1611 } else { |
| 1612 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 | 1612 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 |
| 1613 if (result && result->isTextNode()) | 1613 if (result && result->isTextNode()) |
| 1614 result = FlatTreeTraversal::parent(*result); | 1614 result = FlatTreeTraversal::parent(*result); |
| 1615 } | 1615 } |
| 1616 RefPtrWillBeMember<Node> lastNodeUnderMouse = m_nodeUnderMouse; | 1616 Member<Node> lastNodeUnderMouse = m_nodeUnderMouse; |
| 1617 m_nodeUnderMouse = result; | 1617 m_nodeUnderMouse = result; |
| 1618 | 1618 |
| 1619 PaintLayer* layerForLastNode = layerForNode(lastNodeUnderMouse.get()); | 1619 PaintLayer* layerForLastNode = layerForNode(lastNodeUnderMouse.get()); |
| 1620 PaintLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get()); | 1620 PaintLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get()); |
| 1621 Page* page = m_frame->page(); | 1621 Page* page = m_frame->page(); |
| 1622 | 1622 |
| 1623 if (lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document()
!= m_frame->document())) { | 1623 if (lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document()
!= m_frame->document())) { |
| 1624 // The mouse has moved between frames. | 1624 // The mouse has moved between frames. |
| 1625 if (LocalFrame* frame = lastNodeUnderMouse->document().frame()) { | 1625 if (LocalFrame* frame = lastNodeUnderMouse->document().frame()) { |
| 1626 if (FrameView* frameView = frame->view()) | 1626 if (FrameView* frameView = frame->view()) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1646 | 1646 |
| 1647 if (lastNodeUnderMouse && lastNodeUnderMouse->document() != m_frame->documen
t()) { | 1647 if (lastNodeUnderMouse && lastNodeUnderMouse->document() != m_frame->documen
t()) { |
| 1648 lastNodeUnderMouse = nullptr; | 1648 lastNodeUnderMouse = nullptr; |
| 1649 m_lastScrollbarUnderMouse = nullptr; | 1649 m_lastScrollbarUnderMouse = nullptr; |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 if (lastNodeUnderMouse != m_nodeUnderMouse) | 1652 if (lastNodeUnderMouse != m_nodeUnderMouse) |
| 1653 sendNodeTransitionEvents(lastNodeUnderMouse.get(), m_nodeUnderMouse.get(
), mouseEvent); | 1653 sendNodeTransitionEvents(lastNodeUnderMouse.get(), m_nodeUnderMouse.get(
), mouseEvent); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 WebInputEventResult EventHandler::dispatchPointerEvent(EventTarget* target, Pass
RefPtrWillBeRawPtr<PointerEvent> pointerEvent) | 1656 WebInputEventResult EventHandler::dispatchPointerEvent(EventTarget* target, RawP
tr<PointerEvent> pointerEvent) |
| 1657 { | 1657 { |
| 1658 if (!RuntimeEnabledFeatures::pointerEventEnabled()) | 1658 if (!RuntimeEnabledFeatures::pointerEventEnabled()) |
| 1659 return WebInputEventResult::NotHandled; | 1659 return WebInputEventResult::NotHandled; |
| 1660 | 1660 |
| 1661 bool dispatchResult = target->dispatchEvent(pointerEvent.get()); | 1661 bool dispatchResult = target->dispatchEvent(pointerEvent.get()); |
| 1662 return eventToEventResult(pointerEvent, dispatchResult); | 1662 return eventToEventResult(pointerEvent, dispatchResult); |
| 1663 } | 1663 } |
| 1664 | 1664 |
| 1665 void EventHandler::sendNodeTransitionEvents(Node* exitedNode, Node* enteredNode, | 1665 void EventHandler::sendNodeTransitionEvents(Node* exitedNode, Node* enteredNode, |
| 1666 const PlatformMouseEvent& mouseEvent) | 1666 const PlatformMouseEvent& mouseEvent) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1680 // mouseleave events in certain contrived eventhandling scenarios, e.g., whe
n: | 1680 // mouseleave events in certain contrived eventhandling scenarios, e.g., whe
n: |
| 1681 // - the mouseleave handler for a node sets the only capturing-mouseleave-li
stener in its ancestor, or | 1681 // - the mouseleave handler for a node sets the only capturing-mouseleave-li
stener in its ancestor, or |
| 1682 // - DOM mods in any mouseenter/mouseleave handler changes the common ancest
or of exited & entered nodes, etc. | 1682 // - DOM mods in any mouseenter/mouseleave handler changes the common ancest
or of exited & entered nodes, etc. |
| 1683 // We think the spec specifies a "frozen" state to avoid such corner cases (
check the discussion on "candidate event | 1683 // We think the spec specifies a "frozen" state to avoid such corner cases (
check the discussion on "candidate event |
| 1684 // listeners" at http://www.w3.org/TR/uievents), but our code below preserve
s one such behavior from past only to | 1684 // listeners" at http://www.w3.org/TR/uievents), but our code below preserve
s one such behavior from past only to |
| 1685 // match Firefox and IE behavior. | 1685 // match Firefox and IE behavior. |
| 1686 // | 1686 // |
| 1687 // TODO(mustaq): Confirm spec conformance, double-check with other browsers. | 1687 // TODO(mustaq): Confirm spec conformance, double-check with other browsers. |
| 1688 | 1688 |
| 1689 // Create lists of all exited/entered ancestors, locate the common ancestor
& capturing listeners. | 1689 // Create lists of all exited/entered ancestors, locate the common ancestor
& capturing listeners. |
| 1690 WillBeHeapVector<RefPtrWillBeMember<Node>, 32> exitedAncestors; | 1690 HeapVector<Member<Node>, 32> exitedAncestors; |
| 1691 WillBeHeapVector<RefPtrWillBeMember<Node>, 32> enteredAncestors; | 1691 HeapVector<Member<Node>, 32> enteredAncestors; |
| 1692 if (isNodeInDocument(exitedNode)) { | 1692 if (isNodeInDocument(exitedNode)) { |
| 1693 exitedNode->updateDistribution(); | 1693 exitedNode->updateDistribution(); |
| 1694 for (Node* node = exitedNode; node; node = FlatTreeTraversal::parent(*no
de)) { | 1694 for (Node* node = exitedNode; node; node = FlatTreeTraversal::parent(*no
de)) { |
| 1695 exitedAncestors.append(node); | 1695 exitedAncestors.append(node); |
| 1696 } | 1696 } |
| 1697 } | 1697 } |
| 1698 if (isNodeInDocument(enteredNode)) { | 1698 if (isNodeInDocument(enteredNode)) { |
| 1699 enteredNode->updateDistribution(); | 1699 enteredNode->updateDistribution(); |
| 1700 for (Node* node = enteredNode; node; node = FlatTreeTraversal::parent(*n
ode)) { | 1700 for (Node* node = enteredNode; node; node = FlatTreeTraversal::parent(*n
ode)) { |
| 1701 enteredAncestors.append(node); | 1701 enteredAncestors.append(node); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 sendPointerAndMouseTransitionEvents(enteredAncestors[i-1].get(), EventTy
peNames::mouseenter, mouseEvent, exitedNode, !enteredNodeHasCapturingAncestor); | 1752 sendPointerAndMouseTransitionEvents(enteredAncestors[i-1].get(), EventTy
peNames::mouseenter, mouseEvent, exitedNode, !enteredNodeHasCapturingAncestor); |
| 1753 } | 1753 } |
| 1754 } | 1754 } |
| 1755 | 1755 |
| 1756 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy
pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent) | 1756 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy
pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent) |
| 1757 { | 1757 { |
| 1758 updateMouseEventTargetNode(targetNode, mouseEvent); | 1758 updateMouseEventTargetNode(targetNode, mouseEvent); |
| 1759 if (!m_nodeUnderMouse) | 1759 if (!m_nodeUnderMouse) |
| 1760 return WebInputEventResult::NotHandled; | 1760 return WebInputEventResult::NotHandled; |
| 1761 | 1761 |
| 1762 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, m_nodeU
nderMouse->document().domWindow(), mouseEvent, clickCount, nullptr); | 1762 RawPtr<MouseEvent> event = MouseEvent::create(eventType, m_nodeUnderMouse->d
ocument().domWindow(), mouseEvent, clickCount, nullptr); |
| 1763 bool dispatchResult = m_nodeUnderMouse->dispatchEvent(event); | 1763 bool dispatchResult = m_nodeUnderMouse->dispatchEvent(event); |
| 1764 return eventToEventResult(event, dispatchResult); | 1764 return eventToEventResult(event, dispatchResult); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 EventTarget* EventHandler::getEffectiveTargetForPointerEvent( | 1767 EventTarget* EventHandler::getEffectiveTargetForPointerEvent( |
| 1768 EventTarget* target, PassRefPtrWillBeRawPtr<PointerEvent> pointerEvent) | 1768 EventTarget* target, RawPtr<PointerEvent> pointerEvent) |
| 1769 { | 1769 { |
| 1770 EventTarget* capturingNode = m_pointerEventManager.getCapturingNode(pointerE
vent.get()); | 1770 EventTarget* capturingNode = m_pointerEventManager.getCapturingNode(pointerE
vent.get()); |
| 1771 if (capturingNode) | 1771 if (capturingNode) |
| 1772 target = capturingNode; | 1772 target = capturingNode; |
| 1773 return target; | 1773 return target; |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 void EventHandler::sendPointerAndMouseTransitionEvents(Node* target, const Atomi
cString& mouseEventType, | 1776 void EventHandler::sendPointerAndMouseTransitionEvents(Node* target, const Atomi
cString& mouseEventType, |
| 1777 const PlatformMouseEvent& mouseEvent, Node* relatedTarget, bool checkForList
ener) | 1777 const PlatformMouseEvent& mouseEvent, Node* relatedTarget, bool checkForList
ener) |
| 1778 { | 1778 { |
| 1779 ASSERT(mouseEventType == EventTypeNames::mouseenter | 1779 ASSERT(mouseEventType == EventTypeNames::mouseenter |
| 1780 || mouseEventType == EventTypeNames::mouseleave | 1780 || mouseEventType == EventTypeNames::mouseleave |
| 1781 || mouseEventType == EventTypeNames::mouseover | 1781 || mouseEventType == EventTypeNames::mouseover |
| 1782 || mouseEventType == EventTypeNames::mouseout); | 1782 || mouseEventType == EventTypeNames::mouseout); |
| 1783 | 1783 |
| 1784 AtomicString pointerEventType = pointerEventNameForMouseEventName(mouseEvent
Type); | 1784 AtomicString pointerEventType = pointerEventNameForMouseEventName(mouseEvent
Type); |
| 1785 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventManager.create
(pointerEventType, | 1785 RawPtr<PointerEvent> pointerEvent = m_pointerEventManager.create(pointerEven
tType, |
| 1786 mouseEvent, relatedTarget, m_frame->document()->domWindow()); | 1786 mouseEvent, relatedTarget, m_frame->document()->domWindow()); |
| 1787 | 1787 |
| 1788 // Suppress these events if the target is not the capturing element | 1788 // Suppress these events if the target is not the capturing element |
| 1789 if (target != getEffectiveTargetForPointerEvent(target, pointerEvent)) | 1789 if (target != getEffectiveTargetForPointerEvent(target, pointerEvent)) |
| 1790 return; | 1790 return; |
| 1791 | 1791 |
| 1792 if (!checkForListener || target->hasEventListeners(pointerEventType)) | 1792 if (!checkForListener || target->hasEventListeners(pointerEventType)) |
| 1793 dispatchPointerEvent(target, pointerEvent); | 1793 dispatchPointerEvent(target, pointerEvent); |
| 1794 | 1794 |
| 1795 if (!checkForListener || target->hasEventListeners(mouseEventType)) | 1795 if (!checkForListener || target->hasEventListeners(mouseEventType)) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1808 return WebInputEventResult::NotHandled; | 1808 return WebInputEventResult::NotHandled; |
| 1809 | 1809 |
| 1810 AtomicString pointerEventType = pointerEventNameForMouseEventName(mouseEvent
Type); | 1810 AtomicString pointerEventType = pointerEventNameForMouseEventName(mouseEvent
Type); |
| 1811 unsigned short pointerButtonsPressed = MouseEvent::platformModifiersToButton
s(mouseEvent.modifiers()); | 1811 unsigned short pointerButtonsPressed = MouseEvent::platformModifiersToButton
s(mouseEvent.modifiers()); |
| 1812 | 1812 |
| 1813 // Make sure chorded buttons fire pointermove instead of pointerup/pointerdo
wn. | 1813 // Make sure chorded buttons fire pointermove instead of pointerup/pointerdo
wn. |
| 1814 if ((pointerEventType == EventTypeNames::pointerdown && (pointerButtonsPress
ed & ~MouseEvent::buttonToButtons(mouseEvent.button())) != 0) | 1814 if ((pointerEventType == EventTypeNames::pointerdown && (pointerButtonsPress
ed & ~MouseEvent::buttonToButtons(mouseEvent.button())) != 0) |
| 1815 || (pointerEventType == EventTypeNames::pointerup && pointerButtonsPress
ed != 0)) | 1815 || (pointerEventType == EventTypeNames::pointerup && pointerButtonsPress
ed != 0)) |
| 1816 pointerEventType = EventTypeNames::pointermove; | 1816 pointerEventType = EventTypeNames::pointermove; |
| 1817 | 1817 |
| 1818 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventManager.create
(pointerEventType, | 1818 RawPtr<PointerEvent> pointerEvent = m_pointerEventManager.create(pointerEven
tType, |
| 1819 mouseEvent, nullptr, m_frame->document()->domWindow()); | 1819 mouseEvent, nullptr, m_frame->document()->domWindow()); |
| 1820 | 1820 |
| 1821 EventTarget* target = getEffectiveTargetForPointerEvent(m_nodeUnderMouse.get
(), pointerEvent); | 1821 EventTarget* target = getEffectiveTargetForPointerEvent(m_nodeUnderMouse.get
(), pointerEvent); |
| 1822 WebInputEventResult result = dispatchPointerEvent(target, pointerEvent); | 1822 WebInputEventResult result = dispatchPointerEvent(target, pointerEvent); |
| 1823 | 1823 |
| 1824 if (result != WebInputEventResult::NotHandled && pointerEventType == EventTy
peNames::pointerdown) | 1824 if (result != WebInputEventResult::NotHandled && pointerEventType == EventTy
peNames::pointerdown) |
| 1825 m_preventMouseEventForPointerTypeMouse = true; | 1825 m_preventMouseEventForPointerTypeMouse = true; |
| 1826 | 1826 |
| 1827 if (!m_preventMouseEventForPointerTypeMouse) { | 1827 if (!m_preventMouseEventForPointerTypeMouse) { |
| 1828 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(mouseEventType
, m_nodeUnderMouse->document().domWindow(), mouseEvent, clickCount, nullptr); | 1828 RawPtr<MouseEvent> event = MouseEvent::create(mouseEventType, m_nodeUnde
rMouse->document().domWindow(), mouseEvent, clickCount, nullptr); |
| 1829 bool dispatchResult = target->dispatchEvent(event); | 1829 bool dispatchResult = target->dispatchEvent(event); |
| 1830 result = mergeEventResult(result, eventToEventResult(event, dispatchResu
lt)); | 1830 result = mergeEventResult(result, eventToEventResult(event, dispatchResu
lt)); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 return result; | 1833 return result; |
| 1834 } | 1834 } |
| 1835 | 1835 |
| 1836 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe
sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) | 1836 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe
sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) |
| 1837 { | 1837 { |
| 1838 // If clicking on a frame scrollbar, do not mess up with content focus. | 1838 // If clicking on a frame scrollbar, do not mess up with content focus. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 | 1954 |
| 1955 } // namespace | 1955 } // namespace |
| 1956 | 1956 |
| 1957 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve
nt) | 1957 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve
nt) |
| 1958 { | 1958 { |
| 1959 Document* doc = m_frame->document(); | 1959 Document* doc = m_frame->document(); |
| 1960 | 1960 |
| 1961 if (!doc->layoutView()) | 1961 if (!doc->layoutView()) |
| 1962 return WebInputEventResult::NotHandled; | 1962 return WebInputEventResult::NotHandled; |
| 1963 | 1963 |
| 1964 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 1964 RawPtr<FrameView> protector(m_frame->view()); |
| 1965 | 1965 |
| 1966 FrameView* view = m_frame->view(); | 1966 FrameView* view = m_frame->view(); |
| 1967 if (!view) | 1967 if (!view) |
| 1968 return WebInputEventResult::NotHandled; | 1968 return WebInputEventResult::NotHandled; |
| 1969 | 1969 |
| 1970 LayoutPoint vPoint = view->rootFrameToContents(event.position()); | 1970 LayoutPoint vPoint = view->rootFrameToContents(event.position()); |
| 1971 | 1971 |
| 1972 HitTestRequest request(HitTestRequest::ReadOnly); | 1972 HitTestRequest request(HitTestRequest::ReadOnly); |
| 1973 HitTestResult result(request, vPoint); | 1973 HitTestResult result(request, vPoint); |
| 1974 doc->layoutView()->hitTest(result); | 1974 doc->layoutView()->hitTest(result); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1990 if (isOverWidget && target && target->isLayoutPart()) { | 1990 if (isOverWidget && target && target->isLayoutPart()) { |
| 1991 if (Widget* widget = toLayoutPart(target)->widget()) { | 1991 if (Widget* widget = toLayoutPart(target)->widget()) { |
| 1992 WebInputEventResult result = passWheelEventToWidget(event, *widg
et); | 1992 WebInputEventResult result = passWheelEventToWidget(event, *widg
et); |
| 1993 if (result != WebInputEventResult::NotHandled) { | 1993 if (result != WebInputEventResult::NotHandled) { |
| 1994 setFrameWasScrolledByUser(); | 1994 setFrameWasScrolledByUser(); |
| 1995 return result; | 1995 return result; |
| 1996 } | 1996 } |
| 1997 } | 1997 } |
| 1998 } | 1998 } |
| 1999 | 1999 |
| 2000 RefPtrWillBeRawPtr<Event> domEvent = WheelEvent::create(event, node->doc
ument().domWindow()); | 2000 RawPtr<Event> domEvent = WheelEvent::create(event, node->document().domW
indow()); |
| 2001 if (!node->dispatchEvent(domEvent)) { | 2001 if (!node->dispatchEvent(domEvent)) { |
| 2002 setFrameWasScrolledByUser(); | 2002 setFrameWasScrolledByUser(); |
| 2003 return eventToEventResult(domEvent, false); | 2003 return eventToEventResult(domEvent, false); |
| 2004 } | 2004 } |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 // We do another check on the frame view because the event handler can run | 2007 // We do another check on the frame view because the event handler can run |
| 2008 // JS which results in the frame getting destroyed. | 2008 // JS which results in the frame getting destroyed. |
| 2009 view = m_frame->view(); | 2009 view = m_frame->view(); |
| 2010 if (!view) | 2010 if (!view) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven
t); | 2110 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven
t); |
| 2111 | 2111 |
| 2112 // No hit test result, handle in root instance. Perhaps we should just retur
n false instead? | 2112 // No hit test result, handle in root instance. Perhaps we should just retur
n false instead? |
| 2113 return handleGestureEventInFrame(targetedEvent); | 2113 return handleGestureEventInFrame(targetedEvent); |
| 2114 } | 2114 } |
| 2115 | 2115 |
| 2116 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi
thHitTestResults& targetedEvent) | 2116 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi
thHitTestResults& targetedEvent) |
| 2117 { | 2117 { |
| 2118 ASSERT(!targetedEvent.event().isScrollEvent()); | 2118 ASSERT(!targetedEvent.event().isScrollEvent()); |
| 2119 | 2119 |
| 2120 RefPtrWillBeRawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNo
de(); | 2120 RawPtr<Node> eventTarget = targetedEvent.hitTestResult().innerNode(); |
| 2121 RefPtrWillBeRawPtr<Scrollbar> scrollbar = targetedEvent.hitTestResult().scro
llbar(); | 2121 RawPtr<Scrollbar> scrollbar = targetedEvent.hitTestResult().scrollbar(); |
| 2122 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2122 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 2123 | 2123 |
| 2124 if (scrollbar) { | 2124 if (scrollbar) { |
| 2125 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); | 2125 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); |
| 2126 if (gestureEvent.type() == PlatformEvent::GestureTapDown && eventSwallow
ed) | 2126 if (gestureEvent.type() == PlatformEvent::GestureTapDown && eventSwallow
ed) |
| 2127 m_scrollbarHandlingScrollGesture = scrollbar; | 2127 m_scrollbarHandlingScrollGesture = scrollbar; |
| 2128 if (eventSwallowed) | 2128 if (eventSwallowed) |
| 2129 return WebInputEventResult::HandledSuppressed; | 2129 return WebInputEventResult::HandledSuppressed; |
| 2130 } | 2130 } |
| 2131 | 2131 |
| 2132 if (eventTarget) { | 2132 if (eventTarget) { |
| 2133 RefPtrWillBeRawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(
eventTarget->document().domWindow(), gestureEvent); | 2133 RawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(eventTarget-
>document().domWindow(), gestureEvent); |
| 2134 // TODO(dtapuska): dispatchEvent is inverted for Gesture Events | 2134 // TODO(dtapuska): dispatchEvent is inverted for Gesture Events |
| 2135 // crbug.com/560357 | 2135 // crbug.com/560357 |
| 2136 if (gestureDomEvent.get() && eventTarget->dispatchEvent(gestureDomEvent)
) | 2136 if (gestureDomEvent.get() && eventTarget->dispatchEvent(gestureDomEvent)
) |
| 2137 return eventToEventResult(gestureDomEvent, false); | 2137 return eventToEventResult(gestureDomEvent, false); |
| 2138 } | 2138 } |
| 2139 | 2139 |
| 2140 switch (gestureEvent.type()) { | 2140 switch (gestureEvent.type()) { |
| 2141 case PlatformEvent::GestureTap: | 2141 case PlatformEvent::GestureTap: |
| 2142 return handleGestureTap(targetedEvent); | 2142 return handleGestureTap(targetedEvent); |
| 2143 case PlatformEvent::GestureShowPress: | 2143 case PlatformEvent::GestureShowPress: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2159 ASSERT_NOT_REACHED(); | 2159 ASSERT_NOT_REACHED(); |
| 2160 } | 2160 } |
| 2161 | 2161 |
| 2162 return WebInputEventResult::NotHandled; | 2162 return WebInputEventResult::NotHandled; |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture
Event& gestureEvent) | 2165 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture
Event& gestureEvent) |
| 2166 { | 2166 { |
| 2167 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); | 2167 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); |
| 2168 | 2168 |
| 2169 RefPtrWillBeRawPtr<Node> eventTarget = nullptr; | 2169 RawPtr<Node> eventTarget = nullptr; |
| 2170 RefPtrWillBeRawPtr<Scrollbar> scrollbar = nullptr; | 2170 RawPtr<Scrollbar> scrollbar = nullptr; |
| 2171 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { | 2171 if (gestureEvent.type() != PlatformEvent::GestureScrollBegin) { |
| 2172 scrollbar = m_scrollbarHandlingScrollGesture.get(); | 2172 scrollbar = m_scrollbarHandlingScrollGesture.get(); |
| 2173 eventTarget = m_scrollGestureHandlingNode.get(); | 2173 eventTarget = m_scrollGestureHandlingNode.get(); |
| 2174 } | 2174 } |
| 2175 | 2175 |
| 2176 if (!eventTarget) { | 2176 if (!eventTarget) { |
| 2177 Document* document = m_frame->document(); | 2177 Document* document = m_frame->document(); |
| 2178 if (!document->layoutView()) | 2178 if (!document->layoutView()) |
| 2179 return WebInputEventResult::NotHandled; | 2179 return WebInputEventResult::NotHandled; |
| 2180 | 2180 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2202 m_scrollbarHandlingScrollGesture = nullptr; | 2202 m_scrollbarHandlingScrollGesture = nullptr; |
| 2203 } | 2203 } |
| 2204 if (eventSwallowed) | 2204 if (eventSwallowed) |
| 2205 return WebInputEventResult::HandledSuppressed; | 2205 return WebInputEventResult::HandledSuppressed; |
| 2206 } | 2206 } |
| 2207 | 2207 |
| 2208 if (eventTarget) { | 2208 if (eventTarget) { |
| 2209 if (handleScrollGestureOnResizer(eventTarget.get(), gestureEvent)) | 2209 if (handleScrollGestureOnResizer(eventTarget.get(), gestureEvent)) |
| 2210 return WebInputEventResult::HandledSuppressed; | 2210 return WebInputEventResult::HandledSuppressed; |
| 2211 | 2211 |
| 2212 RefPtrWillBeRawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(
eventTarget->document().domWindow(), gestureEvent); | 2212 RawPtr<GestureEvent> gestureDomEvent = GestureEvent::create(eventTarget-
>document().domWindow(), gestureEvent); |
| 2213 // TODO(dtapuska): dispatchEvent is inverted for Gesture Events | 2213 // TODO(dtapuska): dispatchEvent is inverted for Gesture Events |
| 2214 // crbug.com/560357 | 2214 // crbug.com/560357 |
| 2215 if (gestureDomEvent.get() && eventTarget->dispatchEvent(gestureDomEvent)
) | 2215 if (gestureDomEvent.get() && eventTarget->dispatchEvent(gestureDomEvent)
) |
| 2216 return eventToEventResult(gestureDomEvent, false); | 2216 return eventToEventResult(gestureDomEvent, false); |
| 2217 } | 2217 } |
| 2218 | 2218 |
| 2219 switch (gestureEvent.type()) { | 2219 switch (gestureEvent.type()) { |
| 2220 case PlatformEvent::GestureScrollBegin: | 2220 case PlatformEvent::GestureScrollBegin: |
| 2221 return handleGestureScrollBegin(gestureEvent); | 2221 return handleGestureScrollBegin(gestureEvent); |
| 2222 case PlatformEvent::GestureScrollUpdate: | 2222 case PlatformEvent::GestureScrollUpdate: |
| 2223 return handleGestureScrollUpdate(gestureEvent); | 2223 return handleGestureScrollUpdate(gestureEvent); |
| 2224 case PlatformEvent::GestureScrollEnd: | 2224 case PlatformEvent::GestureScrollEnd: |
| 2225 return handleGestureScrollEnd(gestureEvent); | 2225 return handleGestureScrollEnd(gestureEvent); |
| 2226 case PlatformEvent::GestureFlingStart: | 2226 case PlatformEvent::GestureFlingStart: |
| 2227 case PlatformEvent::GesturePinchBegin: | 2227 case PlatformEvent::GesturePinchBegin: |
| 2228 case PlatformEvent::GesturePinchEnd: | 2228 case PlatformEvent::GesturePinchEnd: |
| 2229 case PlatformEvent::GesturePinchUpdate: | 2229 case PlatformEvent::GesturePinchUpdate: |
| 2230 return WebInputEventResult::NotHandled; | 2230 return WebInputEventResult::NotHandled; |
| 2231 default: | 2231 default: |
| 2232 ASSERT_NOT_REACHED(); | 2232 ASSERT_NOT_REACHED(); |
| 2233 return WebInputEventResult::NotHandled; | 2233 return WebInputEventResult::NotHandled; |
| 2234 } | 2234 } |
| 2235 } | 2235 } |
| 2236 | 2236 |
| 2237 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest
Results& targetedEvent) | 2237 WebInputEventResult EventHandler::handleGestureTap(const GestureEventWithHitTest
Results& targetedEvent) |
| 2238 { | 2238 { |
| 2239 RefPtrWillBeRawPtr<FrameView> frameView(m_frame->view()); | 2239 RawPtr<FrameView> frameView(m_frame->view()); |
| 2240 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2240 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
| 2241 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur
eEvent.type()); | 2241 HitTestRequest::HitTestRequestType hitType = getHitTypeForGestureType(gestur
eEvent.type()); |
| 2242 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); | 2242 uint64_t preDispatchDomTreeVersion = m_frame->document()->domTreeVersion(); |
| 2243 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); | 2243 uint64_t preDispatchStyleVersion = m_frame->document()->styleVersion(); |
| 2244 | 2244 |
| 2245 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 2245 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 2246 | 2246 |
| 2247 HitTestResult currentHitTest = targetedEvent.hitTestResult(); | 2247 HitTestResult currentHitTest = targetedEvent.hitTestResult(); |
| 2248 | 2248 |
| 2249 // We use the adjusted position so the application isn't surprised to see a
event with | 2249 // We use the adjusted position so the application isn't surprised to see a
event with |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2267 if (currentHitTest.innerNode()) { | 2267 if (currentHitTest.innerNode()) { |
| 2268 LocalFrame* mainFrame = m_frame->localFrameRoot(); | 2268 LocalFrame* mainFrame = m_frame->localFrameRoot(); |
| 2269 if (mainFrame && mainFrame->view()) | 2269 if (mainFrame && mainFrame->view()) |
| 2270 mainFrame->view()->updateAllLifecyclePhases(); | 2270 mainFrame->view()->updateAllLifecyclePhases(); |
| 2271 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); | 2271 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); |
| 2272 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); | 2272 currentHitTest = hitTestResultInFrame(m_frame, adjustedPoint, hitType); |
| 2273 } | 2273 } |
| 2274 m_clickNode = currentHitTest.innerNode(); | 2274 m_clickNode = currentHitTest.innerNode(); |
| 2275 | 2275 |
| 2276 // Capture data for showUnhandledTapUIIfNeeded. | 2276 // Capture data for showUnhandledTapUIIfNeeded. |
| 2277 RefPtrWillBeRawPtr<Node> tappedNode = m_clickNode; | 2277 RawPtr<Node> tappedNode = m_clickNode; |
| 2278 IntPoint tappedPosition = gestureEvent.position(); | 2278 IntPoint tappedPosition = gestureEvent.position(); |
| 2279 | 2279 |
| 2280 if (m_clickNode && m_clickNode->isTextNode()) | 2280 if (m_clickNode && m_clickNode->isTextNode()) |
| 2281 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); | 2281 m_clickNode = FlatTreeTraversal::parent(*m_clickNode); |
| 2282 | 2282 |
| 2283 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), | 2283 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), |
| 2284 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), | 2284 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), |
| 2285 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), | 2285 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), |
| 2286 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp
erties::PointerType::Mouse); | 2286 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProp
erties::PointerType::Mouse); |
| 2287 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames
::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown)
; | 2287 WebInputEventResult mouseDownEventResult = dispatchMouseEvent(EventTypeNames
::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown)
; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2360 m_mouseDown = mouseDownEvent; | 2360 m_mouseDown = mouseDownEvent; |
| 2361 | 2361 |
| 2362 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, | 2362 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, |
| 2363 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), | 2363 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::Lef
tButtonDown), |
| 2364 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); | 2364 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), W
ebPointerProperties::PointerType::Mouse); |
| 2365 HitTestRequest request(HitTestRequest::ReadOnly); | 2365 HitTestRequest request(HitTestRequest::ReadOnly); |
| 2366 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); | 2366 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); |
| 2367 m_mouseDownMayStartDrag = true; | 2367 m_mouseDownMayStartDrag = true; |
| 2368 dragState().m_dragSrc = nullptr; | 2368 dragState().m_dragSrc = nullptr; |
| 2369 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos
ition()); | 2369 m_mouseDownPos = m_frame->view()->rootFrameToContents(mouseDragEvent.pos
ition()); |
| 2370 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2370 RawPtr<FrameView> protector(m_frame->view()); |
| 2371 if (handleDrag(mev, DragInitiator::Touch)) { | 2371 if (handleDrag(mev, DragInitiator::Touch)) { |
| 2372 m_longTapShouldInvokeContextMenu = true; | 2372 m_longTapShouldInvokeContextMenu = true; |
| 2373 return WebInputEventResult::HandledSystem; | 2373 return WebInputEventResult::HandledSystem; |
| 2374 } | 2374 } |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po
sition()); | 2377 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po
sition()); |
| 2378 HitTestResult result = hitTestResultAtPoint(hitTestPoint); | 2378 HitTestResult result = hitTestResultAtPoint(hitTestPoint); |
| 2379 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2379 RawPtr<FrameView> protector(m_frame->view()); |
| 2380 if (selectionController().handleGestureLongPress(gestureEvent, result)) { | 2380 if (selectionController().handleGestureLongPress(gestureEvent, result)) { |
| 2381 focusDocumentView(); | 2381 focusDocumentView(); |
| 2382 return WebInputEventResult::HandledSystem; | 2382 return WebInputEventResult::HandledSystem; |
| 2383 } | 2383 } |
| 2384 | 2384 |
| 2385 return sendContextMenuEventForGesture(targetedEvent); | 2385 return sendContextMenuEventForGesture(targetedEvent); |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 WebInputEventResult EventHandler::handleGestureLongTap(const GestureEventWithHit
TestResults& targetedEvent) | 2388 WebInputEventResult EventHandler::handleGestureLongTap(const GestureEventWithHit
TestResults& targetedEvent) |
| 2389 { | 2389 { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 Widget* widget = toLayoutPart(layoutObject)->widget(); | 2433 Widget* widget = toLayoutPart(layoutObject)->widget(); |
| 2434 | 2434 |
| 2435 if (!widget || !widget->isFrameView()) | 2435 if (!widget || !widget->isFrameView()) |
| 2436 return WebInputEventResult::NotHandled; | 2436 return WebInputEventResult::NotHandled; |
| 2437 | 2437 |
| 2438 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent(
gestureEvent); | 2438 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent(
gestureEvent); |
| 2439 } | 2439 } |
| 2440 | 2440 |
| 2441 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv
ent& gestureEvent) | 2441 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv
ent& gestureEvent) |
| 2442 { | 2442 { |
| 2443 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode; | 2443 RawPtr<Node> node = m_scrollGestureHandlingNode; |
| 2444 | 2444 |
| 2445 if (node) { | 2445 if (node) { |
| 2446 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); | 2446 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); |
| 2447 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { | 2447 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { |
| 2448 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( | 2448 RawPtr<ScrollState> scrollState = ScrollState::create( |
| 2449 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ | 2449 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ |
| 2450 false, /* isEnding */ true, /* fromUserInput */ true); | 2450 false, /* isEnding */ true, /* fromUserInput */ true); |
| 2451 customizedScroll(*node.get(), *scrollState); | 2451 customizedScroll(*node.get(), *scrollState); |
| 2452 } | 2452 } |
| 2453 } | 2453 } |
| 2454 | 2454 |
| 2455 clearGestureScrollState(); | 2455 clearGestureScrollState(); |
| 2456 return WebInputEventResult::NotHandled; | 2456 return WebInputEventResult::NotHandled; |
| 2457 } | 2457 } |
| 2458 | 2458 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2475 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) | 2475 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) |
| 2476 m_scrollGestureHandlingNode = m_frame->document()->documentElement()
; | 2476 m_scrollGestureHandlingNode = m_frame->document()->documentElement()
; |
| 2477 else | 2477 else |
| 2478 return WebInputEventResult::NotHandled; | 2478 return WebInputEventResult::NotHandled; |
| 2479 } | 2479 } |
| 2480 ASSERT(m_scrollGestureHandlingNode); | 2480 ASSERT(m_scrollGestureHandlingNode); |
| 2481 | 2481 |
| 2482 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la
youtObject()); | 2482 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la
youtObject()); |
| 2483 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { | 2483 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { |
| 2484 m_currentScrollChain.clear(); | 2484 m_currentScrollChain.clear(); |
| 2485 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( | 2485 RawPtr<ScrollState> scrollState = ScrollState::create( |
| 2486 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ | 2486 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ |
| 2487 true, /* isEnding */ false, /* fromUserInput */ true); | 2487 true, /* isEnding */ false, /* fromUserInput */ true); |
| 2488 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); | 2488 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); |
| 2489 } else { | 2489 } else { |
| 2490 if (m_frame->isMainFrame()) | 2490 if (m_frame->isMainFrame()) |
| 2491 m_frame->host()->topControls().scrollBegin(); | 2491 m_frame->host()->topControls().scrollBegin(); |
| 2492 } | 2492 } |
| 2493 return WebInputEventResult::HandledSystem; | 2493 return WebInputEventResult::HandledSystem; |
| 2494 } | 2494 } |
| 2495 | 2495 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 ScrollGranularity granularity = gestureEvent.deltaUnits(); | 2533 ScrollGranularity granularity = gestureEvent.deltaUnits(); |
| 2534 Node* node = m_scrollGestureHandlingNode.get(); | 2534 Node* node = m_scrollGestureHandlingNode.get(); |
| 2535 | 2535 |
| 2536 // Scroll customization is only available for touch. | 2536 // Scroll customization is only available for touch. |
| 2537 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization
Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen; | 2537 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization
Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen; |
| 2538 if (node) { | 2538 if (node) { |
| 2539 LayoutObject* layoutObject = node->layoutObject(); | 2539 LayoutObject* layoutObject = node->layoutObject(); |
| 2540 if (!layoutObject) | 2540 if (!layoutObject) |
| 2541 return WebInputEventResult::NotHandled; | 2541 return WebInputEventResult::NotHandled; |
| 2542 | 2542 |
| 2543 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2543 RawPtr<FrameView> protector(m_frame->view()); |
| 2544 | 2544 |
| 2545 Node* stopNode = nullptr; | 2545 Node* stopNode = nullptr; |
| 2546 | 2546 |
| 2547 // Try to send the event to the correct view. | 2547 // Try to send the event to the correct view. |
| 2548 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent
, layoutObject); | 2548 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent
, layoutObject); |
| 2549 if (result != WebInputEventResult::NotHandled) { | 2549 if (result != WebInputEventResult::NotHandled) { |
| 2550 if (gestureEvent.preventPropagation() | 2550 if (gestureEvent.preventPropagation() |
| 2551 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) { | 2551 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) { |
| 2552 // This is an optimization which doesn't apply with | 2552 // This is an optimization which doesn't apply with |
| 2553 // scroll customization enabled. | 2553 // scroll customization enabled. |
| 2554 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; | 2554 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; |
| 2555 } | 2555 } |
| 2556 // FIXME: we should allow simultaneous scrolling of nested | 2556 // FIXME: we should allow simultaneous scrolling of nested |
| 2557 // iframes along perpendicular axes. See crbug.com/466991. | 2557 // iframes along perpendicular axes. See crbug.com/466991. |
| 2558 m_deltaConsumedForScrollSequence = true; | 2558 m_deltaConsumedForScrollSequence = true; |
| 2559 return result; | 2559 return result; |
| 2560 } | 2560 } |
| 2561 | 2561 |
| 2562 bool scrolled = false; | 2562 bool scrolled = false; |
| 2563 if (handleScrollCustomization) { | 2563 if (handleScrollCustomization) { |
| 2564 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( | 2564 RawPtr<ScrollState> scrollState = ScrollState::create( |
| 2565 gestureEvent.deltaX(), gestureEvent.deltaY(), | 2565 gestureEvent.deltaX(), gestureEvent.deltaY(), |
| 2566 0, gestureEvent.velocityX(), gestureEvent.velocityY(), | 2566 0, gestureEvent.velocityX(), gestureEvent.velocityY(), |
| 2567 gestureEvent.inertial(), /* isBeginning */ | 2567 gestureEvent.inertial(), /* isBeginning */ |
| 2568 false, /* isEnding */ false, /* fromUserInput */ true, | 2568 false, /* isEnding */ false, /* fromUserInput */ true, |
| 2569 !gestureEvent.preventPropagation(), m_deltaConsumedForScrollSequ
ence); | 2569 !gestureEvent.preventPropagation(), m_deltaConsumedForScrollSequ
ence); |
| 2570 if (m_previousGestureScrolledNode) { | 2570 if (m_previousGestureScrolledNode) { |
| 2571 // The ScrollState needs to know what the current | 2571 // The ScrollState needs to know what the current |
| 2572 // native scrolling element is, so that for an | 2572 // native scrolling element is, so that for an |
| 2573 // inertial scroll that shouldn't propagate, only the | 2573 // inertial scroll that shouldn't propagate, only the |
| 2574 // currently scrolling element responds. | 2574 // currently scrolling element responds. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 // DOM nodes so a touch over a scrollbar will be adjusted towards nearby nod
es. This leads to things like textarea | 2652 // DOM nodes so a touch over a scrollbar will be adjusted towards nearby nod
es. This leads to things like textarea |
| 2653 // scrollbars being untouchable. | 2653 // scrollbars being untouchable. |
| 2654 if (result.scrollbar()) { | 2654 if (result.scrollbar()) { |
| 2655 targetNode = 0; | 2655 targetNode = 0; |
| 2656 return false; | 2656 return false; |
| 2657 } | 2657 } |
| 2658 | 2658 |
| 2659 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo
intInMainFrame()); | 2659 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo
intInMainFrame()); |
| 2660 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat
ion().boundingBox()); | 2660 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat
ion().boundingBox()); |
| 2661 | 2661 |
| 2662 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; | 2662 HeapVector<Member<Node>, 11> nodes; |
| 2663 copyToVector(result.listBasedTestResult(), nodes); | 2663 copyToVector(result.listBasedTestResult(), nodes); |
| 2664 | 2664 |
| 2665 // FIXME: the explicit Vector conversion copies into a temporary and is wast
eful. | 2665 // FIXME: the explicit Vector conversion copies into a temporary and is wast
eful. |
| 2666 return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touc
hRect, WillBeHeapVector<RefPtrWillBeMember<Node>> (nodes)); | 2666 return findBestClickableCandidate(targetNode, targetPoint, touchCenter, touc
hRect, HeapVector<Member<Node>> (nodes)); |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu
lt, IntPoint& targetPoint, Node*& targetNode) | 2669 bool EventHandler::bestContextMenuNodeForHitTestResult(const HitTestResult& resu
lt, IntPoint& targetPoint, Node*& targetNode) |
| 2670 { | 2670 { |
| 2671 ASSERT(result.isRectBasedTest()); | 2671 ASSERT(result.isRectBasedTest()); |
| 2672 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo
intInMainFrame()); | 2672 IntPoint touchCenter = m_frame->view()->contentsToRootFrame(result.roundedPo
intInMainFrame()); |
| 2673 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat
ion().boundingBox()); | 2673 IntRect touchRect = m_frame->view()->contentsToRootFrame(result.hitTestLocat
ion().boundingBox()); |
| 2674 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; | 2674 HeapVector<Member<Node>, 11> nodes; |
| 2675 copyToVector(result.listBasedTestResult(), nodes); | 2675 copyToVector(result.listBasedTestResult(), nodes); |
| 2676 | 2676 |
| 2677 // FIXME: the explicit Vector conversion copies into a temporary and is wast
eful. | 2677 // FIXME: the explicit Vector conversion copies into a temporary and is wast
eful. |
| 2678 return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, to
uchRect, WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes)); | 2678 return findBestContextMenuCandidate(targetNode, targetPoint, touchCenter, to
uchRect, HeapVector<Member<Node>>(nodes)); |
| 2679 } | 2679 } |
| 2680 | 2680 |
| 2681 bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co
nst IntSize& touchRadius, IntRect& targetArea, Node*& targetNode) | 2681 bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co
nst IntSize& touchRadius, IntRect& targetArea, Node*& targetNode) |
| 2682 { | 2682 { |
| 2683 if (touchRadius.isEmpty()) | 2683 if (touchRadius.isEmpty()) |
| 2684 return false; | 2684 return false; |
| 2685 | 2685 |
| 2686 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(touchCenter); | 2686 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(touchCenter); |
| 2687 | 2687 |
| 2688 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active | HitTestRequest::ListBased; | 2688 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active | HitTestRequest::ListBased; |
| 2689 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSiz
e(touchRadius)); | 2689 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType, LayoutSiz
e(touchRadius)); |
| 2690 | 2690 |
| 2691 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius); | 2691 IntRect touchRect(touchCenter - touchRadius, touchRadius + touchRadius); |
| 2692 WillBeHeapVector<RefPtrWillBeMember<Node>, 11> nodes; | 2692 HeapVector<Member<Node>, 11> nodes; |
| 2693 copyToVector(result.listBasedTestResult(), nodes); | 2693 copyToVector(result.listBasedTestResult(), nodes); |
| 2694 | 2694 |
| 2695 // FIXME: the explicit Vector conversion copies into a temporary and is wast
eful. | 2695 // FIXME: the explicit Vector conversion copies into a temporary and is wast
eful. |
| 2696 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect,
WillBeHeapVector<RefPtrWillBeMember<Node>>(nodes)); | 2696 return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect,
HeapVector<Member<Node>>(nodes)); |
| 2697 } | 2697 } |
| 2698 | 2698 |
| 2699 // Update the hover and active state across all frames for this gesture. | 2699 // Update the hover and active state across all frames for this gesture. |
| 2700 // This logic is different than the mouse case because mice send MouseLeave even
ts to frames as they're exited. | 2700 // This logic is different than the mouse case because mice send MouseLeave even
ts to frames as they're exited. |
| 2701 // With gestures, a single event conceptually both 'leaves' whatever frame curre
ntly had hover and enters a new frame | 2701 // With gestures, a single event conceptually both 'leaves' whatever frame curre
ntly had hover and enters a new frame |
| 2702 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request,
Element* innerElement) | 2702 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request,
Element* innerElement) |
| 2703 { | 2703 { |
| 2704 ASSERT(m_frame == m_frame->localFrameRoot()); | 2704 ASSERT(m_frame == m_frame->localFrameRoot()); |
| 2705 | 2705 |
| 2706 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> newHoverFrameChain; | 2706 HeapVector<Member<LocalFrame>> newHoverFrameChain; |
| 2707 LocalFrame* newHoverFrameInDocument = innerElement ? innerElement->document(
).frame() : nullptr; | 2707 LocalFrame* newHoverFrameInDocument = innerElement ? innerElement->document(
).frame() : nullptr; |
| 2708 // Insert the ancestors of the frame having the new hovered node to the fram
e chain | 2708 // Insert the ancestors of the frame having the new hovered node to the fram
e chain |
| 2709 // The frame chain doesn't include the main frame to avoid the redundant wor
k that cleans the hover state. | 2709 // The frame chain doesn't include the main frame to avoid the redundant wor
k that cleans the hover state. |
| 2710 // Because the hover state for the main frame is updated by calling Document
::updateHoverActiveState | 2710 // Because the hover state for the main frame is updated by calling Document
::updateHoverActiveState |
| 2711 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) { | 2711 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) { |
| 2712 newHoverFrameChain.append(newHoverFrameInDocument); | 2712 newHoverFrameChain.append(newHoverFrameInDocument); |
| 2713 Frame* parentFrame = newHoverFrameInDocument->tree().parent(); | 2713 Frame* parentFrame = newHoverFrameInDocument->tree().parent(); |
| 2714 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? t
oLocalFrame(parentFrame) : nullptr; | 2714 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? t
oLocalFrame(parentFrame) : nullptr; |
| 2715 } | 2715 } |
| 2716 | 2716 |
| 2717 RefPtrWillBeRawPtr<Node> oldHoverNodeInCurDoc = m_frame->document()->hoverNo
de(); | 2717 RawPtr<Node> oldHoverNodeInCurDoc = m_frame->document()->hoverNode(); |
| 2718 RefPtrWillBeRawPtr<Node> newInnermostHoverNode = innerElement; | 2718 RawPtr<Node> newInnermostHoverNode = innerElement; |
| 2719 | 2719 |
| 2720 if (newInnermostHoverNode != oldHoverNodeInCurDoc) { | 2720 if (newInnermostHoverNode != oldHoverNodeInCurDoc) { |
| 2721 size_t indexFrameChain = newHoverFrameChain.size(); | 2721 size_t indexFrameChain = newHoverFrameChain.size(); |
| 2722 | 2722 |
| 2723 // Clear the hover state on any frames which are no longer in the frame
chain of the hovered elemen | 2723 // Clear the hover state on any frames which are no longer in the frame
chain of the hovered elemen |
| 2724 while (oldHoverNodeInCurDoc && oldHoverNodeInCurDoc->isFrameOwnerElement
()) { | 2724 while (oldHoverNodeInCurDoc && oldHoverNodeInCurDoc->isFrameOwnerElement
()) { |
| 2725 LocalFrame* newHoverFrame = nullptr; | 2725 LocalFrame* newHoverFrame = nullptr; |
| 2726 // If we can't get the frame from the new hover frame chain, | 2726 // If we can't get the frame from the new hover frame chain, |
| 2727 // the newHoverFrame will be null and the old hover state will be cl
eared. | 2727 // the newHoverFrame will be null and the old hover state will be cl
eared. |
| 2728 if (indexFrameChain > 0) | 2728 if (indexFrameChain > 0) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2756 ASSERT(m_frame == m_frame->localFrameRoot()); | 2756 ASSERT(m_frame == m_frame->localFrameRoot()); |
| 2757 | 2757 |
| 2758 // Behaviour of this function is as follows: | 2758 // Behaviour of this function is as follows: |
| 2759 // - Create the chain of all entered frames. | 2759 // - Create the chain of all entered frames. |
| 2760 // - Compare the last frame chain under the gesture to newly entered frame c
hain from the main frame one by one. | 2760 // - Compare the last frame chain under the gesture to newly entered frame c
hain from the main frame one by one. |
| 2761 // - If the last frame doesn't match with the entered frame, then create the
chain of exited frames from the last frame chain. | 2761 // - If the last frame doesn't match with the entered frame, then create the
chain of exited frames from the last frame chain. |
| 2762 // - Dispatch mouseout/mouseleave events of the exited frames from the insid
e out. | 2762 // - Dispatch mouseout/mouseleave events of the exited frames from the insid
e out. |
| 2763 // - Dispatch mouseover/mouseenter events of the entered frames into the ins
ide. | 2763 // - Dispatch mouseover/mouseenter events of the entered frames into the ins
ide. |
| 2764 | 2764 |
| 2765 // Insert the ancestors of the frame having the new target node to the enter
ed frame chain | 2765 // Insert the ancestors of the frame having the new target node to the enter
ed frame chain |
| 2766 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> enteredFrameChain; | 2766 HeapVector<Member<LocalFrame>> enteredFrameChain; |
| 2767 LocalFrame* enteredFrameInDocument = targetedEvent.hitTestResult().innerNode
Frame(); | 2767 LocalFrame* enteredFrameInDocument = targetedEvent.hitTestResult().innerNode
Frame(); |
| 2768 while (enteredFrameInDocument) { | 2768 while (enteredFrameInDocument) { |
| 2769 enteredFrameChain.append(enteredFrameInDocument); | 2769 enteredFrameChain.append(enteredFrameInDocument); |
| 2770 Frame* parentFrame = enteredFrameInDocument->tree().parent(); | 2770 Frame* parentFrame = enteredFrameInDocument->tree().parent(); |
| 2771 enteredFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? to
LocalFrame(parentFrame) : nullptr; | 2771 enteredFrameInDocument = parentFrame && parentFrame->isLocalFrame() ? to
LocalFrame(parentFrame) : nullptr; |
| 2772 } | 2772 } |
| 2773 | 2773 |
| 2774 size_t indexEnteredFrameChain = enteredFrameChain.size(); | 2774 size_t indexEnteredFrameChain = enteredFrameChain.size(); |
| 2775 LocalFrame* exitedFrameInDocument = m_frame; | 2775 LocalFrame* exitedFrameInDocument = m_frame; |
| 2776 WillBeHeapVector<RawPtrWillBeMember<LocalFrame>> exitedFrameChain; | 2776 HeapVector<Member<LocalFrame>> exitedFrameChain; |
| 2777 // Insert the frame from the disagreement between last frames and entered fr
ames | 2777 // Insert the frame from the disagreement between last frames and entered fr
ames |
| 2778 while (exitedFrameInDocument) { | 2778 while (exitedFrameInDocument) { |
| 2779 Node* lastNodeUnderTap = exitedFrameInDocument->eventHandler().m_nodeUnd
erMouse.get(); | 2779 Node* lastNodeUnderTap = exitedFrameInDocument->eventHandler().m_nodeUnd
erMouse.get(); |
| 2780 if (!lastNodeUnderTap) | 2780 if (!lastNodeUnderTap) |
| 2781 break; | 2781 break; |
| 2782 | 2782 |
| 2783 LocalFrame* nextExitedFrameInDocument = nullptr; | 2783 LocalFrame* nextExitedFrameInDocument = nullptr; |
| 2784 if (lastNodeUnderTap->isFrameOwnerElement()) { | 2784 if (lastNodeUnderTap->isFrameOwnerElement()) { |
| 2785 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(lastNodeUnder
Tap); | 2785 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(lastNodeUnder
Tap); |
| 2786 if (owner->contentFrame() && owner->contentFrame()->isLocalFrame()) | 2786 if (owner->contentFrame() && owner->contentFrame()->isLocalFrame()) |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3228 String key = evt.unmodifiedText(); | 3228 String key = evt.unmodifiedText(); |
| 3229 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); | 3229 Element* elem = m_frame->document()->getElementByAccessKey(key.lower()); |
| 3230 if (!elem) | 3230 if (!elem) |
| 3231 return false; | 3231 return false; |
| 3232 elem->accessKeyAction(false); | 3232 elem->accessKeyAction(false); |
| 3233 return true; | 3233 return true; |
| 3234 } | 3234 } |
| 3235 | 3235 |
| 3236 WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK
eyEvent) | 3236 WebInputEventResult EventHandler::keyEvent(const PlatformKeyboardEvent& initialK
eyEvent) |
| 3237 { | 3237 { |
| 3238 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 3238 RawPtr<FrameView> protector(m_frame->view()); |
| 3239 m_frame->chromeClient().clearToolTip(); | 3239 m_frame->chromeClient().clearToolTip(); |
| 3240 | 3240 |
| 3241 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) | 3241 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) |
| 3242 capsLockStateMayHaveChanged(); | 3242 capsLockStateMayHaveChanged(); |
| 3243 | 3243 |
| 3244 #if OS(WIN) | 3244 #if OS(WIN) |
| 3245 if (panScrollInProgress()) { | 3245 if (panScrollInProgress()) { |
| 3246 // If a key is pressed while the panScroll is in progress then we want t
o stop | 3246 // If a key is pressed while the panScroll is in progress then we want t
o stop |
| 3247 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.
type() == PlatformEvent::RawKeyDown) | 3247 if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.
type() == PlatformEvent::RawKeyDown) |
| 3248 stopAutoscroll(); | 3248 stopAutoscroll(); |
| 3249 | 3249 |
| 3250 // If we were in panscroll mode, we swallow the key event | 3250 // If we were in panscroll mode, we swallow the key event |
| 3251 return WebInputEventResult::HandledSuppressed; | 3251 return WebInputEventResult::HandledSuppressed; |
| 3252 } | 3252 } |
| 3253 #endif | 3253 #endif |
| 3254 | 3254 |
| 3255 // Check for cases where we are too early for events -- possible unmatched k
ey up | 3255 // Check for cases where we are too early for events -- possible unmatched k
ey up |
| 3256 // from pressing return in the location bar. | 3256 // from pressing return in the location bar. |
| 3257 RefPtrWillBeRawPtr<Node> node = eventTargetNodeForDocument(m_frame->document
()); | 3257 RawPtr<Node> node = eventTargetNodeForDocument(m_frame->document()); |
| 3258 if (!node) | 3258 if (!node) |
| 3259 return WebInputEventResult::NotHandled; | 3259 return WebInputEventResult::NotHandled; |
| 3260 | 3260 |
| 3261 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 3261 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 3262 | 3262 |
| 3263 // In IE, access keys are special, they are handled after default keydown pr
ocessing, but cannot be canceled - this is hard to match. | 3263 // In IE, access keys are special, they are handled after default keydown pr
ocessing, but cannot be canceled - this is hard to match. |
| 3264 // On Mac OS X, we process them before dispatching keydown, as the default k
eydown handler implements Emacs key bindings, which may conflict | 3264 // On Mac OS X, we process them before dispatching keydown, as the default k
eydown handler implements Emacs key bindings, which may conflict |
| 3265 // with access keys. Then we dispatch keydown, but suppress its default hand
ling. | 3265 // with access keys. Then we dispatch keydown, but suppress its default hand
ling. |
| 3266 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch
ing a keypress event for WM_SYSCHAR messages. | 3266 // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatch
ing a keypress event for WM_SYSCHAR messages. |
| 3267 // Other platforms currently match either Mac or Windows behavior, depending
on whether they send combined KeyDown events. | 3267 // Other platforms currently match either Mac or Windows behavior, depending
on whether they send combined KeyDown events. |
| 3268 bool matchedAnAccessKey = false; | 3268 bool matchedAnAccessKey = false; |
| 3269 if (initialKeyEvent.type() == PlatformEvent::KeyDown) | 3269 if (initialKeyEvent.type() == PlatformEvent::KeyDown) |
| 3270 matchedAnAccessKey = handleAccessKey(initialKeyEvent); | 3270 matchedAnAccessKey = handleAccessKey(initialKeyEvent); |
| 3271 | 3271 |
| 3272 // FIXME: it would be fair to let an input method handle KeyUp events before
DOM dispatch. | 3272 // FIXME: it would be fair to let an input method handle KeyUp events before
DOM dispatch. |
| 3273 if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type()
== PlatformEvent::Char) { | 3273 if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type()
== PlatformEvent::Char) { |
| 3274 RefPtrWillBeRawPtr<KeyboardEvent> domEvent = KeyboardEvent::create(initi
alKeyEvent, m_frame->document()->domWindow()); | 3274 RawPtr<KeyboardEvent> domEvent = KeyboardEvent::create(initialKeyEvent,
m_frame->document()->domWindow()); |
| 3275 | 3275 |
| 3276 bool dispatchResult = node->dispatchEvent(domEvent); | 3276 bool dispatchResult = node->dispatchEvent(domEvent); |
| 3277 return eventToEventResult(domEvent, dispatchResult); | 3277 return eventToEventResult(domEvent, dispatchResult); |
| 3278 } | 3278 } |
| 3279 | 3279 |
| 3280 PlatformKeyboardEvent keyDownEvent = initialKeyEvent; | 3280 PlatformKeyboardEvent keyDownEvent = initialKeyEvent; |
| 3281 if (keyDownEvent.type() != PlatformEvent::RawKeyDown) | 3281 if (keyDownEvent.type() != PlatformEvent::RawKeyDown) |
| 3282 keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); | 3282 keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); |
| 3283 RefPtrWillBeRawPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEve
nt, m_frame->document()->domWindow()); | 3283 RawPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEvent, m_frame-
>document()->domWindow()); |
| 3284 if (matchedAnAccessKey) | 3284 if (matchedAnAccessKey) |
| 3285 keydown->setDefaultPrevented(true); | 3285 keydown->setDefaultPrevented(true); |
| 3286 keydown->setTarget(node); | 3286 keydown->setTarget(node); |
| 3287 | 3287 |
| 3288 if (initialKeyEvent.type() == PlatformEvent::RawKeyDown) { | 3288 if (initialKeyEvent.type() == PlatformEvent::RawKeyDown) { |
| 3289 if (!node->dispatchEvent(keydown)) | 3289 if (!node->dispatchEvent(keydown)) |
| 3290 return eventToEventResult(keydown, false); | 3290 return eventToEventResult(keydown, false); |
| 3291 // If frame changed as a result of keydown dispatch, then return true to
avoid sending a subsequent keypress message to the new frame. | 3291 // If frame changed as a result of keydown dispatch, then return true to
avoid sending a subsequent keypress message to the new frame. |
| 3292 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()
->focusController().focusedOrMainFrame(); | 3292 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()
->focusController().focusedOrMainFrame(); |
| 3293 if (changedFocusedFrame) | 3293 if (changedFocusedFrame) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3305 // Focus may have changed during keydown handling, so refetch node. | 3305 // Focus may have changed during keydown handling, so refetch node. |
| 3306 // But if we are dispatching a fake backward compatibility keypress, then we
pretend that the keypress happened on the original node. | 3306 // But if we are dispatching a fake backward compatibility keypress, then we
pretend that the keypress happened on the original node. |
| 3307 node = eventTargetNodeForDocument(m_frame->document()); | 3307 node = eventTargetNodeForDocument(m_frame->document()); |
| 3308 if (!node) | 3308 if (!node) |
| 3309 return WebInputEventResult::NotHandled; | 3309 return WebInputEventResult::NotHandled; |
| 3310 | 3310 |
| 3311 PlatformKeyboardEvent keyPressEvent = initialKeyEvent; | 3311 PlatformKeyboardEvent keyPressEvent = initialKeyEvent; |
| 3312 keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char); | 3312 keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char); |
| 3313 if (keyPressEvent.text().isEmpty()) | 3313 if (keyPressEvent.text().isEmpty()) |
| 3314 return WebInputEventResult::NotHandled; | 3314 return WebInputEventResult::NotHandled; |
| 3315 RefPtrWillBeRawPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressE
vent, m_frame->document()->domWindow()); | 3315 RawPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressEvent, m_fram
e->document()->domWindow()); |
| 3316 keypress->setTarget(node); | 3316 keypress->setTarget(node); |
| 3317 bool dispatchResult = node->dispatchEvent(keypress); | 3317 bool dispatchResult = node->dispatchEvent(keypress); |
| 3318 return eventToEventResult(keypress, dispatchResult); | 3318 return eventToEventResult(keypress, dispatchResult); |
| 3319 } | 3319 } |
| 3320 | 3320 |
| 3321 static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier) | 3321 static WebFocusType focusDirectionForKey(const AtomicString& keyIdentifier) |
| 3322 { | 3322 { |
| 3323 DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down", AtomicString::ConstructFrom
Literal)); | 3323 DEFINE_STATIC_LOCAL(AtomicString, Down, ("Down", AtomicString::ConstructFrom
Literal)); |
| 3324 DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up", AtomicString::ConstructFromLite
ral)); | 3324 DEFINE_STATIC_LOCAL(AtomicString, Up, ("Up", AtomicString::ConstructFromLite
ral)); |
| 3325 DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left", AtomicString::ConstructFrom
Literal)); | 3325 DEFINE_STATIC_LOCAL(AtomicString, Left, ("Left", AtomicString::ConstructFrom
Literal)); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3550 return false; | 3550 return false; |
| 3551 | 3551 |
| 3552 EventTarget* target; | 3552 EventTarget* target; |
| 3553 if (underlyingEvent) | 3553 if (underlyingEvent) |
| 3554 target = underlyingEvent->target(); | 3554 target = underlyingEvent->target(); |
| 3555 else | 3555 else |
| 3556 target = eventTargetNodeForDocument(m_frame->document()); | 3556 target = eventTargetNodeForDocument(m_frame->document()); |
| 3557 if (!target) | 3557 if (!target) |
| 3558 return false; | 3558 return false; |
| 3559 | 3559 |
| 3560 RefPtrWillBeRawPtr<TextEvent> event = TextEvent::create(m_frame->domWindow()
, text, inputType); | 3560 RawPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inpu
tType); |
| 3561 event->setUnderlyingEvent(underlyingEvent); | 3561 event->setUnderlyingEvent(underlyingEvent); |
| 3562 | 3562 |
| 3563 target->dispatchEvent(event); | 3563 target->dispatchEvent(event); |
| 3564 return event->defaultHandled(); | 3564 return event->defaultHandled(); |
| 3565 } | 3565 } |
| 3566 | 3566 |
| 3567 void EventHandler::defaultTextInputEventHandler(TextEvent* event) | 3567 void EventHandler::defaultTextInputEventHandler(TextEvent* event) |
| 3568 { | 3568 { |
| 3569 if (m_frame->editor().handleTextEvent(event)) | 3569 if (m_frame->editor().handleTextEvent(event)) |
| 3570 event->setDefaultHandled(); | 3570 event->setDefaultHandled(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3727 if (frame->view()) { | 3727 if (frame->view()) { |
| 3728 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); | 3728 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); |
| 3729 if (!rect.contains(roundedIntPoint(point))) | 3729 if (!rect.contains(roundedIntPoint(point))) |
| 3730 return result; | 3730 return result; |
| 3731 } | 3731 } |
| 3732 frame->contentLayoutObject()->hitTest(result); | 3732 frame->contentLayoutObject()->hitTest(result); |
| 3733 return result; | 3733 return result; |
| 3734 } | 3734 } |
| 3735 | 3735 |
| 3736 void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, | 3736 void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, |
| 3737 WillBeHeapVector<TouchInfo>& touchInfos) | 3737 HeapVector<TouchInfo>& touchInfos) |
| 3738 { | 3738 { |
| 3739 if (!RuntimeEnabledFeatures::pointerEventEnabled()) | 3739 if (!RuntimeEnabledFeatures::pointerEventEnabled()) |
| 3740 return; | 3740 return; |
| 3741 | 3741 |
| 3742 // Iterate through the touch points, sending PointerEvents to the targets as
required. | 3742 // Iterate through the touch points, sending PointerEvents to the targets as
required. |
| 3743 for (unsigned i = 0; i < touchInfos.size(); ++i) { | 3743 for (unsigned i = 0; i < touchInfos.size(); ++i) { |
| 3744 TouchInfo& touchInfo = touchInfos[i]; | 3744 TouchInfo& touchInfo = touchInfos[i]; |
| 3745 const PlatformTouchPoint& touchPoint = touchInfo.point; | 3745 const PlatformTouchPoint& touchPoint = touchInfo.point; |
| 3746 const PlatformTouchPoint::State pointState = touchPoint.state(); | 3746 const PlatformTouchPoint::State pointState = touchPoint.state(); |
| 3747 | 3747 |
| 3748 | 3748 |
| 3749 if (pointState == PlatformTouchPoint::TouchStationary || !touchInfo.know
nTarget) | 3749 if (pointState == PlatformTouchPoint::TouchStationary || !touchInfo.know
nTarget) |
| 3750 continue; | 3750 continue; |
| 3751 | 3751 |
| 3752 bool pointerReleasedOrCancelled = pointState == PlatformTouchPoint::Touc
hReleased | 3752 bool pointerReleasedOrCancelled = pointState == PlatformTouchPoint::Touc
hReleased |
| 3753 || pointState == PlatformTouchPoint::TouchCancelled; | 3753 || pointState == PlatformTouchPoint::TouchCancelled; |
| 3754 | 3754 |
| 3755 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventManager.cr
eate( | 3755 RawPtr<PointerEvent> pointerEvent = m_pointerEventManager.create( |
| 3756 pointerEventNameForTouchPointState(pointState), | 3756 pointerEventNameForTouchPointState(pointState), |
| 3757 touchPoint, event.modifiers(), | 3757 touchPoint, event.modifiers(), |
| 3758 touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(), | 3758 touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(), |
| 3759 touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y()); | 3759 touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y()); |
| 3760 | 3760 |
| 3761 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturi
ng vs pointer event capturing | 3761 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturi
ng vs pointer event capturing |
| 3762 touchInfo.touchTarget->dispatchEvent(pointerEvent.get()); | 3762 touchInfo.touchTarget->dispatchEvent(pointerEvent.get()); |
| 3763 | 3763 |
| 3764 touchInfo.consumed = pointerEvent->defaultPrevented() || pointerEvent->d
efaultHandled(); | 3764 touchInfo.consumed = pointerEvent->defaultPrevented() || pointerEvent->d
efaultHandled(); |
| 3765 | 3765 |
| 3766 // Remove the released/cancelled id at the end to correctly determine pr
imary id above. | 3766 // Remove the released/cancelled id at the end to correctly determine pr
imary id above. |
| 3767 if (pointerReleasedOrCancelled) | 3767 if (pointerReleasedOrCancelled) |
| 3768 m_pointerEventManager.remove(pointerEvent); | 3768 m_pointerEventManager.remove(pointerEvent); |
| 3769 } | 3769 } |
| 3770 } | 3770 } |
| 3771 | 3771 |
| 3772 void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos) | 3772 void EventHandler::sendPointerCancels(HeapVector<TouchInfo>& touchInfos) |
| 3773 { | 3773 { |
| 3774 if (!RuntimeEnabledFeatures::pointerEventEnabled()) | 3774 if (!RuntimeEnabledFeatures::pointerEventEnabled()) |
| 3775 return; | 3775 return; |
| 3776 | 3776 |
| 3777 for (unsigned i = 0; i < touchInfos.size(); ++i) { | 3777 for (unsigned i = 0; i < touchInfos.size(); ++i) { |
| 3778 TouchInfo& touchInfo = touchInfos[i]; | 3778 TouchInfo& touchInfo = touchInfos[i]; |
| 3779 const PlatformTouchPoint& point = touchInfo.point; | 3779 const PlatformTouchPoint& point = touchInfo.point; |
| 3780 const PlatformTouchPoint::State pointState = point.state(); | 3780 const PlatformTouchPoint::State pointState = point.state(); |
| 3781 | 3781 |
| 3782 if (pointState == PlatformTouchPoint::TouchReleased | 3782 if (pointState == PlatformTouchPoint::TouchReleased |
| 3783 || pointState == PlatformTouchPoint::TouchCancelled) | 3783 || pointState == PlatformTouchPoint::TouchCancelled) |
| 3784 continue; | 3784 continue; |
| 3785 | 3785 |
| 3786 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventManager.cr
eatePointerCancel(point); | 3786 RawPtr<PointerEvent> pointerEvent = m_pointerEventManager.createPointerC
ancel(point); |
| 3787 | 3787 |
| 3788 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturi
ng vs pointer event capturing | 3788 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturi
ng vs pointer event capturing |
| 3789 touchInfo.touchTarget->dispatchEvent(pointerEvent.get()); | 3789 touchInfo.touchTarget->dispatchEvent(pointerEvent.get()); |
| 3790 | 3790 |
| 3791 m_pointerEventManager.remove(pointerEvent); | 3791 m_pointerEventManager.remove(pointerEvent); |
| 3792 } | 3792 } |
| 3793 } | 3793 } |
| 3794 | 3794 |
| 3795 namespace { | 3795 namespace { |
| 3796 | 3796 |
| 3797 // Defining this class type local to dispatchTouchEvents() and annotating | 3797 // Defining this class type local to dispatchTouchEvents() and annotating |
| 3798 // it with STACK_ALLOCATED(), runs into MSVC(VS 2013)'s C4822 warning | 3798 // it with STACK_ALLOCATED(), runs into MSVC(VS 2013)'s C4822 warning |
| 3799 // that the local class doesn't provide a local definition for 'operator new'. | 3799 // that the local class doesn't provide a local definition for 'operator new'. |
| 3800 // Which it intentionally doesn't and shouldn't. | 3800 // Which it intentionally doesn't and shouldn't. |
| 3801 // | 3801 // |
| 3802 // Work around such toolchain bugginess by lifting out the type, thereby | 3802 // Work around such toolchain bugginess by lifting out the type, thereby |
| 3803 // taking it out of C4822's reach. | 3803 // taking it out of C4822's reach. |
| 3804 class ChangedTouches final { | 3804 class ChangedTouches final { |
| 3805 STACK_ALLOCATED(); | 3805 STACK_ALLOCATED(); |
| 3806 public: | 3806 public: |
| 3807 // The touches corresponding to the particular change state this struct | 3807 // The touches corresponding to the particular change state this struct |
| 3808 // instance represents. | 3808 // instance represents. |
| 3809 RefPtrWillBeMember<TouchList> m_touches; | 3809 Member<TouchList> m_touches; |
| 3810 | 3810 |
| 3811 using EventTargetSet = WillBeHeapHashSet<RefPtrWillBeMember<EventTarget>>; | 3811 using EventTargetSet = HeapHashSet<Member<EventTarget>>; |
| 3812 // Set of targets involved in m_touches. | 3812 // Set of targets involved in m_touches. |
| 3813 EventTargetSet m_targets; | 3813 EventTargetSet m_targets; |
| 3814 }; | 3814 }; |
| 3815 | 3815 |
| 3816 } // namespace | 3816 } // namespace |
| 3817 | 3817 |
| 3818 WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent&
event, | 3818 WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent&
event, |
| 3819 WillBeHeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouc
hReleased) | 3819 HeapVector<TouchInfo>& touchInfos, bool freshTouchEvents, bool allTouchRelea
sed) |
| 3820 { | 3820 { |
| 3821 // Build up the lists to use for the 'touches', 'targetTouches' and | 3821 // Build up the lists to use for the 'touches', 'targetTouches' and |
| 3822 // 'changedTouches' attributes in the JS event. See | 3822 // 'changedTouches' attributes in the JS event. See |
| 3823 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these | 3823 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these |
| 3824 // lists fit together. | 3824 // lists fit together. |
| 3825 | 3825 |
| 3826 // Holds the complete set of touches on the screen. | 3826 // Holds the complete set of touches on the screen. |
| 3827 RefPtrWillBeRawPtr<TouchList> touches = TouchList::create(); | 3827 RawPtr<TouchList> touches = TouchList::create(); |
| 3828 | 3828 |
| 3829 // A different view on the 'touches' list above, filtered and grouped by | 3829 // A different view on the 'touches' list above, filtered and grouped by |
| 3830 // event target. Used for the 'targetTouches' list in the JS event. | 3830 // event target. Used for the 'targetTouches' list in the JS event. |
| 3831 using TargetTouchesHeapMap = WillBeHeapHashMap<EventTarget*, RefPtrWillBeMem
ber<TouchList>>; | 3831 using TargetTouchesHeapMap = HeapHashMap<EventTarget*, Member<TouchList>>; |
| 3832 TargetTouchesHeapMap touchesByTarget; | 3832 TargetTouchesHeapMap touchesByTarget; |
| 3833 | 3833 |
| 3834 // Array of touches per state, used to assemble the 'changedTouches' list. | 3834 // Array of touches per state, used to assemble the 'changedTouches' list. |
| 3835 ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd]; | 3835 ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd]; |
| 3836 | 3836 |
| 3837 for (unsigned i = 0; i < touchInfos.size(); ++i) { | 3837 for (unsigned i = 0; i < touchInfos.size(); ++i) { |
| 3838 const TouchInfo& touchInfo = touchInfos[i]; | 3838 const TouchInfo& touchInfo = touchInfos[i]; |
| 3839 const PlatformTouchPoint& point = touchInfo.point; | 3839 const PlatformTouchPoint& point = touchInfo.point; |
| 3840 PlatformTouchPoint::State pointState = point.state(); | 3840 PlatformTouchPoint::State pointState = point.state(); |
| 3841 | 3841 |
| 3842 if (touchInfo.consumed) | 3842 if (touchInfo.consumed) |
| 3843 continue; | 3843 continue; |
| 3844 | 3844 |
| 3845 RefPtrWillBeRawPtr<Touch> touch = Touch::create( | 3845 RawPtr<Touch> touch = Touch::create( |
| 3846 touchInfo.targetFrame.get(), | 3846 touchInfo.targetFrame.get(), |
| 3847 touchInfo.touchTarget.get(), | 3847 touchInfo.touchTarget.get(), |
| 3848 point.id(), | 3848 point.id(), |
| 3849 point.screenPos(), | 3849 point.screenPos(), |
| 3850 touchInfo.adjustedPagePoint, | 3850 touchInfo.adjustedPagePoint, |
| 3851 touchInfo.adjustedRadius, | 3851 touchInfo.adjustedRadius, |
| 3852 point.rotationAngle(), | 3852 point.rotationAngle(), |
| 3853 point.force()); | 3853 point.force()); |
| 3854 | 3854 |
| 3855 // Ensure this target's touch list exists, even if it ends up empty, so | 3855 // Ensure this target's touch list exists, even if it ends up empty, so |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3891 | 3891 |
| 3892 // Now iterate through the changedTouches list and m_targets within it, send
ing | 3892 // Now iterate through the changedTouches list and m_targets within it, send
ing |
| 3893 // TouchEvents to the targets as required. | 3893 // TouchEvents to the targets as required. |
| 3894 for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state
) { | 3894 for (unsigned state = 0; state != PlatformTouchPoint::TouchStateEnd; ++state
) { |
| 3895 if (!changedTouches[state].m_touches) | 3895 if (!changedTouches[state].m_touches) |
| 3896 continue; | 3896 continue; |
| 3897 | 3897 |
| 3898 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca
st<PlatformTouchPoint::State>(state))); | 3898 const AtomicString& eventName(touchEventNameForTouchPointState(static_ca
st<PlatformTouchPoint::State>(state))); |
| 3899 for (const auto& eventTarget : changedTouches[state].m_targets) { | 3899 for (const auto& eventTarget : changedTouches[state].m_targets) { |
| 3900 EventTarget* touchEventTarget = eventTarget.get(); | 3900 EventTarget* touchEventTarget = eventTarget.get(); |
| 3901 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create( | 3901 RawPtr<TouchEvent> touchEvent = TouchEvent::create( |
| 3902 touches.get(), touchesByTarget.get(touchEventTarget), changedTou
ches[state].m_touches.get(), | 3902 touches.get(), touchesByTarget.get(touchEventTarget), changedTou
ches[state].m_touches.get(), |
| 3903 eventName, touchEventTarget->toNode()->document().domWindow(), | 3903 eventName, touchEventTarget->toNode()->document().domWindow(), |
| 3904 event.modifiers(), event.cancelable(), event.causesScrollingIfUn
canceled(), event.timestamp()); | 3904 event.modifiers(), event.cancelable(), event.causesScrollingIfUn
canceled(), event.timestamp()); |
| 3905 | 3905 |
| 3906 bool dispatchResult = touchEventTarget->dispatchEvent(touchEvent.get
()); | 3906 bool dispatchResult = touchEventTarget->dispatchEvent(touchEvent.get
()); |
| 3907 eventResult = mergeEventResult(eventResult, eventToEventResult(touch
Event, dispatchResult)); | 3907 eventResult = mergeEventResult(eventResult, eventToEventResult(touch
Event, dispatchResult)); |
| 3908 } | 3908 } |
| 3909 } | 3909 } |
| 3910 | 3910 |
| 3911 return eventResult; | 3911 return eventResult; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4010 // this work. | 4010 // this work. |
| 4011 if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !ha
sTouchHandlers(m_touchSequenceDocument->frameHost()->eventHandlerRegistry()) ||
!m_touchSequenceDocument->frame()) { | 4011 if (!m_touchSequenceDocument || !m_touchSequenceDocument->frameHost() || !ha
sTouchHandlers(m_touchSequenceDocument->frameHost()->eventHandlerRegistry()) ||
!m_touchSequenceDocument->frame()) { |
| 4012 if (allTouchReleased) { | 4012 if (allTouchReleased) { |
| 4013 m_touchSequenceDocument.clear(); | 4013 m_touchSequenceDocument.clear(); |
| 4014 m_touchSequenceUserGestureToken.clear(); | 4014 m_touchSequenceUserGestureToken.clear(); |
| 4015 } | 4015 } |
| 4016 return WebInputEventResult::NotHandled; | 4016 return WebInputEventResult::NotHandled; |
| 4017 } | 4017 } |
| 4018 | 4018 |
| 4019 // Compute and store the common info used by both PointerEvent and TouchEven
t. | 4019 // Compute and store the common info used by both PointerEvent and TouchEven
t. |
| 4020 WillBeHeapVector<TouchInfo> touchInfos(points.size()); | 4020 HeapVector<TouchInfo> touchInfos(points.size()); |
| 4021 | 4021 |
| 4022 for (unsigned i = 0; i < points.size(); ++i) { | 4022 for (unsigned i = 0; i < points.size(); ++i) { |
| 4023 const PlatformTouchPoint& point = points[i]; | 4023 const PlatformTouchPoint& point = points[i]; |
| 4024 PlatformTouchPoint::State pointState = point.state(); | 4024 PlatformTouchPoint::State pointState = point.state(); |
| 4025 RefPtrWillBeRawPtr<EventTarget> touchTarget = nullptr; | 4025 RawPtr<EventTarget> touchTarget = nullptr; |
| 4026 | 4026 |
| 4027 if (pointState == PlatformTouchPoint::TouchReleased || pointState == Pla
tformTouchPoint::TouchCancelled) { | 4027 if (pointState == PlatformTouchPoint::TouchReleased || pointState == Pla
tformTouchPoint::TouchCancelled) { |
| 4028 // The target should be the original target for this touch, so get | 4028 // The target should be the original target for this touch, so get |
| 4029 // it from the hashmap. As it's a release or cancel we also remove | 4029 // it from the hashmap. As it's a release or cancel we also remove |
| 4030 // it from the map. | 4030 // it from the map. |
| 4031 touchTarget = m_targetForTouchID.take(point.id()); | 4031 touchTarget = m_targetForTouchID.take(point.id()); |
| 4032 } else { | 4032 } else { |
| 4033 // No hittest is performed on move or stationary, since the target | 4033 // No hittest is performed on move or stationary, since the target |
| 4034 // is not allowed to change anyway. | 4034 // is not allowed to change anyway. |
| 4035 touchTarget = m_targetForTouchID.get(point.id()); | 4035 touchTarget = m_targetForTouchID.get(point.id()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4175 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4175 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
| 4176 { | 4176 { |
| 4177 #if OS(MACOSX) | 4177 #if OS(MACOSX) |
| 4178 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); | 4178 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); |
| 4179 #else | 4179 #else |
| 4180 return PlatformEvent::AltKey; | 4180 return PlatformEvent::AltKey; |
| 4181 #endif | 4181 #endif |
| 4182 } | 4182 } |
| 4183 | 4183 |
| 4184 } // namespace blink | 4184 } // namespace blink |
| OLD | NEW |