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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 2160983003: [ContextMenu] Shift+F10 should trigger contextmenu on keydown to match system behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 // Suppress the next keypress event unless the focused node is a plu gin node. 1063 // Suppress the next keypress event unless the focused node is a plu gin node.
1064 // (Flash needs these keypress events to handle non-US keyboards.) 1064 // (Flash needs these keypress events to handle non-US keyboards.)
1065 Element* element = focusedElement(); 1065 Element* element = focusedElement();
1066 if (!element || !element->layoutObject() || !element->layoutObject() ->isEmbeddedObject()) 1066 if (!element || !element->layoutObject() || !element->layoutObject() ->isEmbeddedObject())
1067 m_suppressNextKeypressEvent = true; 1067 m_suppressNextKeypressEvent = true;
1068 } 1068 }
1069 return result; 1069 return result;
1070 } 1070 }
1071 1071
1072 #if !OS(MACOSX) 1072 #if !OS(MACOSX)
1073 const WebInputEvent::Type contextMenuTriggeringEventType = 1073 const WebInputEvent::Type contextMenuKeyTriggeringEventType =
1074 #if OS(WIN) 1074 #if OS(WIN)
1075 WebInputEvent::KeyUp; 1075 WebInputEvent::KeyUp;
1076 #else 1076 #else
1077 WebInputEvent::RawKeyDown; 1077 WebInputEvent::RawKeyDown;
1078 #endif 1078 #endif
1079 const WebInputEvent::Type shiftF10TriggeringEventType = WebInputEvent::RawKe yDown;
1079 1080
1080 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS; 1081 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS;
1081 bool isShiftF10 = (event.modifiers & WebInputEvent::InputModifiers) == WebIn putEvent::ShiftKey && event.windowsKeyCode == VKEY_F10; 1082 bool isShiftF10 = (event.modifiers & WebInputEvent::InputModifiers) == WebIn putEvent::ShiftKey && event.windowsKeyCode == VKEY_F10;
1082 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri ngEventType) { 1083 if ((isUnmodifiedMenuKey && event.type == contextMenuKeyTriggeringEventType)
1084 || (isShiftF10 && event.type == shiftF10TriggeringEventType)) {
1083 view()->sendContextMenuEvent(event); 1085 view()->sendContextMenuEvent(event);
1084 return WebInputEventResult::HandledSystem; 1086 return WebInputEventResult::HandledSystem;
1085 } 1087 }
1086 #endif // !OS(MACOSX) 1088 #endif // !OS(MACOSX)
1087 1089
1088 return keyEventDefault(event); 1090 return keyEventDefault(event);
1089 } 1091 }
1090 1092
1091 WebInputEventResult WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) 1093 WebInputEventResult WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event)
1092 { 1094 {
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } 1457 }
1456 1458
1457 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const 1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const
1458 { 1460 {
1459 if (!m_imeAcceptEvents) 1461 if (!m_imeAcceptEvents)
1460 return nullptr; 1462 return nullptr;
1461 return focusedLocalFrameInWidget(); 1463 return focusedLocalFrameInWidget();
1462 } 1464 }
1463 1465
1464 } // namespace blink 1466 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698