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

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)

Created:
4 years ago by Jinsuk Kim
Modified:
3 years, 9 months ago
Reviewers:
boliu
CC:
agrieve+watch_chromium.org, alokp+watch_chromium.org, android-webview-reviews_chromium.org, chromium-reviews, darin-cc_chromium.org, donnd+watch_chromium.org, feature-vr-reviews_chromium.org, halliwell+watch_chromium.org, jam, jochen+watch_chromium.org, lcwu+watch_chromium.org, mdjones+watch_chromium.org, mlamouri+watch-content_chromium.org, Peter Beverloo, aelias_OOO_until_Jul13
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce ViewRoot forwarding input/view events to native This CL introduces a new interface ViewRoot to forward Java view/input events down to native with a view to replacing the flow through ContentViewCore eventually. In native side ViewRoot is a subclass of ViewAndroid. It acts as the root of a ViewAndroid tree, and receives touch/view events from embedders. It has a reference to WindowAndroid, and paritially takes over the role it played as the tree root. Therefore WindowAndroid no longer inherits from ViewAndroid. It effectively reverts https://crrev.com/2136373002. ViewRoot is mapped 1:1 to WindowAndroid and shared across all the contents. WebView is an exception where all activities share the WA instance. ViewRoot, ViewAndroid, and ViewClient are put together to adopt the pattern "chain of responsibility" dispatching the events to the classes implementing |ViewClient| along the view hierarchy, and conditionally stopping the processing when required. BUG=671401

Patch Set 1 : tests #

Total comments: 35

Patch Set 2 : addressed comments #

Total comments: 30

Patch Set 3 : updateViewRoot, ... #

Total comments: 27

Patch Set 4 : view_root.java_obj_... #

Patch Set 5 : onTouchEvent #

Patch Set 6 : rebased & ViewAndroud::Bounds #

Total comments: 6

