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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 m_capturingMouseEventsNode = nullptr; | 308 m_capturingMouseEventsNode = nullptr; |
309 m_previousWheelScrolledNode = nullptr; | 309 m_previousWheelScrolledNode = nullptr; |
310 m_targetForTouchID.clear(); | 310 m_targetForTouchID.clear(); |
311 m_touchSequenceDocument.clear(); | 311 m_touchSequenceDocument.clear(); |
312 m_touchSequenceUserGestureToken.clear(); | 312 m_touchSequenceUserGestureToken.clear(); |
313 clearGestureScrollState(); | 313 clearGestureScrollState(); |
314 m_lastGestureScrollOverWidget = false; | 314 m_lastGestureScrollOverWidget = false; |
315 m_scrollbarHandlingScrollGesture = nullptr; | 315 m_scrollbarHandlingScrollGesture = nullptr; |
316 m_touchPressed = false; | 316 m_touchPressed = false; |
317 m_pointerIdManager.clear(); | 317 m_pointerIdManager.clear(); |
318 m_preventMouseEventForPointerTypeMouse = false; | |
318 m_inPointerCanceledState = false; | 319 m_inPointerCanceledState = false; |
319 m_mouseDownMayStartDrag = false; | 320 m_mouseDownMayStartDrag = false; |
320 m_lastShowPressTimestamp = 0; | 321 m_lastShowPressTimestamp = 0; |
321 m_lastDeferredTapElement = nullptr; | 322 m_lastDeferredTapElement = nullptr; |
322 m_eventHandlerWillResetCapturingMouseEventsNode = false; | 323 m_eventHandlerWillResetCapturingMouseEventsNode = false; |
323 m_mouseDownMayStartAutoscroll = false; | 324 m_mouseDownMayStartAutoscroll = false; |
324 m_svgPan = false; | 325 m_svgPan = false; |
325 m_mouseDownPos = IntPoint(); | 326 m_mouseDownPos = IntPoint(); |
326 m_mouseDownTimestamp = 0; | 327 m_mouseDownTimestamp = 0; |
327 m_longTapShouldInvokeContextMenu = false; | 328 m_longTapShouldInvokeContextMenu = false; |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
962 m_resizeScrollableArea = layer->scrollableArea(); | 963 m_resizeScrollableArea = layer->scrollableArea(); |
963 m_resizeScrollableArea->setInResizeMode(true); | 964 m_resizeScrollableArea->setInResizeMode(true); |
964 m_offsetFromResizeCorner = LayoutSize(m_resizeScrollableArea->offset FromResizeCorner(p)); | 965 m_offsetFromResizeCorner = LayoutSize(m_resizeScrollableArea->offset FromResizeCorner(p)); |
965 invalidateClick(); | 966 invalidateClick(); |
966 return true; | 967 return true; |
967 } | 968 } |
968 } | 969 } |
969 | 970 |
970 m_frame->selection().setCaretBlinkingSuspended(true); | 971 m_frame->selection().setCaretBlinkingSuspended(true); |
971 | 972 |
972 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.inner Node(), m_clickCount, mouseEvent); | 973 bool swallowEvent = dispatchPointerEventForMouseEvent(mev.innerNode(), Event TypeNames::pointerdown, mouseEvent); |
974 if (swallowEvent) { | |
975 m_preventMouseEventForPointerTypeMouse = true; | |
976 } | |
977 if (!m_preventMouseEventForPointerTypeMouse) | |
978 swallowEvent = swallowEvent || !dispatchMouseEvent(EventTypeNames::mouse down, mev.innerNode(), m_clickCount, mouseEvent); | |
979 | |
973 // m_selectionInitiationState is initialized after dispatching mousedown | 980 // m_selectionInitiationState is initialized after dispatching mousedown |
974 // event in order not to keep the selection by DOM APIs Because we can't | 981 // event in order not to keep the selection by DOM APIs Because we can't |
975 // give the user the chance to handle the selection by user action like | 982 // give the user the chance to handle the selection by user action like |
976 // dragging if we keep the selection in case of mousedown. FireFox also has | 983 // dragging if we keep the selection in case of mousedown. FireFox also has |
977 // the same behavior and it's more compatible with other browsers. | 984 // the same behavior and it's more compatible with other browsers. |
978 selectionController().initializeSelectionState(); | 985 selectionController().initializeSelectionState(); |
979 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, documentPoint, H itTestRequest::ReadOnly); | 986 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, documentPoint, H itTestRequest::ReadOnly); |
980 InputDeviceCapabilities* sourceCapabilities = mouseEvent.syntheticEventType( ) == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEventsSo urceCapabilities() : | 987 InputDeviceCapabilities* sourceCapabilities = mouseEvent.syntheticEventType( ) == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEventsSo urceCapabilities() : |
981 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities(); | 988 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities(); |
982 swallowEvent = swallowEvent || handleMouseFocus(MouseEventWithHitTestResults (mouseEvent, hitTestResult), sourceCapabilities); | 989 swallowEvent = swallowEvent || handleMouseFocus(MouseEventWithHitTestResults (mouseEvent, hitTestResult), sourceCapabilities); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1246 | 1253 |
1247 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; | 1254 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Release; |
1248 HitTestRequest request(hitType); | 1255 HitTestRequest request(hitType); |
1249 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1256 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
1250 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1257 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
1251 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1258 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
1252 m_capturingMouseEventsNode = nullptr; | 1259 m_capturingMouseEventsNode = nullptr; |
1253 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) | 1260 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) |
1254 return true; | 1261 return true; |
1255 | 1262 |
1256 bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev. innerNode(), m_clickCount, mouseEvent); | 1263 bool swallowPointerUpEvent = dispatchPointerEventForMouseEvent(mev.innerNode (), EventTypeNames::pointerup, mouseEvent); |
1264 bool swallowMouseUpEvent = false; | |
Rick Byers
2015/10/20 19:09:50
I think there can be cases where blink doesn't dir
mustaq
2015/10/21 15:17:21
Yes, this is dependent on Lan's work. Filed crbug/
mustaq
2015/10/22 16:42:52
Here is a patch that resets the "prevent-ME" state
Rick Byers
2015/10/22 21:31:51
I played with edge a bit here. To match their beh
| |
1265 if (!m_preventMouseEventForPointerTypeMouse) | |
1266 swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.i nnerNode(), m_clickCount, mouseEvent); | |
1257 | 1267 |
1258 bool contextMenuEvent = mouseEvent.button() == RightButton; | 1268 bool contextMenuEvent = mouseEvent.button() == RightButton; |
1259 #if OS(MACOSX) | 1269 #if OS(MACOSX) |
1260 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. | 1270 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. |
1261 if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEv ent::CtrlKey) | 1271 if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEv ent::CtrlKey) |
1262 contextMenuEvent = true; | 1272 contextMenuEvent = true; |
1263 #endif | 1273 #endif |
1264 | 1274 |
1265 bool swallowClickEvent = false; | 1275 bool swallowClickEvent = false; |
1266 if (m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && mev.innerNode()->canParticipateInComposedTree() && m_clickNode->canParticipat eInComposedTree()) { | 1276 if (m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && mev.innerNode()->canParticipateInComposedTree() && m_clickNode->canParticipat eInComposedTree()) { |
1267 // Updates distribution because a 'mouseup' event listener can make the | 1277 // Updates distribution because a 'mouseup' event listener can make the |
1268 // tree dirty at dispatchMouseEvent() invocation above. | 1278 // tree dirty at dispatchMouseEvent() invocation above. |
1269 // Unless distribution is updated, commonAncestor would hit ASSERT. | 1279 // Unless distribution is updated, commonAncestor would hit ASSERT. |
1270 // Both m_clickNode and mev.innerNode() don't need to be updated | 1280 // Both m_clickNode and mev.innerNode() don't need to be updated |
1271 // because commonAncestor() will exit early if their documents are diffe rent. | 1281 // because commonAncestor() will exit early if their documents are diffe rent. |
1272 m_clickNode->updateDistribution(); | 1282 m_clickNode->updateDistribution(); |
1273 if (Node* clickTargetNode = mev.innerNode()->commonAncestor(*m_clickNode , parentForClickEvent)) | 1283 if (Node* clickTargetNode = mev.innerNode()->commonAncestor(*m_clickNode , parentForClickEvent)) |
1274 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click TargetNode, m_clickCount, mouseEvent); | 1284 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click TargetNode, m_clickCount, mouseEvent); |
1275 } | 1285 } |
1276 | 1286 |
1277 if (m_resizeScrollableArea) { | 1287 if (m_resizeScrollableArea) { |
1278 m_resizeScrollableArea->setInResizeMode(false); | 1288 m_resizeScrollableArea->setInResizeMode(false); |
1279 m_resizeScrollableArea = nullptr; | 1289 m_resizeScrollableArea = nullptr; |
1280 } | 1290 } |
1281 | 1291 |
1282 bool swallowMouseReleaseEvent = false; | 1292 bool swallowMouseReleaseEvent = false; |
1283 if (!swallowMouseUpEvent) | 1293 if (!swallowPointerUpEvent && !swallowMouseUpEvent) |
1284 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); | 1294 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); |
1285 | 1295 |
1286 invalidateClick(); | 1296 invalidateClick(); |
1287 | 1297 |
1288 return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; | 1298 m_preventMouseEventForPointerTypeMouse = false; |
1299 return swallowPointerUpEvent || swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; | |
1289 } | 1300 } |
1290 | 1301 |
1291 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa rget, const PlatformMouseEvent& event, DataTransfer* dataTransfer) | 1302 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa rget, const PlatformMouseEvent& event, DataTransfer* dataTransfer) |
1292 { | 1303 { |
1293 FrameView* view = m_frame->view(); | 1304 FrameView* view = m_frame->view(); |
1294 | 1305 |
1295 // FIXME: We might want to dispatch a dragleave even if the view is gone. | 1306 // FIXME: We might want to dispatch a dragleave even if the view is gone. |
1296 if (!view) | 1307 if (!view) |
1297 return false; | 1308 return false; |
1298 | 1309 |
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4000 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4011 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
4001 { | 4012 { |
4002 #if OS(MACOSX) | 4013 #if OS(MACOSX) |
4003 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); | 4014 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); |
4004 #else | 4015 #else |
4005 return PlatformEvent::AltKey; | 4016 return PlatformEvent::AltKey; |
4006 #endif | 4017 #endif |
4007 } | 4018 } |
4008 | 4019 |
4009 } // namespace blink | 4020 } // namespace blink |
OLD | NEW |