Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1843)

Issue 2568093003: Support parsing BackgroundSpans and UnderlineSpans in Android IME's commitText() (Closed)

Created:
4 years ago by rlanday
Modified:
3 years, 11 months ago
CC:
agrieve+watch_chromium.org, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, dglazkov+blink, einbinder+watch-test-runner_chromium.org, jam, jochen+watch_chromium.org, kinuko+watch, mlamouri+watch-content_chromium.org, mlamouri+watch-test-runner_chromium.org, nasko+codewatch_chromium.org, pfeldman, yosin_UTC9
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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} Committed: https://chromium.googlesource.com/chromium/src/+/7efe230106176ba759388532a0993f0f0bef67d8

Patch Set 1 #

Patch Set 2 : Fix some stuff breaking Linux builds #

Total comments: 1

Patch Set 3 : Don't try to add default underline for commitText(), attempt to fix Mac builds #

Total comments: 1

Patch Set 4 : Fix commitText() logic (I think) #

Total comments: 4

Patch Set 5 : Use rootEditableElement(), add test case #

Patch Set 6 : fix test case #

Patch Set 7 : Attempt to fix dependency error with target #

Total comments: 2

Patch Set 8 : Fix header include #

Total comments: 1

Patch Set 9 : Fix bug I introduced trying to use rootEditableElement for all underline code #

Patch Set 10 : Remove a logging statement accidentally left in #

Patch Set 11 : Rebase #

Total comments: 7

Patch Set 12 : Use addCompositionUnderlines() where I said I couldn't #

