Chromium Code Reviews
DescriptionStraighten up input method reactivation
On Android, if you move focus from one input form to another, and type a
word immediately, then sometimes the original text gets duplicated.
The reason is that currently onCreateInputConnection() provides incorrect
initial sel start and initial sel end values, and this ended up confusing
the keyboard.
The changes here include:
1) Ignore IME-initiated operations until restart input gets ACKed.
Otherwise, IME operations targeted for the previous input form get applied
to the next input form.
This apply both to cancel composition and focused node change scenarios.
For the deprecating ReplicaInputConnection model, we ignored IME-initiated
operations whenever there was renderer-initiated conflict. We dropped the
logic for ThreadedInputConnection model, but I think it’s useful when
we have to restart input, so partially reviving the logic.
2) Update text input states before restarting input method.
When CancelComposition and FocusedNodeChanged messages are sent in the
middle of IME event guard, input method may see an outdated text input
state when restarting input method. Therefore, we bypass IME event guard
and send them immediately in these cases.
3) One problematic case in 2) is that text input states become garbage
in the middle of a focus change. The reason is that VisibleSelection is
not created in FocusController::setFocusedElement, but in a much later
step.
MouseEventManager::handleMouseFocus()
-> FocusController::setFocusedElement()
-> Document::setFocusedElement()
-> RenderViewImpl::focusedNodeChanged()
However, createVisibleSelection() is called in
MouseEventManager::handleMousePressEvent().
One place we could create VisibleSelection was
Document::setFocusedElement()
-> Element::updateFocusAppearance()
If we call the SelectionBehaviorOnFocus::Restore from MouseEventManager,
selection values can be set correctly.
BUG=650204
add logging
Patch Set 1 #Messages
Total messages: 6 (6 generated)
|