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

Issue 2333813002: Introduce WebInputMethodController to blink (Closed)

Created:
4 years, 3 months ago by EhsanK
Modified:
4 years, 1 month ago
CC:
aelias_OOO_until_Jul13, blink-reviews, blink-reviews-api_chromium.org, Changwan Ryu, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, jam, kinuko+watch, mlamouri+watch-blink_chromium.org, mlamouri+watch-content_chromium.org, yabinh, kojii
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce WebInputMethodController to blink Input method editing is currently handled by WebWidget which has almost fully duplicate code in both WebFrameWidgetImpl and WebViewImpl. The code duplication on one hand, and the reliance of all IME results on the frame level objects such as InputMethodController, FrameSelection, etc. on the other hand gave rise to proposing a refactoring to include most of such IME code in a separate class owned by a WebLocalFrameImpl. The WebInputMethodController is intended to become a wrapper class around the blink::InputMethodController (and more) to expose the required APIs for WebKit embedders using IME and text input. It will implement the logic in text and IME related methods in WebWidget and possibly removes those from WebWidget altogether. This patch, specifically, implements the following WebWidget methods: setComposition() commitText() finishComposingText() Design document (Google.com access): https://docs.google.com/a/google.com/document/d/1okeoZVyUZqc8z7oSIPiu-k6zKI0eLYQ9S9c4lgqpzn8/edit?usp=sharing (Chromium.org access): https://docs.google.com/document/d/13Nidlg5yIsxQRqXgBPqmb-KcT8q85Z1ds9Z1-Vo1XQQ/edit?usp=sharing BUG=629721 Committed: https://crrev.com/2daaf676340283726a05cb1b387a9ff328e020e8 Cr-Commit-Position: refs/heads/master@{#431340}

Patch Set 1 : Introduce WebInputMethodController to blink #

Total comments: 1

Patch Set 2 : Removed an unsued enum form WebInputMethodController #

Total comments: 7

Patch Set 3 : Addressing lfg@'s comments #

Patch Set 4 : Removed setComposition, commitText, and finishComposing from Web*Widget and WebView*" #

Patch Set 5 : Moved ConfirmCompositionBehavior to WebInputMethodController #

Total comments: 26

Patch Set 6 : Addressing lfg@ and changewan@ comments #

Patch Set 7 : Removed an empty line #

Patch Set 8 : Replacing the angry copyright with the shorter one. #

Total comments: 4

Patch Set 9 : KeepSelection -> DoNotKeepSelection #

Patch Set 10 : Rebased #

Patch Set 11 : Rebased: touch-up #

Patch Set 12 : inputMethodController() -> activeInputMethodController() #

Patch Set 13 : Updated a comment #

Total comments: 8

Patch Set 14 : Rebased #

Patch Set 15 : Addressing lfg@'s Comments #

Patch Set 16 : Addressing dglazkov@'s comments #

Patch Set 17 : Fixed a compile error #

Patch Set 18 : Explicitly asking for TextInputState updates #

Total comments: 6

Patch Set 19 : Addressing creis@'s comments #

Patch Set 20 : Rebased #

Patch Set 21 : Removing unnecessary #includes #

