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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 453493002: Improve detection of touch events when hiding media controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@autoHideControls
Patch Set: Revert Patch Set 8 Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/platform/PlatformMouseEvent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 2280 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
2281 IntPoint adjustedPoint = gestureEvent.position(); 2281 IntPoint adjustedPoint = gestureEvent.position();
2282 2282
2283 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the 2283 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the
2284 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code 2284 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code
2285 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice. 2285 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice.
2286 2286
2287 m_longTapShouldInvokeContextMenu = false; 2287 m_longTapShouldInvokeContextMenu = false;
2288 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) { 2288 if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled() && m_ frame->view()) {
2289 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1, 2289 PlatformMouseEvent mouseDownEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MousePressed, 1,
2290 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), WTF::currentTime()); 2290 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), PlatformMouseEvent::RealOrIndistinguishable, WTF::cu rrentTime());
2291 m_mouseDown = mouseDownEvent; 2291 m_mouseDown = mouseDownEvent;
2292 2292
2293 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1, 2293 PlatformMouseEvent mouseDragEvent(adjustedPoint, gestureEvent.globalPosi tion(), LeftButton, PlatformEvent::MouseMoved, 1,
2294 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), WTF::currentTime()); 2294 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey (), gestureEvent.metaKey(), PlatformMouseEvent::RealOrIndistinguishable, WTF::cu rrentTime());
2295 HitTestRequest request(HitTestRequest::ReadOnly); 2295 HitTestRequest request(HitTestRequest::ReadOnly);
2296 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent); 2296 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragE vent);
2297 m_didStartDrag = false; 2297 m_didStartDrag = false;
2298 m_mouseDownMayStartDrag = true; 2298 m_mouseDownMayStartDrag = true;
2299 dragState().m_dragSrc = nullptr; 2299 dragState().m_dragSrc = nullptr;
2300 m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.positi on()); 2300 m_mouseDownPos = m_frame->view()->windowToContents(mouseDragEvent.positi on());
2301 RefPtr<FrameView> protector(m_frame->view()); 2301 RefPtr<FrameView> protector(m_frame->view());
2302 handleDrag(mev, DontCheckDragHysteresis); 2302 handleDrag(mev, DontCheckDragHysteresis);
2303 if (m_didStartDrag) { 2303 if (m_didStartDrag) {
2304 m_longTapShouldInvokeContextMenu = true; 2304 m_longTapShouldInvokeContextMenu = true;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 2780
2781 // The contextmenu event is a mouse event even when invoked using the keyboa rd. 2781 // The contextmenu event is a mouse event even when invoked using the keyboa rd.
2782 // This is required for web compatibility. 2782 // This is required for web compatibility.
2783 2783
2784 #if OS(WIN) 2784 #if OS(WIN)
2785 PlatformEvent::Type eventType = PlatformEvent::MouseReleased; 2785 PlatformEvent::Type eventType = PlatformEvent::MouseReleased;
2786 #else 2786 #else
2787 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2787 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2788 #endif 2788 #endif
2789 2789
2790 PlatformMouseEvent mouseEvent(position, globalPosition, RightButton, eventTy pe, 1, false, false, false, false, WTF::currentTime()); 2790 PlatformMouseEvent mouseEvent(position, globalPosition, RightButton, eventTy pe, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistinguishable, WTF::currentTime());
2791 2791
2792 handleMousePressEvent(mouseEvent); 2792 handleMousePressEvent(mouseEvent);
2793 return sendContextMenuEvent(mouseEvent); 2793 return sendContextMenuEvent(mouseEvent);
2794 } 2794 }
2795 2795
2796 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR esults& targetedEvent) 2796 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR esults& targetedEvent)
2797 { 2797 {
2798 #if OS(WIN) 2798 #if OS(WIN)
2799 PlatformEvent::Type eventType = PlatformEvent::MouseReleased; 2799 PlatformEvent::Type eventType = PlatformEvent::MouseReleased;
2800 #else 2800 #else
2801 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2801 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2802 #endif 2802 #endif
2803 2803
2804 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1, false, false, false, fals e, WTF::currentTime()); 2804 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1, false, false, false, fals e, PlatformMouseEvent::RealOrIndistinguishable, WTF::currentTime());
2805 // To simulate right-click behavior, we send a right mouse down and then 2805 // To simulate right-click behavior, we send a right mouse down and then
2806 // context menu event. 2806 // context menu event.
2807 // FIXME: Send HitTestResults to avoid redundant hit tests. 2807 // FIXME: Send HitTestResults to avoid redundant hit tests.
2808 handleMousePressEvent(mouseEvent); 2808 handleMousePressEvent(mouseEvent);
2809 return sendContextMenuEvent(mouseEvent); 2809 return sendContextMenuEvent(mouseEvent);
2810 // We do not need to send a corresponding mouse release because in case of 2810 // We do not need to send a corresponding mouse release because in case of
2811 // right-click, the context menu takes capture and consumes all events. 2811 // right-click, the context menu takes capture and consumes all events.
2812 } 2812 }
2813 2813
2814 void EventHandler::scheduleHoverStateUpdate() 2814 void EventHandler::scheduleHoverStateUpdate()
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2879 2879
2880 // Don't dispatch a synthetic mouse move event if the mouse cursor is not vi sible to the user. 2880 // Don't dispatch a synthetic mouse move event if the mouse cursor is not vi sible to the user.
2881 if (!isCursorVisible()) 2881 if (!isCursorVisible())
2882 return; 2882 return;
2883 2883
2884 bool shiftKey; 2884 bool shiftKey;
2885 bool ctrlKey; 2885 bool ctrlKey;
2886 bool altKey; 2886 bool altKey;
2887 bool metaKey; 2887 bool metaKey;
2888 PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, me taKey); 2888 PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, me taKey);
2889 PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownM ouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, a ltKey, metaKey, currentTime()); 2889 PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownM ouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, a ltKey, metaKey, PlatformMouseEvent::RealOrIndistinguishable, currentTime());
2890 handleMouseMoveEvent(fakeMouseMoveEvent); 2890 handleMouseMoveEvent(fakeMouseMoveEvent);
2891 } 2891 }
2892 2892
2893 void EventHandler::cancelFakeMouseMoveEvent() 2893 void EventHandler::cancelFakeMouseMoveEvent()
2894 { 2894 {
2895 m_fakeMouseMoveEventTimer.stop(); 2895 m_fakeMouseMoveEventTimer.stop();
2896 } 2896 }
2897 2897
2898 bool EventHandler::isCursorVisible() const 2898 bool EventHandler::isCursorVisible() const
2899 { 2899 {
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 unsigned EventHandler::accessKeyModifiers() 3881 unsigned EventHandler::accessKeyModifiers()
3882 { 3882 {
3883 #if OS(MACOSX) 3883 #if OS(MACOSX)
3884 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3884 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3885 #else 3885 #else
3886 return PlatformEvent::AltKey; 3886 return PlatformEvent::AltKey;
3887 #endif 3887 #endif
3888 } 3888 }
3889 3889
3890 } // namespace blink 3890 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/platform/PlatformMouseEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698