Description[reland, refactor] - Move textInputInfo() and textInputType() from WebWidget to WebInputMethodController
This CL tries to reland the original CL https://codereview.chromium.org/2508363003
which was reverted since it was making WebViewInteractiveTest.Focus_FocusRestored
flake.
The issue in the initial attempt was that
WebFrameWidget::getActiveInputMethodController() would return nullptr when the
WebFrameWidget did not have page focus (m_imeAcceptEvents == false). This
assumption is not correct and resulted into reporting
ui::TEXT_INPUT_TYPE_NONE for TextInputState right after losing page focus, e.g.,
by moving focus from a <webview> to its embedder (in the reverted CL).
On the other hand, when WebFrameWidget does not have page focus, any IME calls
received from browser should be dropped. Specifically, by not doing so, a call
to WebInputMethodController::finishComposingText would lead to a second commit
for the last ongoing composition. This happens when switching tabs or moving
focus to another WebFrameWidget in OOPIFs. Returning nullptr for active
controller was used as the solution to this problem in the original CL that
landed WebInputMethodController (https://codereview.chromium.org/2333813002/).
This is however incorrect since an unfocused WebFrameWidget could still have
IME state such as TextInputState.
The new attempt will reland the reverted CL and fix the issues by:
1- Returning WebInputMethodController iff there is a focused local frame
inside WebFrameWidget. Page focus will not affect this value.
2- Will not process IME events if RenderWidget::has_focus_ is false. This
is achieved by adding a new method ShouldHandleImeEvents() which will
return false when there is no WebFrameWidget or page focus.
This CL also adds a RenderWidgetTest to prevent future regressions of this kind.
BUG=629721
Review-Url: https://codereview.chromium.org/2608293002
Cr-Commit-Position: refs/heads/master@{#441788}
Committed: https://chromium.googlesource.com/chromium/src/+/5aff1941d0f7a2a68e07fd000592de295944fcea
Patch Set 1 : Original #Patch Set 2 : Rebased #Patch Set 3 : Applied the fix. #
Total comments: 8
Patch Set 4 : Addressing wjmaclean@'s comments #Messages
Total messages: 22 (13 generated)
|