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

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: 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
« no previous file with comments | « no previous file | Source/web/WebViewImpl.cpp » ('j') | Source/web/WebViewImpl.cpp » ('J')
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 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) 2830 unsigned modifiers = targetedEvent.event().modifiers();
2831 PlatformEvent::Type eventType = PlatformEvent::MouseReleased;
2832 #else
2833 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2831 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2834 #endif 2832 if (m_frame->settings()->showContextMenuOnMouseUp())
2833 eventType = PlatformEvent::MouseReleased;
2834 else
2835 modifiers |= PlatformEvent::RightButtonDown;
2835 2836
2836 unsigned modifiers = targetedEvent.event().modifiers();
2837 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1, 2837 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven t.event().globalPosition(), RightButton, eventType, 1,
2838 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::RightBu ttonDown), 2838 static_cast<PlatformEvent::Modifiers>(modifiers),
2839 PlatformMouseEvent::FromTouch, WTF::currentTime()); 2839 PlatformMouseEvent::FromTouch, WTF::currentTime());
2840 // To simulate right-click behavior, we send a right mouse down and then 2840 // To simulate right-click behavior, we send a right mouse down and then
2841 // context menu event. 2841 // context menu event.
2842 // FIXME: Send HitTestResults to avoid redundant hit tests. 2842 // FIXME: Send HitTestResults to avoid redundant hit tests.
2843 handleMousePressEvent(mouseEvent); 2843 handleMousePressEvent(mouseEvent);
2844 return sendContextMenuEvent(mouseEvent); 2844 return sendContextMenuEvent(mouseEvent);
2845 // We do not need to send a corresponding mouse release because in case of 2845 // We do not need to send a corresponding mouse release because in case of
2846 // right-click, the context menu takes capture and consumes all events. 2846 // right-click, the context menu takes capture and consumes all events.
2847 } 2847 }
2848 2848
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 unsigned EventHandler::accessKeyModifiers() 3872 unsigned EventHandler::accessKeyModifiers()
3873 { 3873 {
3874 #if OS(MACOSX) 3874 #if OS(MACOSX)
3875 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3875 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3876 #else 3876 #else
3877 return PlatformEvent::AltKey; 3877 return PlatformEvent::AltKey;
3878 #endif 3878 #endif
3879 } 3879 }
3880 3880
3881 } // namespace blink 3881 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/web/WebViewImpl.cpp » ('j') | Source/web/WebViewImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698