| 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 bae3cea1d0ff453dbdafaf3f688cb67b036bec9d..bd98afe18c73a05804450c48113c650c37701c1a 100644
|
| --- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| @@ -71,11 +71,9 @@ void dispatchCompositionEndEvent(LocalFrame& frame, const String& text) {
|
| // Used to insert/replace text during composition update and confirm
|
| // composition.
|
| // Procedure:
|
| -// 1. Fire 'beforeinput' event for (TODO(chongz): deleted composed text) and
|
| -// inserted text
|
| -// 2. Fire 'compositionupdate' event
|
| -// 3. Fire TextEvent and modify DOM
|
| -// TODO(chongz): 4. Fire 'input' event
|
| +// 1. Fire 'compositionupdate' event
|
| +// 2. Use TextEvent or TypingCommand to modify DOM, which will fire
|
| +// 'beforeinput' and 'input'
|
| void insertTextDuringCompositionWithEvents(
|
| LocalFrame& frame,
|
| const String& text,
|
| @@ -93,33 +91,9 @@ void insertTextDuringCompositionWithEvents(
|
| if (!frame.document())
|
| return;
|
|
|
| - Element* target = frame.document()->focusedElement();
|
| - if (!target)
|
| - return;
|
| -
|
| - // TODO(chongz): Fire 'beforeinput' for the composed text being
|
| - // replaced/deleted.
|
| -
|
| - // Only the last confirmed text is cancelable.
|
| - InputEvent::EventCancelable beforeInputCancelable =
|
| - (compositionType ==
|
| - TypingCommand::TextCompositionType::TextCompositionUpdate)
|
| - ? InputEvent::EventCancelable::NotCancelable
|
| - : InputEvent::EventCancelable::IsCancelable;
|
| - DispatchEventResult result = dispatchBeforeInputFromComposition(
|
| - target, InputEvent::InputType::InsertText, text, beforeInputCancelable);
|
| -
|
| - if (beforeInputCancelable == InputEvent::EventCancelable::IsCancelable &&
|
| - result != DispatchEventResult::NotCanceled)
|
| - return;
|
| -
|
| - // 'beforeinput' event handler may destroy document.
|
| - if (!frame.document())
|
| - return;
|
| -
|
| dispatchCompositionUpdateEvent(frame, text);
|
| // 'compositionupdate' event handler may destroy document.
|
| - if (!frame.document())
|
| + if (!frame.document() || frame.document()->frame() != &frame)
|
| return;
|
|
|
| switch (compositionType) {
|
| @@ -138,7 +112,6 @@ void insertTextDuringCompositionWithEvents(
|
| default:
|
| NOTREACHED();
|
| }
|
| - // TODO(chongz): Fire 'input' event.
|
| }
|
|
|
| AtomicString getInputModeAttribute(Element* element) {
|
| @@ -339,9 +312,6 @@ bool InputMethodController::replaceCompositionAndMoveCaret(
|
| }
|
|
|
| bool InputMethodController::insertText(const String& text) {
|
| - if (dispatchBeforeInputInsertText(document().focusedElement(), text) !=
|
| - DispatchEventResult::NotCanceled)
|
| - return false;
|
| editor().insertText(text, 0);
|
| return true;
|
| }
|
| @@ -374,11 +344,6 @@ void InputMethodController::cancelComposition() {
|
|
|
| clear();
|
|
|
| - // TODO(chongz): Figure out which InputType should we use here.
|
| - dispatchBeforeInputFromComposition(
|
| - document().focusedElement(),
|
| - InputEvent::InputType::DeleteComposedCharacterBackward, nullAtom,
|
| - InputEvent::EventCancelable::NotCancelable);
|
| dispatchCompositionUpdateEvent(frame(), emptyString());
|
| insertTextDuringCompositionWithEvents(
|
| frame(), emptyString(), 0,
|
| @@ -915,10 +880,6 @@ void InputMethodController::extendSelectionAndDelete(int before, int after) {
|
| ++before;
|
| } while (frame().selection().start() == frame().selection().end() &&
|
| before <= static_cast<int>(selectionOffsets.start()));
|
| - // TODO(chongz): Find a way to distinguish Forward and Backward.
|
| - dispatchBeforeInputEditorCommand(
|
| - document().focusedElement(), InputEvent::InputType::DeleteContentBackward,
|
| - new RangeVector(1, m_frame->selection().firstRange()));
|
| TypingCommand::deleteSelection(document());
|
| }
|
|
|
|
|