New issue
Advanced search Search tips

Issue 648203 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Android System webview not rendering page when webview.draw is called in onPageFinished

Reported by avikraga...@gmail.com, Sep 19 2016

Issue description

Example URL:
httpbin.org/ip

Steps to reproduce the problem:
1. Create an application that uses an android webview.
2. In WebViewclient.onPageFinished capture screenshot of the webview using:
Bitmap b = Bitmap.createBitmap(x, y, Bitmap.Config.RGB_565);
Canvas c = new Canvas(b);
webview.draw(c);
3. Load the page http://httpbin.org. 
4. Click on any link on this page.
5. The webview will not render the new page.
6. If not reproducible the first time, repeat steps 3 to 5 several times. The issue is reproducible for about 50% of the time.
7. Issue is seen for simple html pages only.

You can check this in attached apk. I have also attached the source of this apk.

What is the expected behavior?
The page should render all the time.

What went wrong?
Probably some change in webview 50 has caused this scenario to break. This worked fine in pre 50 webview.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? N/A 

Did this work before? Yes In pre 50 webview, the issue was never seen.

Does this work in other browsers? Yes 

Chrome version: 50+  Channel: stable
OS Version: 5.0+
Flash Version:
 
webview50renderingissue.apk
1.1 MB Download
webviewtest2.zip
179 KB Download
Components: -Blink Mobile>WebView
onPageFinished has never been a reliable signal that the next draw will contain the loaded content. In M we added a callback for this use case (https://developer.android.com/reference/android/webkit/WebViewClient.html#onPageCommitVisible(android.webkit.WebView, java.lang.String)) but prior to that there was no way to easily determine this with certainty.

You may be able to use the picture listener to improve the situation, but that's a deprecated API.

Other questions:

* is your webview attached to the view hierarchy? and if so, how, and with what geometry?
* have you called WebView.enableSlowWholeDocumentDraw() before creating any WebView instances?

Comment 3 by boliu@chromium.org, Sep 19 2016

Status: WontFix (was: Unconfirmed)
there is no guarantee onPageFinished means page is rendered. use onPageCommitVisible if you can

if it's m50, then I guess timing changes when we enabled switched to ipc-based compositing
Answers to comment number 2:
* is your webview attached to the view hierarchy? and if so, how, and with what geometry?
Webview is just one level under relative layout (immediate child of relative layout which is the main layout). 

* have you called WebView.enableSlowWholeDocumentDraw() before creating any WebView instances?
No.

onPageCommitVisible  is called when the page starts to load, so it has not rendered yet completely. We need the screenshot of the webview when the page load completes.


Comment 5 by boliu@chromium.org, Sep 22 2016

If your page is complex and runs js to do additional work after the main page is loaded, then you need your own custom solution for the correct time to do a snapshot, probalby involes addJavaInterface and postVisualStateCallback

Comment 6 by sgu...@chromium.org, Sep 22 2016

on contrary, he mentioned that the issue is seen on simple html pages only, which is surprising.

Comment 7 by boliu@chromium.org, Sep 22 2016

gonna need an apk that demonstrates using onPageCommitVisible is broken then

Sign in to add a comment