| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 #include "modules/credentialmanager/CredentialManagerClient.h" | 96 #include "modules/credentialmanager/CredentialManagerClient.h" |
| 97 #include "modules/encryptedmedia/MediaKeysController.h" | 97 #include "modules/encryptedmedia/MediaKeysController.h" |
| 98 #include "modules/storage/StorageNamespaceController.h" | 98 #include "modules/storage/StorageNamespaceController.h" |
| 99 #include "modules/webgl/WebGLRenderingContext.h" | 99 #include "modules/webgl/WebGLRenderingContext.h" |
| 100 #include "platform/ContextMenu.h" | 100 #include "platform/ContextMenu.h" |
| 101 #include "platform/ContextMenuItem.h" | 101 #include "platform/ContextMenuItem.h" |
| 102 #include "platform/Cursor.h" | 102 #include "platform/Cursor.h" |
| 103 #include "platform/Histogram.h" | 103 #include "platform/Histogram.h" |
| 104 #include "platform/KeyboardCodes.h" | 104 #include "platform/KeyboardCodes.h" |
| 105 #include "platform/PlatformGestureEvent.h" | 105 #include "platform/PlatformGestureEvent.h" |
| 106 #include "platform/PlatformKeyboardEvent.h" | |
| 107 #include "platform/PlatformMouseEvent.h" | 106 #include "platform/PlatformMouseEvent.h" |
| 108 #include "platform/RuntimeEnabledFeatures.h" | 107 #include "platform/RuntimeEnabledFeatures.h" |
| 109 #include "platform/TraceEvent.h" | 108 #include "platform/TraceEvent.h" |
| 110 #include "platform/UserGestureIndicator.h" | 109 #include "platform/UserGestureIndicator.h" |
| 111 #include "platform/exported/WebActiveGestureAnimation.h" | 110 #include "platform/exported/WebActiveGestureAnimation.h" |
| 112 #include "platform/fonts/FontCache.h" | 111 #include "platform/fonts/FontCache.h" |
| 113 #include "platform/graphics/Color.h" | 112 #include "platform/graphics/Color.h" |
| 114 #include "platform/graphics/CompositorMutatorClient.h" | 113 #include "platform/graphics/CompositorMutatorClient.h" |
| 115 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 114 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
| 116 #include "platform/graphics/GraphicsContext.h" | 115 #include "platform/graphics/GraphicsContext.h" |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 // member. | 1076 // member. |
| 1078 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by | 1077 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by |
| 1079 // Webkit. A keyDown event is typically associated with a keyPress(char) | 1078 // Webkit. A keyDown event is typically associated with a keyPress(char) |
| 1080 // event and a keyUp event. We reset this flag here as this is a new keyDown | 1079 // event and a keyUp event. We reset this flag here as this is a new keyDown |
| 1081 // event. | 1080 // event. |
| 1082 m_suppressNextKeypressEvent = false; | 1081 m_suppressNextKeypressEvent = false; |
| 1083 | 1082 |
| 1084 // If there is a popup, it should be the one processing the event, not the | 1083 // If there is a popup, it should be the one processing the event, not the |
| 1085 // page. | 1084 // page. |
| 1086 if (m_pagePopup) { | 1085 if (m_pagePopup) { |
| 1087 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 1086 m_pagePopup->handleKeyEvent(event); |
| 1088 // We need to ignore the next Char event after this otherwise pressing | 1087 // We need to ignore the next Char event after this otherwise pressing |
| 1089 // enter when selecting an item in the popup will go to the page. | 1088 // enter when selecting an item in the popup will go to the page. |
| 1090 if (WebInputEvent::RawKeyDown == event.type) | 1089 if (WebInputEvent::RawKeyDown == event.type) |
| 1091 m_suppressNextKeypressEvent = true; | 1090 m_suppressNextKeypressEvent = true; |
| 1092 return WebInputEventResult::HandledSystem; | 1091 return WebInputEventResult::HandledSystem; |
| 1093 } | 1092 } |
| 1094 | 1093 |
| 1095 Frame* focusedFrame = focusedCoreFrame(); | 1094 Frame* focusedFrame = focusedCoreFrame(); |
| 1096 if (focusedFrame && focusedFrame->isRemoteFrame()) { | 1095 if (focusedFrame && focusedFrame->isRemoteFrame()) { |
| 1097 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame)); | 1096 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame)); |
| 1098 webFrame->client()->forwardInputEvent(&event); | 1097 webFrame->client()->forwardInputEvent(&event); |
| 1099 return WebInputEventResult::HandledSystem; | 1098 return WebInputEventResult::HandledSystem; |
| 1100 } | 1099 } |
| 1101 | 1100 |
| 1102 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 1101 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
| 1103 return WebInputEventResult::NotHandled; | 1102 return WebInputEventResult::NotHandled; |
| 1104 | 1103 |
| 1105 LocalFrame* frame = toLocalFrame(focusedFrame); | 1104 LocalFrame* frame = toLocalFrame(focusedFrame); |
| 1106 | 1105 |
| 1107 PlatformKeyboardEventBuilder evt(event); | 1106 WebInputEventResult result = frame->eventHandler().keyEvent(event); |
| 1108 | |
| 1109 WebInputEventResult result = frame->eventHandler().keyEvent(evt); | |
| 1110 if (result != WebInputEventResult::NotHandled) { | 1107 if (result != WebInputEventResult::NotHandled) { |
| 1111 if (WebInputEvent::RawKeyDown == event.type) { | 1108 if (WebInputEvent::RawKeyDown == event.type) { |
| 1112 // Suppress the next keypress event unless the focused node is a plu
gin node. | 1109 // Suppress the next keypress event unless the focused node is a plu
gin node. |
| 1113 // (Flash needs these keypress events to handle non-US keyboards.) | 1110 // (Flash needs these keypress events to handle non-US keyboards.) |
| 1114 Element* element = focusedElement(); | 1111 Element* element = focusedElement(); |
| 1115 if (element && element->layoutObject() && element->layoutObject()->i
sEmbeddedObject()) { | 1112 if (element && element->layoutObject() && element->layoutObject()->i
sEmbeddedObject()) { |
| 1116 if (event.windowsKeyCode == VKEY_TAB) { | 1113 if (event.windowsKeyCode == VKEY_TAB) { |
| 1117 // If the plugin supports keyboard focus then we should not
send a tab keypress event. | 1114 // If the plugin supports keyboard focus then we should not
send a tab keypress event. |
| 1118 Widget* widget = toLayoutPart(element->layoutObject())->widg
et(); | 1115 Widget* widget = toLayoutPart(element->layoutObject())->widg
et(); |
| 1119 if (widget && widget->isPluginContainer()) { | 1116 if (widget && widget->isPluginContainer()) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 // member. The m_suppressNextKeypressEvent is set if the KeyDown is | 1159 // member. The m_suppressNextKeypressEvent is set if the KeyDown is |
| 1163 // handled by Webkit. A keyDown event is typically associated with a | 1160 // handled by Webkit. A keyDown event is typically associated with a |
| 1164 // keyPress(char) event and a keyUp event. We reset this flag here as it | 1161 // keyPress(char) event and a keyUp event. We reset this flag here as it |
| 1165 // only applies to the current keyPress event. | 1162 // only applies to the current keyPress event. |
| 1166 bool suppress = m_suppressNextKeypressEvent; | 1163 bool suppress = m_suppressNextKeypressEvent; |
| 1167 m_suppressNextKeypressEvent = false; | 1164 m_suppressNextKeypressEvent = false; |
| 1168 | 1165 |
| 1169 // If there is a popup, it should be the one processing the event, not the | 1166 // If there is a popup, it should be the one processing the event, not the |
| 1170 // page. | 1167 // page. |
| 1171 if (m_pagePopup) | 1168 if (m_pagePopup) |
| 1172 return m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 1169 return m_pagePopup->handleKeyEvent(event); |
| 1173 | 1170 |
| 1174 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); | 1171 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); |
| 1175 if (!frame) | 1172 if (!frame) |
| 1176 return suppress ? WebInputEventResult::HandledSuppressed : WebInputEvent
Result::NotHandled; | 1173 return suppress ? WebInputEventResult::HandledSuppressed : WebInputEvent
Result::NotHandled; |
| 1177 | 1174 |
| 1178 EventHandler& handler = frame->eventHandler(); | 1175 EventHandler& handler = frame->eventHandler(); |
| 1179 | 1176 |
| 1180 PlatformKeyboardEventBuilder evt(event); | 1177 if (!event.isCharacterKey()) |
| 1181 if (!evt.isCharacterKey()) | |
| 1182 return WebInputEventResult::HandledSuppressed; | 1178 return WebInputEventResult::HandledSuppressed; |
| 1183 | 1179 |
| 1184 // Accesskeys are triggered by char events and can't be suppressed. | 1180 // Accesskeys are triggered by char events and can't be suppressed. |
| 1185 if (handler.handleAccessKey(evt)) | 1181 if (handler.handleAccessKey(event)) |
| 1186 return WebInputEventResult::HandledSystem; | 1182 return WebInputEventResult::HandledSystem; |
| 1187 | 1183 |
| 1188 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to | 1184 // Safari 3.1 does not pass off windows system key messages (WM_SYSCHAR) to |
| 1189 // the eventHandler::keyEvent. We mimic this behavior on all platforms since | 1185 // the eventHandler::keyEvent. We mimic this behavior on all platforms since |
| 1190 // for now we are converting other platform's key events to windows key | 1186 // for now we are converting other platform's key events to windows key |
| 1191 // events. | 1187 // events. |
| 1192 if (evt.isSystemKey()) | 1188 if (event.isSystemKey) |
| 1193 return WebInputEventResult::NotHandled; | 1189 return WebInputEventResult::NotHandled; |
| 1194 | 1190 |
| 1195 if (suppress) | 1191 if (suppress) |
| 1196 return WebInputEventResult::HandledSuppressed; | 1192 return WebInputEventResult::HandledSuppressed; |
| 1197 | 1193 |
| 1198 WebInputEventResult result = handler.keyEvent(evt); | 1194 WebInputEventResult result = handler.keyEvent(event); |
| 1199 if (result != WebInputEventResult::NotHandled) | 1195 if (result != WebInputEventResult::NotHandled) |
| 1200 return result; | 1196 return result; |
| 1201 if (keyEventDefault(event)) | 1197 if (keyEventDefault(event)) |
| 1202 return WebInputEventResult::HandledSystem; | 1198 return WebInputEventResult::HandledSystem; |
| 1203 | 1199 |
| 1204 return WebInputEventResult::NotHandled; | 1200 return WebInputEventResult::NotHandled; |
| 1205 } | 1201 } |
| 1206 | 1202 |
| 1207 WebRect WebViewImpl::computeBlockBound(const WebPoint& pointInRootFrame, bool ig
noreClipping) | 1203 WebRect WebViewImpl::computeBlockBound(const WebPoint& pointInRootFrame, bool ig
noreClipping) |
| 1208 { | 1204 { |
| (...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4608 return nullptr; | 4604 return nullptr; |
| 4609 return focusedFrame; | 4605 return focusedFrame; |
| 4610 } | 4606 } |
| 4611 | 4607 |
| 4612 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const | 4608 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
| 4613 { | 4609 { |
| 4614 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4610 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4615 } | 4611 } |
| 4616 | 4612 |
| 4617 } // namespace blink | 4613 } // namespace blink |
| OLD | NEW |