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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 m_mouseDownMayStartSelect = false; | 1219 m_mouseDownMayStartSelect = false; |
1220 m_mouseDownMayStartAutoscroll = false; | 1220 m_mouseDownMayStartAutoscroll = false; |
1221 if (FrameView* view = m_frame->view()) | 1221 if (FrameView* view = m_frame->view()) |
1222 m_mouseDownPos = view->windowToContents(mouseEvent.position()); | 1222 m_mouseDownPos = view->windowToContents(mouseEvent.position()); |
1223 else { | 1223 else { |
1224 invalidateClick(); | 1224 invalidateClick(); |
1225 return false; | 1225 return false; |
1226 } | 1226 } |
1227 m_mouseDownWasInSubframe = false; | 1227 m_mouseDownWasInSubframe = false; |
1228 | 1228 |
1229 // Mouse events simulated from touch should not hit-test again. | |
1230 ASSERT(!mouseEvent.fromTouch()); | |
1231 | |
1232 HitTestRequest request(HitTestRequest::Active); | 1229 HitTestRequest request(HitTestRequest::Active); |
1233 // Save the document point we generate in case the window coordinate is inva
lidated by what happens | 1230 // Save the document point we generate in case the window coordinate is inva
lidated by what happens |
1234 // when we dispatch the event. | 1231 // when we dispatch the event. |
1235 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.
position()); | 1232 LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.
position()); |
1236 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re
quest, documentPoint, mouseEvent); | 1233 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(re
quest, documentPoint, mouseEvent); |
1237 | 1234 |
1238 if (!mev.targetNode()) { | 1235 if (!mev.targetNode()) { |
1239 invalidateClick(); | 1236 invalidateClick(); |
1240 return false; | 1237 return false; |
1241 } | 1238 } |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 2278 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
2282 IntPoint adjustedPoint = gestureEvent.position(); | 2279 IntPoint adjustedPoint = gestureEvent.position(); |
2283 | 2280 |
2284 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the | 2281 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the |
2285 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code | 2282 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code |
2286 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. | 2283 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. |
2287 | 2284 |
2288 m_longTapShouldInvokeContextMenu = false; | 2285 m_longTapShouldInvokeContextMenu = false; |
2289 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_
frame->view()) { | 2286 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_
frame->view()) { |
2290 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MousePressed, 1, | 2287 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MousePressed, 1, |
2291 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey
(), gestureEvent.metaKey(), PlatformMouseEvent::RealOrIndistinguishable, WTF::cu
rrentTime()); | 2288 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey
(), gestureEvent.metaKey(), PlatformMouseEvent::FromTouch, WTF::currentTime()); |
2292 m_mouseDown = mouseDownEvent; | 2289 m_mouseDown = mouseDownEvent; |
2293 | 2290 |
2294 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, | 2291 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi
tion(), LeftButton, PlatformEvent::MouseMoved, 1, |
2295 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey
(), gestureEvent.metaKey(), PlatformMouseEvent::RealOrIndistinguishable, WTF::cu
rrentTime()); | 2292 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey
(), gestureEvent.metaKey(), PlatformMouseEvent::FromTouch, WTF::currentTime()); |
2296 HitTestRequest request(HitTestRequest::ReadOnly); | 2293 HitTestRequest request(HitTestRequest::ReadOnly); |
2297 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); | 2294 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE
vent); |
2298 m_didStartDrag = false; | 2295 m_didStartDrag = false; |
2299 m_mouseDownMayStartDrag = true; | 2296 m_mouseDownMayStartDrag = true; |
2300 dragState().m_dragSrc = nullptr; | 2297 dragState().m_dragSrc = nullptr; |
2301 m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.positi
on()); | 2298 m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.positi
on()); |
2302 RefPtr<FrameView> protector(m_frame->view()); | 2299 RefPtr<FrameView> protector(m_frame->view()); |
2303 handleDrag(mev, DontCheckDragHysteresis); | 2300 handleDrag(mev, DontCheckDragHysteresis); |
2304 if (m_didStartDrag) { | 2301 if (m_didStartDrag) { |
2305 m_longTapShouldInvokeContextMenu = true; | 2302 m_longTapShouldInvokeContextMenu = true; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 } | 2792 } |
2796 | 2793 |
2797 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR
esults& targetedEvent) | 2794 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR
esults& targetedEvent) |
2798 { | 2795 { |
2799 #if OS(WIN) | 2796 #if OS(WIN) |
2800 PlatformEvent::Type eventType = PlatformEvent::MouseReleased; | 2797 PlatformEvent::Type eventType = PlatformEvent::MouseReleased; |
2801 #else | 2798 #else |
2802 PlatformEvent::Type eventType = PlatformEvent::MousePressed; | 2799 PlatformEvent::Type eventType = PlatformEvent::MousePressed; |
2803 #endif | 2800 #endif |
2804 | 2801 |
2805 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven
t.event().globalPosition(), RightButton, eventType, 1, false, false, false, fals
e, PlatformMouseEvent::RealOrIndistinguishable, WTF::currentTime()); | 2802 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven
t.event().globalPosition(), RightButton, eventType, 1, false, false, false, fals
e, PlatformMouseEvent::FromTouch, WTF::currentTime()); |
2806 // To simulate right-click behavior, we send a right mouse down and then | 2803 // To simulate right-click behavior, we send a right mouse down and then |
2807 // context menu event. | 2804 // context menu event. |
2808 // FIXME: Send HitTestResults to avoid redundant hit tests. | 2805 // FIXME: Send HitTestResults to avoid redundant hit tests. |
2809 handleMousePressEvent(mouseEvent); | 2806 handleMousePressEvent(mouseEvent); |
2810 return sendContextMenuEvent(mouseEvent); | 2807 return sendContextMenuEvent(mouseEvent); |
2811 // We do not need to send a corresponding mouse release because in case of | 2808 // We do not need to send a corresponding mouse release because in case of |
2812 // right-click, the context menu takes capture and consumes all events. | 2809 // right-click, the context menu takes capture and consumes all events. |
2813 } | 2810 } |
2814 | 2811 |
2815 void EventHandler::scheduleHoverStateUpdate() | 2812 void EventHandler::scheduleHoverStateUpdate() |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3882 unsigned EventHandler::accessKeyModifiers() | 3879 unsigned EventHandler::accessKeyModifiers() |
3883 { | 3880 { |
3884 #if OS(MACOSX) | 3881 #if OS(MACOSX) |
3885 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3882 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3886 #else | 3883 #else |
3887 return PlatformEvent::AltKey; | 3884 return PlatformEvent::AltKey; |
3888 #endif | 3885 #endif |
3889 } | 3886 } |
3890 | 3887 |
3891 } // namespace blink | 3888 } // namespace blink |
OLD | NEW |