Patch Set 7 : unittest #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1124 lines, -230 lines) Patch
M android_webview/java/src/org/chromium/android_webview/AwContents.java View 1 2 3 4 5 6 6 chunks +13 lines, -5 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java View 1 2 3 4 5 6 6 chunks +16 lines, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java View 1 2 3 4 5 6 3 chunks +5 lines, -5 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java View 1 2 3 4 3 chunks +6 lines, -5 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java View 1 2 3 4 5 6 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java View 1 2 3 4 5 6 4 chunks +6 lines, -6 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java View 1 2 3 4 5 6 12 chunks +32 lines, -20 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java View 1 2 3 4 7 chunks +9 lines, -9 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java View 1 2 3 4 5 6 7 chunks +21 lines, -9 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/FullScreenActivity.java View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java View 1 2 2 chunks +4 lines, -1 line 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java View 1 2 3 4 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorObserverTestBase.java View 1 2 3 4 3 chunks +4 lines, -2 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorTabObserverTest.java View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/android/compositor/compositor_view.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/android/compositor/compositor_view.cc View 1 2 3 4 4 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_compositor.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_compositor.cc View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_shell.h View 1 2 3 4 5 6 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_shell.cc View 1 2 3 4 5 6 2 chunks +8 lines, -8 lines 0 comments Download
M chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsActivity.java View 1 2 3 4 4 chunks +6 lines, -2 lines 0 comments Download
M content/browser/android/content_view_core_impl.h View 1 2 3 4 5 6 2 chunks +14 lines, -3 lines 0 comments Download
M content/browser/android/content_view_core_impl.cc View 1 2 3 4 5 6 7 chunks +42 lines, -19 lines 0 comments Download
M content/browser/android/content_view_render_view.h View 1 2 3 4 3 chunks +6 lines, -2 lines 0 comments Download
M content/browser/android/content_view_render_view.cc View 1 2 3 4 3 chunks +7 lines, -7 lines 0 comments Download
M content/browser/renderer_host/compositor_impl_android.h View 1 2 3 4 4 chunks +8 lines, -3 lines 0 comments Download
M content/browser/renderer_host/compositor_impl_android.cc View 1 2 3 4 5 6 9 chunks +20 lines, -18 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_android.h View 1 2 3 4 5 6 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_android.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/web_contents/web_contents_view_android.h View 1 2 3 4 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/web_contents/web_contents_view_android.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java View 1 2 3 4 5 6 11 chunks +35 lines, -13 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java View 1 2 3 4 4 chunks +7 lines, -7 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/common/ContentSwitches.java View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M content/public/browser/android/compositor.h View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M content/public/common/content_switches.cc View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M content/shell/android/browsertests/src/org/chromium/content_shell/browsertests/ContentShellBrowserTestActivity.java View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M content/shell/android/java/src/org/chromium/content_shell/Shell.java View 1 2 3 4 5 chunks +6 lines, -7 lines 0 comments Download
M content/shell/android/java/src/org/chromium/content_shell/ShellManager.java View 1 2 3 4 4 chunks +9 lines, -13 lines 0 comments Download
M content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java View 1 2 3 4 4 chunks +6 lines, -1 line 0 comments Download
M ui/android/BUILD.gn View 1 2 3 4 5 6 6 chunks +9 lines, -0 lines 0 comments Download
M ui/android/DEPS View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M ui/android/display_android_manager.h View 1 2 3 4 1 chunk +8 lines, -1 line 0 comments Download
M ui/android/display_android_manager.cc View 1 2 3 4 2 chunks +6 lines, -0 lines 0 comments Download
M ui/android/dummy_screen_android.cc View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
A ui/android/java/src/org/chromium/ui/base/ViewRoot.java View 1 2 3 4 1 chunk +104 lines, -0 lines 0 comments Download
M ui/android/ui_android_jni_registrar.cc View 1 2 3 4 2 chunks +2 lines, -0 lines 0 comments Download
M ui/android/view_android.h View 1 2 3 4 5 6 6 chunks +46 lines, -7 lines 0 comments Download
M ui/android/view_android.cc View 1 2 3 4 5 6 7 chunks +61 lines, -10 lines 0 comments Download
A ui/android/view_android_unittest.cc View 1 2 3 4 5 6 1 chunk +278 lines, -0 lines 0 comments Download
A ui/android/view_client.h View 1 2 3 4 5 6 1 chunk +26 lines, -0 lines 0 comments Download
A ui/android/view_client.cc View 1 2 3 4 5 6 1 chunk +12 lines, -0 lines 0 comments Download
A ui/android/view_root.h View 1 2 3 4 5 6 1 chunk +73 lines, -0 lines 0 comments Download
A ui/android/view_root.cc View 1 2 3 4 5 6 1 chunk +143 lines, -0 lines 0 comments Download
M ui/android/window_android.h View 1 2 3 4 3 chunks +2 lines, -7 lines 0 comments Download
M ui/android/window_android.cc View 1 2 3 4 2 chunks +0 lines, -6 lines 0 comments Download
M ui/display/screen.h View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
M ui/snapshot/snapshot_android.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 68 (43 generated)
Jinsuk Kim
..still got a few failing tests but would like to get your initial feedback. Please ...
3 years, 11 months ago (2017-01-03 08:07:17 UTC) #21
boliu
pretty good overall said in comments below, but overall suggestion is just make ViewRoot a ...
3 years, 11 months ago (2017-01-03 19:16:11 UTC) #26
boliu
oh, also, I didn't look at chrome/chromecast/blimp
3 years, 11 months ago (2017-01-03 19:17:01 UTC) #27
Jinsuk Kim
https://codereview.chromium.org/2595263002/diff/80001/content/browser/devtools/protocol/devtools_protocol_browsertest.cc File content/browser/devtools/protocol/devtools_protocol_browsertest.cc (right): https://codereview.chromium.org/2595263002/diff/80001/content/browser/devtools/protocol/devtools_protocol_browsertest.cc#newcode613 content/browser/devtools/protocol/devtools_protocol_browsertest.cc:613: std::unique_ptr<ui::ViewRoot> view_root(new ui::ViewRoot()); On 2017/01/03 19:16:11, boliu wrote: > ...
3 years, 11 months ago (2017-01-04 10:45:02 UTC) #29
boliu
replying to comments https://codereview.chromium.org/2595263002/diff/80001/content/browser/renderer_host/compositor_impl_android.h File content/browser/renderer_host/compositor_impl_android.h (right): https://codereview.chromium.org/2595263002/diff/80001/content/browser/renderer_host/compositor_impl_android.h#newcode131 content/browser/renderer_host/compositor_impl_android.h:131: scoped_refptr<cc::Layer> root_layer_; On 2017/01/04 10:45:02, Jinsuk ...
3 years, 11 months ago (2017-01-04 17:45:10 UTC) #30
boliu
https://codereview.chromium.org/2595263002/diff/80001/ui/snapshot/snapshot_android.cc File ui/snapshot/snapshot_android.cc (right): https://codereview.chromium.org/2595263002/diff/80001/ui/snapshot/snapshot_android.cc#newcode46 ui/snapshot/snapshot_android.cc:46: view.SetWindowAndroid(window); On 2017/01/04 10:45:02, Jinsuk Kim wrote: > On ...
3 years, 11 months ago (2017-01-04 18:58:06 UTC) #31
Jinsuk Kim
https://codereview.chromium.org/2595263002/diff/80001/content/browser/renderer_host/compositor_impl_android.h File content/browser/renderer_host/compositor_impl_android.h (right): https://codereview.chromium.org/2595263002/diff/80001/content/browser/renderer_host/compositor_impl_android.h#newcode131 content/browser/renderer_host/compositor_impl_android.h:131: scoped_refptr<cc::Layer> root_layer_; On 2017/01/04 17:45:10, boliu wrote: > On ...
3 years, 11 months ago (2017-01-05 11:03:13 UTC) #42
boliu
+ted: Question about viewroot in chrome. Should OverlayPanel get its own viewroot? In my head ...
3 years, 11 months ago (2017-01-05 19:09:29 UTC) #44
Ted C
+mdjones and +dtrainor for larger overlay panel thoughts as well. But, I agree with you ...
3 years, 11 months ago (2017-01-05 19:17:15 UTC) #46
Jinsuk Kim
On 2017/01/05 19:17:15, Ted C wrote: > +mdjones and +dtrainor for larger overlay panel thoughts ...
3 years, 11 months ago (2017-01-05 20:27:14 UTC) #47
boliu
On 2017/01/05 20:27:14, Jinsuk Kim wrote: > On 2017/01/05 19:17:15, Ted C wrote: > > ...
3 years, 11 months ago (2017-01-05 20:32:54 UTC) #48
mdjones
On 2017/01/05 19:17:15, Ted C wrote: > +mdjones and +dtrainor for larger overlay panel thoughts ...
3 years, 11 months ago (2017-01-05 22:21:49 UTC) #49
Jinsuk Kim
https://codereview.chromium.org/2595263002/diff/210038/android_webview/java/src/org/chromium/android_webview/AwContents.java File android_webview/java/src/org/chromium/android_webview/AwContents.java (right): https://codereview.chromium.org/2595263002/diff/210038/android_webview/java/src/org/chromium/android_webview/AwContents.java#newcode1206 android_webview/java/src/org/chromium/android_webview/AwContents.java:1206: mViewRoot.destroy(); On 2017/01/05 19:09:28, boliu wrote: > Finding the ...
3 years, 11 months ago (2017-01-05 22:30:16 UTC) #50
boliu
Ok, gonna continue this review, and remove other reviewers that got added here just for ...
3 years, 11 months ago (2017-01-05 22:39:38 UTC) #51
David Trainor- moved to gerrit
On 2017/01/05 20:32:54, boliu wrote: > On 2017/01/05 20:27:14, Jinsuk Kim wrote: > > On ...
3 years, 11 months ago (2017-01-05 22:44:12 UTC) #53
David Trainor- moved to gerrit
On 2017/01/05 22:39:38, boliu wrote: > Ok, gonna continue this review, and remove other reviewers ...
3 years, 11 months ago (2017-01-05 22:45:00 UTC) #54
Jinsuk Kim
Note for patch #5: - Replaced the example from physical backing size to touch event. ...
3 years, 11 months ago (2017-01-13 07:56:12 UTC) #58
boliu
On 2017/01/13 07:56:12, Jinsuk Kim wrote: > Note for patch #5: > > - Replaced ...
3 years, 11 months ago (2017-01-13 19:36:23 UTC) #59
Jinsuk Kim
On 2017/01/13 19:36:23, boliu wrote: > > > > I'm planning to add basic geometry ...
3 years, 11 months ago (2017-01-16 05:36:02 UTC) #60
boliu
On 2017/01/16 05:36:02, Jinsuk Kim wrote: > On 2017/01/13 19:36:23, boliu wrote: > > > ...
3 years, 11 months ago (2017-01-17 16:12:19 UTC) #62
boliu
a few comments on view_android https://codereview.chromium.org/2595263002/diff/370001/ui/android/view_android.cc File ui/android/view_android.cc (right): https://codereview.chromium.org/2595263002/diff/370001/ui/android/view_android.cc#newcode133 ui/android/view_android.cc:133: child->SetBounds(origin, Bounds::kMatchParent, Bounds::kMatchParent); this ...
3 years, 11 months ago (2017-01-17 16:17:28 UTC) #63
Jinsuk Kim
> Sure adding bounds is fine. But I think routing events through it should come ...
3 years, 11 months ago (2017-01-17 23:32:48 UTC) #64
Jinsuk Kim
Chatted offline and clarified a few things. Will introduce a command line switch, implement ViewAndroid ...
3 years, 11 months ago (2017-01-18 02:38:20 UTC) #65
Jinsuk Kim
Updates: - Introduced a new command line switch - Set the bounds of ViewAndroid correctly ...
3 years, 11 months ago (2017-01-23 09:00:14 UTC) #67
boliu
3 years, 11 months ago (2017-01-23 21:27:19 UTC) #68
On 2017/01/23 09:00:14, Jinsuk Kim wrote:
> Updates:
> - Introduced a new command line switch
> - Set the bounds of ViewAndroid correctly mirroring that of Java ContentView.
> Added unit tests.
> 
> ViewRoot is not in action for any events yet, though |OnTouchEvent| is in the
> new interface. Will keep the upcoming changes behind the command line switch.
> Let me know if you want this CL to be split into multiple ones. I included the
> ViewAndroid layout/bounds in this CL because ViewRoot makes it more convenient
> to do unit tests for ViewAndroid hit testing.

If we have a command line switch, we no longer need to have everything in a
single CL. Is it possible to break this up into smaller pieces to make reviewing
easier?

Powered by Google App Engine
This is Rietveld 408576698