Chromium Code Reviews| Index: Source/web/WebViewImpl.cpp |
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
| index a0bd095a749a7bec78814557274cc5ca80085d98..e5d7bdd12db36d779f9db9ac61b379c5d11f2efb 100644 |
| --- a/Source/web/WebViewImpl.cpp |
| +++ b/Source/web/WebViewImpl.cpp |
| @@ -389,7 +389,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) |
| , m_ignoreInputEvents(false) |
| , m_compositorDeviceScaleFactorOverride(0) |
| , m_rootLayerScale(1) |
| - , m_suppressNextKeypressEvent(false) |
| + , m_suppressNextKeypressEvent(Suppress_None) |
| , m_imeAcceptEvents(true) |
| , m_operationsAllowed(WebDragOperationNone) |
| , m_dragOperation(WebDragOperationNone) |
| @@ -993,9 +993,9 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| // member. |
| // The m_suppressNextKeypressEvent is set if the KeyDown is handled by |
| // Webkit. A keyDown event is typically associated with a keyPress(char) |
| - // event and a keyUp event. We reset this flag here as this is a new keyDown |
| + // event and a keyUp event. We reset this state here as this is a new keyDown |
| // event. |
| - m_suppressNextKeypressEvent = false; |
| + m_suppressNextKeypressEvent = Suppress_None; |
| // If there is a select popup, it should be the one processing the event, |
| // not the page. |
| @@ -1006,7 +1006,7 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| // We need to ignore the next Char event after this otherwise pressing |
| // enter when selecting an item in the popup will go to the page. |
| if (WebInputEvent::RawKeyDown == event.type) |
| - m_suppressNextKeypressEvent = true; |
| + m_suppressNextKeypressEvent = Suppress_KeyEventCanceled; |
|
James Su
2015/02/27 01:46:18
Why it's Canceled rather than Handled?
|
| return true; |
| } |
| @@ -1030,7 +1030,7 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) |
| // (Flash needs these keypress events to handle non-US keyboards.) |
| Element* element = focusedElement(); |
| if (!element || !element->renderer() || !element->renderer()->isEmbeddedObject()) |
| - m_suppressNextKeypressEvent = true; |
| + m_suppressNextKeypressEvent = Suppress_KeyEventHandled; |
|
James Su
2015/02/27 01:46:18
Why it's Handled?
eventHandler().keyEvent(evt) re
|
| } |
| return true; |
| } |
| @@ -1063,8 +1063,8 @@ bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event) |
| // handled by Webkit. A keyDown event is typically associated with a |
| // keyPress(char) event and a keyUp event. We reset this flag here as it |
| // only applies to the current keyPress event. |
| - bool suppress = m_suppressNextKeypressEvent; |
| - m_suppressNextKeypressEvent = false; |
| + bool suppress = (m_suppressNextKeypressEvent != Suppress_None); |
| + m_suppressNextKeypressEvent = Suppress_None; |
| // If there is a select popup, it should be the one processing the event, |
| // not the page. |
| @@ -2268,9 +2268,8 @@ bool WebViewImpl::setComposition( |
| return false; |
| } |
| - // If we're not going to fire a keypress event, then the keydown event was |
| - // canceled. In that case, cancel any existing composition. |
| - if (text.isEmpty() || m_suppressNextKeypressEvent) { |
| + // The keydown event was canceled, so cancel any existing composition. |
| + if (text.isEmpty() || m_suppressNextKeypressEvent == Suppress_KeyEventCanceled) { |
|
James Su
2015/02/27 01:46:18
Based on this change, the composition events will
huangs
2015/02/27 03:43:58
Could you create your own CL and offer it as an al
|
| // A browser process sent an IPC message which does not contain a valid |
| // string, which means an ongoing composition has been canceled. |
| // If the ongoing composition has been canceled, replace the ongoing |