WebContents on Android doesn't draw

41 views
Skip to first unread message

Max

unread,
Jun 28, 2016, 2:35:35 PM6/28/16
to Chromium-dev
Hi!
I added another WebContents into View tree in Chromium for Android.
I can see the ContentView in Hierarchy Viewer, but it doesn't draw anything.
I checked the dimensions and visibility, it looks fine. The parent view is also visible and drawn normally.
After hours of investigation I started to suspect this is due to hardware accelerated composition, which I didn't set up properly.
Unfortunately I found no docs on this topic specific to Android.

What's the correct way to do this, and what are the least requirements for a WebContents under Android to be displayed?
Any advice would be highly appreciated.

Alexandre Elias

unread,
Jun 29, 2016, 3:16:07 AM6/29/16
to knuc...@gmail.com, Chromium-dev
The ContentView is an invisible view for input handling.  The actual contents are drawn into a separate SurfaceView.

It's not necessarily needed to add another Android View to display multiple web contents in Chromium for Android.  They can be composited together in the same SurfaceView using CC.  That's what you see when you have two live tabs in the ChromePublic tab switcher.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Max

unread,
Jun 29, 2016, 4:47:58 AM6/29/16
to Chromium-dev, knuc...@gmail.com
I need to display another web page above everything else. Similar to contextual search panel. But it has very complicated code, some layer manipulation and native calls. I can't get, what part of all that is minimally necessary for displaying it.

Alexandre Elias

unread,
Jun 29, 2016, 3:00:16 PM6/29/16
to knuc...@gmail.com, Chromium-dev
Yeah, the code isn't factored well to make this easy.  There's no concise answer to your question.  Although it would be inefficient in RAM/CPU etc, the easiest way to do what you want would be to put your other web page inside a WebView.

Max

unread,
Jun 30, 2016, 4:29:39 AM6/30/16
to Chromium-dev, knuc...@gmail.com
Could you please give more details?
What do you mean with "put another web page"?
I don't want to replace currently displayed web page with my own, I need it shown above or aside, and with an isolated DOM and JS context.
If it's possible with what you propose, then please point me at the API to do this.
Thanks!

Alexandre Elias

unread,
Jun 30, 2016, 3:48:21 PM6/30/16
to knuc...@gmail.com, Chromium-dev

From what you said, it still sounds like you have two different web pages, and you want to display one of them full-activity in the background, and the other smaller, floating and foregrounded.

Personally, faced with this problem, I would not go down the road of modifying or including my own build of Chromium at all, but simply use two WebViews.  The supported API for positioning and sizing small web pages within a native Android app is WebView, there is no other really.


Reply all
Reply to author
Forward
0 new messages