Patch Set 22 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+551 lines, -364 lines) Patch
M components/test_runner/text_input_controller.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +4 lines, -0 lines 0 comments Download
M components/test_runner/text_input_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 7 chunks +31 lines, -7 lines 0 comments Download
M components/test_runner/web_test_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +5 lines, -1 line 0 comments Download
M components/test_runner/web_view_test_proxy.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -1 line 0 comments Download
M components/test_runner/web_widget_test_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -1 line 0 comments Download
M components/test_runner/web_widget_test_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +0 lines, -8 lines 0 comments Download
M components/test_runner/web_widget_test_proxy.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -1 line 0 comments Download
M content/public/test/layouttest_support.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/browser_plugin/browser_plugin.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +3 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 11 12 13 1 chunk +4 lines, -2 lines 0 comments Download
M content/renderer/render_widget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +7 lines, -0 lines 0 comments Download
M content/renderer/render_widget.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 7 chunks +26 lines, -6 lines 0 comments Download
M content/renderer/render_widget_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +5 lines, -1 line 0 comments Download
M content/shell/renderer/layout_test/blink_test_runner.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +2 lines, -0 lines 0 comments Download
M content/shell/renderer/layout_test/blink_test_runner.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +4 lines, -0 lines 0 comments Download
M content/test/layouttest_support.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +9 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/composition-event-source-device-event-sender.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +10 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/WebFrameWidgetImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +4 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +7 lines, -95 lines 0 comments Download
A third_party/WebKit/Source/web/WebInputMethodControllerImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +61 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +146 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/WebLocalFrameImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/WebLocalFrameImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewFrameWidget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewFrameWidget.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +6 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +6 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/web/WebViewImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +7 lines, -94 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebViewTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 44 chunks +126 lines, -67 lines 0 comments Download
M third_party/WebKit/public/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebFrameWidget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +8 lines, -0 lines 0 comments Download
A third_party/WebKit/public/web/WebInputMethodController.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +47 lines, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebPlugin.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/public/web/WebView.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -3 lines 0 comments Download
M third_party/WebKit/public/web/WebWidget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +0 lines, -31 lines 0 comments Download

Messages

