| 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,
|
|
|