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

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

Issue 1602443006: Set the correct buttons for long press action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « third_party/WebKit/LayoutTests/fast/events/mouse-event-buttons-attribute-expected.txt ('k') | no next file » | 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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 doc->updateHoverActiveState(request, result.innerElement()); 3005 doc->updateHoverActiveState(request, result.innerElement());
3006 3006
3007 // The contextmenu event is a mouse event even when invoked using the keyboa rd. 3007 // The contextmenu event is a mouse event even when invoked using the keyboa rd.
3008 // This is required for web compatibility. 3008 // This is required for web compatibility.
3009 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 3009 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
3010 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) 3010 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
3011 eventType = PlatformEvent::MouseReleased; 3011 eventType = PlatformEvent::MouseReleased;
3012 3012
3013 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, 3013 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition,
3014 RightButton, eventType, 1, 3014 RightButton, eventType, 1,
3015 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, 3015 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable,
mustaq 2016/01/19 19:33:41 Please use the same logic here too.
Navid Zolghadr 2016/01/19 20:41:40 No. I don't think that is correct. This is differe
mustaq 2016/01/19 21:50:13 I didn't mean sending extra events here. With butt
Navid Zolghadr 2016/01/19 21:57:28 I can definitely do that. The only point is that t
3016 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M ouse); 3016 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M ouse);
3017 3017
3018 return sendContextMenuEvent(mouseEvent, overrideTargetElement); 3018 return sendContextMenuEvent(mouseEvent, overrideTargetElement);
3019 } 3019 }
3020 3020
3021 WebInputEventResult EventHandler::sendContextMenuEventForGesture(const GestureEv entWithHitTestResults& targetedEvent) 3021 WebInputEventResult EventHandler::sendContextMenuEventForGesture(const GestureEv entWithHitTestResults& targetedEvent)
3022 { 3022 {
3023 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 3023 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
3024 unsigned modifiers = gestureEvent.modifiers(); 3024 unsigned modifiers = gestureEvent.modifiers();
3025 3025
3026 // Send MouseMoved event prior to handling (https://crbug.com/485290). 3026 // Send MouseMoved event prior to handling (https://crbug.com/485290).
3027 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa lPosition(), 3027 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa lPosition(),
3028 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, 3028 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,
3029 static_cast<PlatformEvent::Modifiers>(modifiers), 3029 static_cast<PlatformEvent::Modifiers>(modifiers),
3030 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse); 3030 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope rties::PointerType::Mouse);
3031 dispatchMouseEvent(EventTypeNames::mousemove, targetedEvent.hitTestResult(). innerNode(), 0, fakeMouseMove); 3031 dispatchMouseEvent(EventTypeNames::mousemove, targetedEvent.hitTestResult(). innerNode(), 0, fakeMouseMove);
3032 3032
3033 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 3033 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
3034 3034
3035 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) 3035 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
3036 eventType = PlatformEvent::MouseReleased; 3036 eventType = PlatformEvent::MouseReleased;
mustaq 2016/01/19 19:33:41 This seems to be firing mouseup when showContextMe
Navid Zolghadr 2016/01/19 20:41:40 That is not the case. Although we set the eventTyp
mustaq 2016/01/19 21:50:13 The down vs up mix up here seems non-trivial for s
Navid Zolghadr 2016/01/19 21:57:28 Sure. I will remove the else.
3037 else 3037 else
3038 modifiers |= PlatformEvent::RightButtonDown; 3038 modifiers |= PlatformEvent::RightButtonDown;
3039 3039
3040 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1, 3040 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1,
3041 static_cast<PlatformEvent::Modifiers>(modifiers), 3041 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::RightBu ttonDown),
3042 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), WebPo interProperties::PointerType::Mouse); 3042 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), WebPo interProperties::PointerType::Mouse);
3043 // To simulate right-click behavior, we send a right mouse down and then 3043 // To simulate right-click behavior, we send a right mouse down and then
3044 // context menu event. 3044 // context menu event.
3045 // FIXME: Send HitTestResults to avoid redundant hit tests. 3045 // FIXME: Send HitTestResults to avoid redundant hit tests.
3046 handleMousePressEvent(mouseEvent); 3046 handleMousePressEvent(mouseEvent);
3047 return sendContextMenuEvent(mouseEvent); 3047 return sendContextMenuEvent(mouseEvent);
3048 // We do not need to send a corresponding mouse release because in case of 3048 // We do not need to send a corresponding mouse release because in case of
3049 // right-click, the context menu takes capture and consumes all events. 3049 // right-click, the context menu takes capture and consumes all events.
3050 } 3050 }
3051 3051
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4144 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4145 { 4145 {
4146 #if OS(MACOSX) 4146 #if OS(MACOSX)
4147 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4147 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4148 #else 4148 #else
4149 return PlatformEvent::AltKey; 4149 return PlatformEvent::AltKey;
4150 #endif 4150 #endif
4151 } 4151 }
4152 4152
4153 } // namespace blink 4153 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/mouse-event-buttons-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698