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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 970743002: [IME] Fix s_suppressNextKeypressEvent logic in WebViewImpl::setComposition(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleaning up logic. 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 | « no previous file | 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..91c8a57d91d17800e16ba837e234eb4ad6c9f36b 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -2304,18 +2304,13 @@ 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) {
- // 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
- // composition string with an empty string and complete it.
- String emptyString;
- Vector<CompositionUnderline> emptyUnderlines;
- inputMethodController.setComposition(emptyString, emptyUnderlines, 0, 0);
+ // A keypress event is canceled. If an ongoing composition exists, then the
+ // keydown event should have arisen from a handled key (e.g., backspace).
+ // In this case we ignore the cancellation and continue; otherwise (no
+ // ongoing composition) we exit and signal success only for attempts to
+ // clear the composition.
+ if (m_suppressNextKeypressEvent && !inputMethodController.hasComposition())
return text.isEmpty();
- }
// When the range of composition underlines overlap with the range between
// selectionStart and selectionEnd, WebKit somehow won't paint the selection
@@ -2325,7 +2320,7 @@ bool WebViewImpl::setComposition(
CompositionUnderlineVectorBuilder(underlines),
selectionStart, selectionEnd);
- return inputMethodController.hasComposition();
+ return text.isEmpty() || inputMethodController.hasComposition();
}
bool WebViewImpl::confirmComposition()
« no previous file with comments | « no previous file | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698