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

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 2828093003: updating Input field value by script should reset IME composition. (Closed)
Patch Set: Created 3 years, 8 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
Index: third_party/WebKit/Source/core/editing/InputMethodController.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
index 57512ea51f33318b7f07149afe12fd579b00d387..c161b8cd6533de68460d74e1f8eb994203c72961 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -558,6 +558,32 @@ void InputMethodController::CancelComposition() {
DispatchCompositionEndEvent(GetFrame(), g_empty_string);
}
+void InputMethodController::CancelCompositionIfSelectionIsInvalid() {
+ if (!has_composition_)
+ return;
+
+ /*if (composition_range_)
+ LOG(INFO) << composition_range_->toString();
+ else
+ LOG(INFO) << "null range";
+ if (!HasComposition() || GetEditor().PreventRevealSelection())
+ return;
+
+ // Check if selection start and selection end are valid.
+ FrameSelection& selection = GetFrame().Selection();
+ if (selection.IsAvailable() && !composition_range_->collapsed()) {
+ const SelectionInDOMTree& selection_in_dom = selection.GetSelectionInDOMTree();
+ if (selection_in_dom.Base().CompareTo(composition_range_->StartPosition()) >= 0 &&
+ selection_in_dom.Extent().CompareTo(composition_range_->EndPosition()) <= 0)
+ return;
+
+ }*/
+
+ Clear();
+ GetFrame().GetChromeClient().DidCancelCompositionOnSelectionChange();
+
+}
+
void InputMethodController::SetComposition(
const String& text,
const Vector<CompositionUnderline>& underlines,
« no previous file with comments | « third_party/WebKit/Source/core/editing/InputMethodController.h ('k') | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698