New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 673491 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocked on:
issue 676445

Blocking:
issue 672259



Sign in to add a comment

commitText() doesn't parse Android spans

Project Member Reported by rlanday@chromium.org, Dec 12 2016

Issue description

ThreadedInputConnection is wired up (in ime_adapter_android.cc) to parse BackgroundSpans and UnderlineSpans from text only when it's passed in through setComposingText(). We need to add support for SuggestionSpans for the Android voice IME, which uses commitText(), so the span parsing code needs to be consolidated.

Documentation for commitText():
"This behaves like calling setComposingText(text, newCursorPosition) then finishComposingText()."

https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#commitText(java.lang.CharSequence, int)

 

Comment 1 by aelias@chromium.org, Dec 12 2016

Cc: changwan@chromium.org
Summary: commitText() doesn't parse Android spans (was: Asymmetry between setComposingText() and commitText() on ThreadedInputConnection)
Blockedon: 676445
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7efe230106176ba759388532a0993f0f0bef67d8

commit 7efe230106176ba759388532a0993f0f0bef67d8
Author: rlanday <rlanday@chromium.org>
Date: Wed Jan 11 00:14:28 2017

Support parsing BackgroundSpans and UnderlineSpans in Android IME's commitText()

Android InputConnection has two related methods

- setComposingText() replaces the current compose region with a given piece of
  text and sets a composing span around the new text

- commitText() replaces the text the same way but then closes out the compose
  region instead of putting it around the new text.

Support was added for parsing BackgroundSpan and UnderlineSpan annotations in
setComposingText() to support the Google Japanese Input IME (newly entered text
in the compose region is underlined and highlighted in a blue background).

The Android Voice IME instead uses commitText() because it wants the highlighted
regions to persist after the compose region is closed out. Closing out the
compose region after calling setComposingText() would clear the highlight
regions. So to support this, we need to parse the spans for commitText() in
ImeAdapterAndroid just as we do for setComposingText(), and also thread this
information all the way back to InputMethodController as we do for
setComposingText().

I tested this by forwarding calls of setComposingText() to commitText() and
verifying that highlighting works for the Google Japanese IME. It's highlighting
the character immediately ahead of the insertion point instead of the newly
typed character when I do this; I suspect this may be because the IME is
expecting something about the setComposingText() behavior (e.g. the compose
range) that's different in commitText(), but it's also possible I have a bug in
the new logic.

Once I write some code to start parsing out SuggestionSpans from the Voice IME,
I'll be able to test this better (I might be able to get this done tomorrow).

BUG= 673491 

Review-Url: https://codereview.chromium.org/2568093003
Cr-Commit-Position: refs/heads/master@{#442738}

[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/components/test_runner/text_input_controller.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/browser_plugin/browser_plugin_guest.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/browser_plugin/browser_plugin_guest.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/renderer_host/ime_adapter_android.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/renderer_host/ime_adapter_android.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/renderer_host/render_widget_host_impl.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/renderer_host/render_widget_host_impl.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/renderer_host/render_widget_host_view_aura.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/browser/renderer_host/render_widget_host_view_mac.mm
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/common/browser_plugin/browser_plugin_messages.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/common/input_messages.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/browser_plugin/browser_plugin.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/browser_plugin/browser_plugin.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/pepper/pepper_plugin_instance_impl.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/render_frame_impl.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/render_frame_impl.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/render_view_browsertest.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/render_widget.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/render_widget.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/content/renderer/render_widget_browsertest.cc
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/Source/core/editing/InputMethodController.cpp
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/Source/core/editing/InputMethodController.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/Source/web/WebInputMethodControllerImpl.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/Source/web/tests/WebViewTest.cpp
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/public/web/WebInputMethodController.h
[modify] https://crrev.com/7efe230106176ba759388532a0993f0f0bef67d8/third_party/WebKit/public/web/WebPlugin.h

Status: Fixed (was: Assigned)

Sign in to add a comment