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

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

Issue 2290313002: Remove PlatformKeyboardEvent (Closed)
Patch Set: One more fix Created 4 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
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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr ame(focusedFrame)); 1048 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr ame(focusedFrame));
1049 webFrame->client()->forwardInputEvent(&event); 1049 webFrame->client()->forwardInputEvent(&event);
1050 return WebInputEventResult::HandledSystem; 1050 return WebInputEventResult::HandledSystem;
1051 } 1051 }
1052 1052
1053 if (!focusedFrame || !focusedFrame->isLocalFrame()) 1053 if (!focusedFrame || !focusedFrame->isLocalFrame())
1054 return WebInputEventResult::NotHandled; 1054 return WebInputEventResult::NotHandled;
1055 1055
1056 LocalFrame* frame = toLocalFrame(focusedFrame); 1056 LocalFrame* frame = toLocalFrame(focusedFrame);
1057 1057
1058 PlatformKeyboardEventBuilder evt(event); 1058 WebInputEventResult result = frame->eventHandler().keyEvent(event);
1059
1060 WebInputEventResult result = frame->eventHandler().keyEvent(evt);
1061 if (result != WebInputEventResult::NotHandled) { 1059 if (result != WebInputEventResult::NotHandled) {
1062 if (WebInputEvent::RawKeyDown == event.type) { 1060 if (WebInputEvent::RawKeyDown == event.type) {
1063 // Suppress the next keypress event unless the focused node is a plu gin node. 1061 // 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.) 1062 // (Flash needs these keypress events to handle non-US keyboards.)
1065 Element* element = focusedElement(); 1063 Element* element = focusedElement();
1066 if (!element || !element->layoutObject() || !element->layoutObject() ->isEmbeddedObject()) 1064 if (!element || !element->layoutObject() || !element->layoutObject() ->isEmbeddedObject())
1067 m_suppressNextKeypressEvent = true; 1065 m_suppressNextKeypressEvent = true;
1068 } 1066 }
1069 return result; 1067 return result;
1070 } 1068 }
(...skipping 30 matching lines...) Expand all
1101 // only applies to the current keyPress event. 1099 // only applies to the current keyPress event.
1102 bool suppress = m_suppressNextKeypressEvent; 1100 bool suppress = m_suppressNextKeypressEvent;
1103 m_suppressNextKeypressEvent = false; 1101 m_suppressNextKeypressEvent = false;
1104 1102
1105 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); 1103 LocalFrame* frame = toLocalFrame(focusedCoreFrame());
1106 if (!frame) 1104 if (!frame)
1107 return suppress ? WebInputEventResult::HandledSuppressed : WebInputEvent Result::NotHandled; 1105 return suppress ? WebInputEventResult::HandledSuppressed : WebInputEvent Result::NotHandled;
1108 1106
1109 EventHandler& handler = frame->eventHandler(); 1107 EventHandler& handler = frame->eventHandler();
1110 1108
1111 PlatformKeyboardEventBuilder evt(event); 1109 if (!event.isCharacterKey())
1112 if (!evt.isCharacterKey())
1113 return WebInputEventResult::HandledSuppressed; 1110 return WebInputEventResult::HandledSuppressed;
1114 1111
1115 // Accesskeys are triggered by char events and can't be suppressed. 1112 // Accesskeys are triggered by char events and can't be suppressed.
1116 // It is unclear whether a keypress should be dispatched as well 1113 // It is unclear whether a keypress should be dispatched as well
1117 // crbug.com/563507 1114 // crbug.com/563507
1118 if (handler.handleAccessKey(evt)) 1115 if (handler.handleAccessKey(event))
1119 return WebInputEventResult::HandledSystem; 1116 return WebInputEventResult::HandledSystem;
1120 1117
1121 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to 1118 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to
1122 // the eventHandler::keyEvent. We mimic this behavior on all platforms since 1119 // the eventHandler::keyEvent. We mimic this behavior on all platforms since
1123 // for now we are converting other platform's key events to windows key 1120 // for now we are converting other platform's key events to windows key
1124 // events. 1121 // events.
1125 if (evt.isSystemKey()) 1122 if (event.isSystemKey)
1126 return WebInputEventResult::NotHandled; 1123 return WebInputEventResult::NotHandled;
1127 1124
1128 if (suppress) 1125 if (suppress)
1129 return WebInputEventResult::HandledSuppressed; 1126 return WebInputEventResult::HandledSuppressed;
1130 1127
1131 WebInputEventResult result = handler.keyEvent(evt); 1128 WebInputEventResult result = handler.keyEvent(event);
1132 if (result != WebInputEventResult::NotHandled) 1129 if (result != WebInputEventResult::NotHandled)
1133 return result; 1130 return result;
1134 1131
1135 return keyEventDefault(event); 1132 return keyEventDefault(event);
1136 } 1133 }
1137 1134
1138 WebInputEventResult WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event) 1135 WebInputEventResult WebFrameWidgetImpl::keyEventDefault(const WebKeyboardEvent& event)
1139 { 1136 {
1140 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); 1137 LocalFrame* frame = toLocalFrame(focusedCoreFrame());
1141 if (!frame) 1138 if (!frame)
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 } 1454 }
1458 1455
1459 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const 1456 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const
1460 { 1457 {
1461 if (!m_imeAcceptEvents) 1458 if (!m_imeAcceptEvents)
1462 return nullptr; 1459 return nullptr;
1463 return focusedLocalFrameInWidget(); 1460 return focusedLocalFrameInWidget();
1464 } 1461 }
1465 1462
1466 } // namespace blink 1463 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698