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

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

Issue 776483002: Use the setting to determine whether showing context menu on mouse up. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add layout test and exclude modifiers part. Created 6 years 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
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 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 #endif 2820 #endif
2821 2821
2822 PlatformMouseEvent mouseEvent(position, globalPosition, RightButton, eventTy pe, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistinguishable, WTF::currentTime()); 2822 PlatformMouseEvent mouseEvent(position, globalPosition, RightButton, eventTy pe, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistinguishable, WTF::currentTime());
2823 2823
2824 handleMousePressEvent(mouseEvent); 2824 handleMousePressEvent(mouseEvent);
2825 return sendContextMenuEvent(mouseEvent); 2825 return sendContextMenuEvent(mouseEvent);
2826 } 2826 }
2827 2827
2828 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR esults& targetedEvent) 2828 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR esults& targetedEvent)
2829 { 2829 {
2830 #if OS(WIN)
2831 PlatformEvent::Type eventType = PlatformEvent::MouseReleased;
2832 #else
2833 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2830 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2834 #endif 2831
2832 if (m_frame->settings()->showContextMenuOnMouseUp())
2833 eventType = PlatformEvent::MouseReleased;
Rick Byers 2014/12/03 13:50:19 Note to other reviewers: I didn't bother asking f
2835 2834
2836 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1, false, false, false, fals e, PlatformMouseEvent::FromTouch, WTF::currentTime()); 2835 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1, false, false, false, fals e, PlatformMouseEvent::FromTouch, WTF::currentTime());
2837 // To simulate right-click behavior, we send a right mouse down and then 2836 // To simulate right-click behavior, we send a right mouse down and then
2838 // context menu event. 2837 // context menu event.
2839 // FIXME: Send HitTestResults to avoid redundant hit tests. 2838 // FIXME: Send HitTestResults to avoid redundant hit tests.
2840 handleMousePressEvent(mouseEvent); 2839 handleMousePressEvent(mouseEvent);
2841 return sendContextMenuEvent(mouseEvent); 2840 return sendContextMenuEvent(mouseEvent);
2842 // We do not need to send a corresponding mouse release because in case of 2841 // We do not need to send a corresponding mouse release because in case of
2843 // right-click, the context menu takes capture and consumes all events. 2842 // right-click, the context menu takes capture and consumes all events.
2844 } 2843 }
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
3862 unsigned EventHandler::accessKeyModifiers() 3861 unsigned EventHandler::accessKeyModifiers()
3863 { 3862 {
3864 #if OS(MACOSX) 3863 #if OS(MACOSX)
3865 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3864 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3866 #else 3865 #else
3867 return PlatformEvent::AltKey; 3866 return PlatformEvent::AltKey;
3868 #endif 3867 #endif
3869 } 3868 }
3870 3869
3871 } // namespace blink 3870 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/show-context-menu-on-mouse-up-expected.txt ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698