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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 956133002: [IME] Differentiate s_suppressNextKeypressEvent in WebViewImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 5312dcdbdfd33254c2ee3bda5d186fc542e7e017..0641062869914d5d08e4933e86a5e842bc98c078 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -412,7 +412,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)
@@ -1016,9 +1016,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.
@@ -1029,7 +1029,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;
return true;
}
@@ -1053,7 +1053,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;
}
return true;
}
@@ -1086,8 +1086,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.
@@ -2304,9 +2304,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) {
// 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698