Total messages: 112 (74 generated)
EhsanK
dcheng@, dglazkov@: Could you please take a look at this change? I tried to keep ...
4 years, 3 months ago (2016-09-14 18:55:27 UTC) #36
EhsanK
Adding lfg@ since this eventually contributes to WebView and WebWidget split. lfg@: Could you please ...
4 years, 3 months ago (2016-09-14 19:02:17 UTC) #38
lfg
Some initial comments. Also, can you move your design doc to a chromium.org account and ...
4 years, 3 months ago (2016-09-14 19:20:26 UTC) #39
EhsanK
Thanks Lucas! I will submit another patch which takes care of removing those IME methods ...
4 years, 3 months ago (2016-09-16 15:06:29 UTC) #42
lfg
https://codereview.chromium.org/2333813002/diff/170001/third_party/WebKit/Source/web/WebViewImpl.h File third_party/WebKit/Source/web/WebViewImpl.h (right): https://codereview.chromium.org/2333813002/diff/170001/third_party/WebKit/Source/web/WebViewImpl.h#newcode525 third_party/WebKit/Source/web/WebViewImpl.h:525: WebInputMethodControllerImpl* getActiveWebInputMethodController() const; On 2016/09/16 15:06:28, EhsanK wrote: > ...
4 years, 3 months ago (2016-09-16 15:11:30 UTC) #43
EhsanK
Thanks Lucas! PTAL.
4 years, 3 months ago (2016-09-16 19:01:18 UTC) #46
lfg
Thanks! Looking much better with all the deleted code duplication. Another round of comments. https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc ...
4 years, 3 months ago (2016-09-16 20:17:10 UTC) #47
esprehn
FYI, please use the short copyright on all new files that old one is huge. ...
4 years, 3 months ago (2016-09-16 21:21:28 UTC) #48
Changwan Ryu
https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp File third_party/WebKit/Source/web/WebLocalFrameImpl.cpp (left): https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp#oldcode1252 third_party/WebKit/Source/web/WebLocalFrameImpl.cpp:1252: void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) Hmm... Sorry for my ...
4 years, 3 months ago (2016-09-19 02:08:36 UTC) #50
EhsanK
Thanks for the reviews! PTAL I am also adding aelias@ as a reviewer to kindly ...
4 years, 3 months ago (2016-09-20 15:38:30 UTC) #52
aelias_OOO_until_Jul13
https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc File components/test_runner/web_widget_test_client.cc (right): https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc#newcode124 components/test_runner/web_widget_test_client.cc:124: blink::WebWidget::KeepSelection); On 2016/09/20 at 15:38:29, EhsanK wrote: > On ...
4 years, 3 months ago (2016-09-21 08:28:03 UTC) #53
Changwan Ryu
https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp File third_party/WebKit/Source/web/WebLocalFrameImpl.cpp (left): https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp#oldcode1252 third_party/WebKit/Source/web/WebLocalFrameImpl.cpp:1252: void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) Hmm... Thanks for adding ...
4 years, 3 months ago (2016-09-21 08:42:04 UTC) #54
EhsanK
Thanks! PTAL. https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp File third_party/WebKit/Source/web/WebLocalFrameImpl.cpp (left): https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp#oldcode1252 third_party/WebKit/Source/web/WebLocalFrameImpl.cpp:1252: void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) On 2016/09/21 ...
4 years, 3 months ago (2016-09-21 16:49:10 UTC) #55
lfg
https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc File components/test_runner/web_widget_test_client.cc (right): https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc#newcode124 components/test_runner/web_widget_test_client.cc:124: blink::WebWidget::KeepSelection); On 2016/09/21 08:28:02, aelias wrote: > On 2016/09/20 ...
4 years, 3 months ago (2016-09-21 16:56:14 UTC) #56
Changwan Ryu
https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp File third_party/WebKit/Source/web/WebLocalFrameImpl.cpp (left): https://codereview.chromium.org/2333813002/diff/230001/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp#oldcode1252 third_party/WebKit/Source/web/WebLocalFrameImpl.cpp:1252: void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) On 2016/09/21 16:49:10, EhsanK ...
4 years, 3 months ago (2016-09-21 23:33:16 UTC) #57
EhsanK
Please, take another look. https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc File components/test_runner/web_widget_test_client.cc (right): https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc#newcode124 components/test_runner/web_widget_test_client.cc:124: blink::WebWidget::KeepSelection); On 2016/09/21 16:56:14, lfg ...
4 years, 2 months ago (2016-09-26 20:54:29 UTC) #60
lfg
https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc File components/test_runner/web_widget_test_client.cc (right): https://codereview.chromium.org/2333813002/diff/230001/components/test_runner/web_widget_test_client.cc#newcode124 components/test_runner/web_widget_test_client.cc:124: blink::WebWidget::KeepSelection); On 2016/09/26 20:54:29, EhsanK wrote: > On 2016/09/21 ...
4 years, 2 months ago (2016-09-29 14:16:41 UTC) #63
dglazkov
lgtm % nits https://codereview.chromium.org/2333813002/diff/390001/content/renderer/render_widget.cc File content/renderer/render_widget.cc (right): https://codereview.chromium.org/2333813002/diff/390001/content/renderer/render_widget.cc#newcode1420 content/renderer/render_widget.cc:1420: if (!GetInputMethodController() || this can be ...
4 years, 2 months ago (2016-10-06 22:18:59 UTC) #64
EhsanK
Thanks lfg@ and dglazkov@ for the reviews! Adding dtapuska@ since he is also working on ...
4 years, 1 month ago (2016-11-01 15:46:05 UTC) #72
lfg
Thanks for digging into it! This looks like a much cleaner solution. LGTM!
4 years, 1 month ago (2016-11-01 15:51:06 UTC) #73
lanwei
third_party/WebKit/LayoutTests/fast/events/composition-event-source-device-event-sender.html LGTM!
4 years, 1 month ago (2016-11-01 15:58:54 UTC) #74
EhsanK
Thanks for reviews! I had to modify the test yet again since on Mac even ...
4 years, 1 month ago (2016-11-02 19:34:00 UTC) #81
lfg
still lgtm
4 years, 1 month ago (2016-11-02 19:36:26 UTC) #82
EhsanK
Adding tommyw@ for changes in components/test_runner/ Adding creis@ for changes in content/ Please, take a ...
4 years, 1 month ago (2016-11-02 19:40:34 UTC) #84
Charlie Reis
content/ generally looks good, but there's one security bug we should fix (bad cast). https://codereview.chromium.org/2333813002/diff/490001/content/public/test/layouttest_support.h ...
4 years, 1 month ago (2016-11-02 20:57:38 UTC) #85
EhsanK
Thanks Charlie! PTAL. Also leaving one question from lfg@ regarding the DCHECK/CHECK comment on RenderWidget::GetInputMethodController(). ...
4 years, 1 month ago (2016-11-02 22:16:34 UTC) #86
EhsanK
Thanks Charlie! PTAL. Also leaving one question from lfg@ regarding the DCHECK/CHECK comment on RenderWidget::GetInputMethodController().
4 years, 1 month ago (2016-11-02 22:16:38 UTC) #87
lfg
On 2016/11/02 22:16:34, EhsanK wrote: > On 2016/11/02 20:57:38, Charlie Reis wrote: > > This ...
4 years, 1 month ago (2016-11-02 22:20:21 UTC) #88
Charlie Reis
Thanks! content/ LGTM.
4 years, 1 month ago (2016-11-02 22:25:22 UTC) #89
dtapuska
On 2016/11/02 22:25:22, Charlie Reis wrote: > Thanks! content/ LGTM. lgtm
4 years, 1 month ago (2016-11-03 15:28:32 UTC) #90
EhsanK
Adding rbyres@ for general reviews and components/test_runner/* permissions since tommyw@ is OOO. rbyres@, could you ...
4 years, 1 month ago (2016-11-09 15:46:59 UTC) #96
Rick Byers
On 2016/11/09 15:46:59, EhsanK wrote: > Adding rbyres@ for general reviews and components/test_runner/* permissions > ...
4 years, 1 month ago (2016-11-10 17:16:00 UTC) #97
EhsanK
Thank you all for the reviews. cc-ed kojii@ and haraken@ since this is both blink ...
4 years, 1 month ago (2016-11-10 17:21:59 UTC) #99
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/2333813002/570001
4 years, 1 month ago (2016-11-10 19:05:46 UTC) #105
commit-bot: I haz the power
Committed patchset #22 (id:570001)
4 years, 1 month ago (2016-11-10 20:29:45 UTC) #107
commit-bot: I haz the power
Patchset 22 (id:??) landed as https://crrev.com/2daaf676340283726a05cb1b387a9ff328e020e8 Cr-Commit-Position: refs/heads/master@{#431340}
4 years, 1 month ago (2016-11-10 20:44:45 UTC) #109
haraken
On 2016/11/10 17:21:59, EhsanK wrote: > Thank you all for the reviews. > > cc-ed ...
4 years, 1 month ago (2016-11-11 02:03:05 UTC) #110
dcheng
4 years, 1 month ago (2016-11-11 07:52:15 UTC) #111
Message was sent while issue was closed.
On 2016/11/02 22:20:21, lfg wrote:
> On 2016/11/02 22:16:34, EhsanK wrote:
> > On 2016/11/02 20:57:38, Charlie Reis wrote:
> > > This can't be a DCHECK, since we'll get a potentially exploitable bad cast
> in
> > > release builds if it's wrong.  Make it a CHECK (preferable if we don't
think
> > it
> > > can fail) or return early if it fails.
> > 
> > I see. Thanks! I don't think we can have a WebWidget which is
WebFrameWidget.
> > But I think lfg@ was mentioning a case this could have happened?
> > 
> > For now I made it a CHECK. lfg@ WDYT?
> 
> This would only fail if this function was called on a swapped out RenderView.
> CHECK is fine, it shouldn't happen.

Btw I missed this earlier, but this shouldn't be a CHECK: see the guidelines on
https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md...

Here, we're documenting a precondition of calling this function: if we violate
this precondition, either the renderer already has arbitrary code execution or
we have a bug in our calling code. Per the guidelines, that means this short of
thing should be a DCHECK (as a CHECK has somewhat higher cost).

Powered by Google App Engine
This is Rietveld 408576698