Unified diffs Side-by-side diffs Delta from patch set Stats (+313 lines, -136 lines) Patch
M components/test_runner/text_input_controller.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/browser_plugin/browser_plugin_guest.h View 1 chunk +5 lines, -3 lines 0 comments Download
M content/browser/browser_plugin/browser_plugin_guest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -4 lines 0 comments Download
M content/browser/renderer_host/ime_adapter_android.h View 3 chunks +16 lines, -3 lines 0 comments Download
M content/browser/renderer_host/ime_adapter_android.cc View 1 2 5 chunks +28 lines, -10 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -3 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +7 lines, -5 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_widget_host_view_mac.mm View 1 2 3 4 5 6 7 8 9 10 2 chunks +5 lines, -2 lines 0 comments Download
M content/common/browser_plugin/browser_plugin_messages.h View 1 chunk +6 lines, -4 lines 0 comments Download
M content/common/input_messages.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -4 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java View 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin.h View 1 chunk +4 lines, -2 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +13 lines, -3 lines 0 comments Download
M content/renderer/pepper/pepper_plugin_instance_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -2 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/render_view_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +10 lines, -4 lines 0 comments Download
M content/renderer/render_widget.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -3 lines 0 comments Download
M content/renderer/render_widget.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +7 lines, -4 lines 0 comments Download
M content/renderer/render_widget_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/InputMethodController.h View 1 2 3 4 2 chunks +17 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/editing/InputMethodController.cpp View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +48 lines, -31 lines 0 comments Download
M third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp View 1 2 3 4 5 6 7 8 9 9 chunks +60 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/web/WebInputMethodControllerImpl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +8 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebViewTest.cpp View 1 2 3 4 5 6 7 8 9 10 17 chunks +30 lines, -21 lines 0 comments Download
M third_party/WebKit/public/web/WebInputMethodController.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/public/web/WebPlugin.h View 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 82 (54 generated)
rlanday
pfeldman, I'm adding you as a reviewer since you own these files: components/test_runner/text_input_controller.cc content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.h ...
4 years ago (2016-12-13 02:32:01 UTC) #3
rlanday
https://codereview.chromium.org/2568093003/diff/20001/content/browser/renderer_host/ime_adapter_android.cc File content/browser/renderer_host/ime_adapter_android.cc (right): https://codereview.chromium.org/2568093003/diff/20001/content/browser/renderer_host/ime_adapter_android.cc#newcode356 content/browser/renderer_host/ime_adapter_android.cc:356: underlines.push_back(blink::WebCompositionUnderline( Actually I think we probably don't want this ...
4 years ago (2016-12-14 00:04:53 UTC) #12
aelias_OOO_until_Jul13
Adding yutak@ for Source/core/editing OWNERS (and cc yosin@ who is on vacation for the month). ...
4 years ago (2016-12-14 00:50:39 UTC) #14
rlanday
On 2016/12/14 at 00:50:39, aelias wrote: > Adding yutak@ for Source/core/editing OWNERS (and cc yosin@ ...
4 years ago (2016-12-14 18:55:14 UTC) #19
rlanday
I suspect the code for adding the underlines in commitText() is buggy, currently investigating
4 years ago (2016-12-15 02:12:17 UTC) #20
Yuta Kitamura
Blink/core LGTM Changes in Blink look reasonable to me, but ccing tkent@ for extra eyes.
4 years ago (2016-12-15 09:29:53 UTC) #21
dcheng
ipc lgtm https://codereview.chromium.org/2568093003/diff/40001/content/renderer/render_widget.cc File content/renderer/render_widget.cc (right): https://codereview.chromium.org/2568093003/diff/40001/content/renderer/render_widget.cc#newcode1555 content/renderer/render_widget.cc:1555: controller->commitText(text, WebVector<WebCompositionUnderline>(underlines), I think the explicit call ...
4 years ago (2016-12-15 10:13:17 UTC) #22
tkent
On 2016/12/15 at 09:29:53, yutak wrote: > Blink/core LGTM > > Changes in Blink look ...
4 years ago (2016-12-16 00:52:40 UTC) #23
rlanday
I fixed the logic enough that when I draw the SuggestionSpans from the Voice IME ...
4 years ago (2016-12-16 20:55:34 UTC) #27
rlanday
https://codereview.chromium.org/2568093003/diff/60001/third_party/WebKit/Source/core/editing/InputMethodController.cpp File third_party/WebKit/Source/core/editing/InputMethodController.cpp (right): https://codereview.chromium.org/2568093003/diff/60001/third_party/WebKit/Source/core/editing/InputMethodController.cpp#newcode368 third_party/WebKit/Source/core/editing/InputMethodController.cpp:368: addCompositionUnderlines(underlines, rootEditableElement, textStart); On 2016/12/16 at 20:55:33, rlanday wrote: ...
4 years ago (2016-12-16 21:01:35 UTC) #28
rlanday
After talking to aelias, I unified all the underline-adding code to use rootEditableElement() instead of ...
4 years ago (2016-12-17 03:08:40 UTC) #37
rlanday
Apparently the test case doesn't like depending on DocumentMethodController. Using it requires me to add ...
4 years ago (2016-12-19 19:42:04 UTC) #44
Yuta Kitamura
On 2016/12/19 19:42:04, rlanday wrote: > Apparently the test case doesn't like depending on DocumentMethodController. ...
4 years ago (2016-12-20 05:28:20 UTC) #45
rlanday
On 2016/12/20 at 05:28:20, yutak wrote: > On 2016/12/19 19:42:04, rlanday wrote: > > Apparently ...
4 years ago (2016-12-20 05:55:57 UTC) #46
Yuta Kitamura
> I’m trying to use this file: > third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h > > from this file: > ...
4 years ago (2016-12-20 07:09:14 UTC) #47
rlanday
On 2016/12/20 at 07:09:14, yutak wrote: > Regarding the link error, you probably need to ...
4 years ago (2016-12-20 18:50:59 UTC) #48
rlanday
Something is not right here; this is breaking highlighting in the Japanese input IME...
4 years ago (2016-12-20 19:42:35 UTC) #51
rlanday
https://codereview.chromium.org/2568093003/diff/120001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp File third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp (right): https://codereview.chromium.org/2568093003/diff/120001/third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp#newcode19 third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp:19: #include "third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h" On 2016/12/20 at 07:09:14, Yuta Kitamura wrote: ...
4 years ago (2016-12-20 20:34:43 UTC) #52
rlanday
aelias + pfeldman, does this look good? My current plan is still to pass the ...
3 years, 11 months ago (2017-01-09 21:55:17 UTC) #63
aelias_OOO_until_Jul13
https://codereview.chromium.org/2568093003/diff/200001/content/browser/renderer_host/ime_adapter_android.cc File content/browser/renderer_host/ime_adapter_android.cc (right): https://codereview.chromium.org/2568093003/diff/200001/content/browser/renderer_host/ime_adapter_android.cc#newcode170 content/browser/renderer_host/ime_adapter_android.cc:170: void ImeAdapterAndroid::CommitText(JNIEnv* env, On 2017/01/09 at 21:55:17, rlanday wrote: ...
3 years, 11 months ago (2017-01-10 01:45:35 UTC) #64
rlanday
https://codereview.chromium.org/2568093003/diff/200001/content/browser/renderer_host/ime_adapter_android.cc File content/browser/renderer_host/ime_adapter_android.cc (right): https://codereview.chromium.org/2568093003/diff/200001/content/browser/renderer_host/ime_adapter_android.cc#newcode170 content/browser/renderer_host/ime_adapter_android.cc:170: void ImeAdapterAndroid::CommitText(JNIEnv* env, On 2017/01/10 at 01:45:35, aelias wrote: ...
3 years, 11 months ago (2017-01-10 05:02:18 UTC) #65
rlanday
https://codereview.chromium.org/2568093003/diff/200001/third_party/WebKit/Source/core/editing/InputMethodController.cpp File third_party/WebKit/Source/core/editing/InputMethodController.cpp (right): https://codereview.chromium.org/2568093003/diff/200001/third_party/WebKit/Source/core/editing/InputMethodController.cpp#newcode618 third_party/WebKit/Source/core/editing/InputMethodController.cpp:618: // Can't use addCompositionUnderlines here because the ranges are ...
3 years, 11 months ago (2017-01-10 19:25:10 UTC) #68
aelias_OOO_until_Jul13
https://codereview.chromium.org/2568093003/diff/200001/content/browser/renderer_host/ime_adapter_android.cc File content/browser/renderer_host/ime_adapter_android.cc (right): https://codereview.chromium.org/2568093003/diff/200001/content/browser/renderer_host/ime_adapter_android.cc#newcode170 content/browser/renderer_host/ime_adapter_android.cc:170: void ImeAdapterAndroid::CommitText(JNIEnv* env, On 2017/01/10 at 05:02:17, rlanday wrote: ...
3 years, 11 months ago (2017-01-10 21:46:30 UTC) #73
aelias_OOO_until_Jul13
Adding fsamuel@ for OWNERS of trivial changes in content/browser/browser_plugin/ and content_common/browser_plugin/. (I think this should ...
3 years, 11 months ago (2017-01-10 21:47:33 UTC) #74
aelias_OOO_until_Jul13
lgtm for content/renderer, Source/web, content/browser/renderer_host/
3 years, 11 months ago (2017-01-10 21:48:32 UTC) #75
Fady Samuel
browser_plugin lgtm
3 years, 11 months ago (2017-01-10 21:55:59 UTC) #76
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2568093003/220001
3 years, 11 months ago (2017-01-10 23:36:00 UTC) #79
commit-bot: I haz the power
3 years, 11 months ago (2017-01-11 00:15:17 UTC) #82
Message was sent while issue was closed.
Committed patchset #12 (id:220001) as
https://chromium.googlesource.com/chromium/src/+/7efe230106176ba759388532a099...

Powered by Google App Engine
This is Rietveld 408576698