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

Issue 1556733002: Restore scrolloffset after exiting fullscreen.

Created:
4 years, 11 months ago by hush (inactive)
Modified:
4 years, 11 months ago
Reviewers:
boliu
CC:
chromium-reviews, android-webview-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Restore scrolloffset after exiting fullscreen. Page scale factor in full screen mode can be different from the normal mode. Right after exiting fullscreen, the page scale factor will be stale, because it remains the value of full screen mode until quite a few ondraws later. However, WebView will try to restore to the normal mode scroll offset immediately after exiting fullscreen. So WebView will be temporarily restored to a wrong scroll offset in CSS pixel. This patch will try to restore to the right location when page scale factor changes back to the initial value in normal mode. BUG=558045

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : restore only when the page scale factor is back to the initial value #

Unified diffs Side-by-side diffs Delta from patch set Stats (+110 lines, -85 lines) Patch
M android_webview/browser/browser_view_renderer.h View 4 chunks +11 lines, -11 lines 0 comments Download
M android_webview/browser/browser_view_renderer.cc View 5 chunks +53 lines, -59 lines 0 comments Download
M android_webview/java/src/org/chromium/android_webview/AwContents.java View 1 2 5 chunks +44 lines, -1 line 0 comments Download
M android_webview/java/src/org/chromium/android_webview/AwScrollOffsetManager.java View 3 chunks +2 lines, -14 lines 0 comments Download

Messages

Total messages: 17 (1 generated)
hush (inactive)
Hi Bo, PTAL! This will solve the case of scrolloffset jumping around after exiting fullscreen, ...
4 years, 11 months ago (2015-12-30 23:19:21 UTC) #2
hush (inactive)
changes in browser view renderer are mechanical. They are name changes
4 years, 11 months ago (2015-12-30 23:20:10 UTC) #3
boliu
Question about description: > However, WebView will try to restore to the normal mode scroll ...
4 years, 11 months ago (2015-12-30 23:25:02 UTC) #4
hush (inactive)
On 2015/12/30 23:25:02, boliu wrote: > Question about description: > > > However, WebView will ...
4 years, 11 months ago (2015-12-30 23:30:04 UTC) #5
boliu
Let's see if I understand the fix correctly.. So let's say the two views are ...
4 years, 11 months ago (2015-12-31 00:07:03 UTC) #6
hush (inactive)
On 2015/12/31 00:07:03, boliu wrote: > Let's see if I understand the fix correctly.. > ...
4 years, 11 months ago (2015-12-31 00:24:51 UTC) #7
boliu
On 2015/12/31 00:24:51, hush wrote: > On 2015/12/31 00:07:03, boliu wrote: > > Let's see ...
4 years, 11 months ago (2015-12-31 00:34:37 UTC) #8
hush (inactive)
> This would be in the first onDraw after exitFullScreen mentioned above? yes. > Ohh, ...
4 years, 11 months ago (2015-12-31 00:39:09 UTC) #9
boliu
On 2015/12/31 00:39:09, hush wrote: > > This would be in the first onDraw after ...
4 years, 11 months ago (2015-12-31 00:42:47 UTC) #10
hush (inactive)
Updated ps3 based on what we just discussed
4 years, 11 months ago (2015-12-31 00:43:13 UTC) #11
hush (inactive)
On 2015/12/31 00:42:47, boliu wrote: > On 2015/12/31 00:39:09, hush wrote: > > > This ...
4 years, 11 months ago (2015-12-31 00:48:20 UTC) #12
boliu
On 2015/12/31 00:48:20, hush wrote: > On 2015/12/31 00:42:47, boliu wrote: > > On 2015/12/31 ...
4 years, 11 months ago (2015-12-31 00:55:24 UTC) #13
boliu
Another thought. What if onDraw didn't force sync the container view scroll offset? Blink itself ...
4 years, 11 months ago (2015-12-31 00:59:31 UTC) #14
hush (inactive)
On 2015/12/31 00:55:24, boliu wrote: > On 2015/12/31 00:48:20, hush wrote: > > On 2015/12/31 ...
4 years, 11 months ago (2015-12-31 01:11:14 UTC) #15
boliu
On 2015/12/31 01:11:14, hush wrote: > On 2015/12/31 00:55:24, boliu wrote: > > On 2015/12/31 ...
4 years, 11 months ago (2015-12-31 01:15:53 UTC) #16
hush (inactive)
4 years, 11 months ago (2015-12-31 01:21:41 UTC) #17
On 2015/12/31 01:15:53, boliu wrote:
> On 2015/12/31 01:11:14, hush wrote:
> > On 2015/12/31 00:55:24, boliu wrote:
> > > On 2015/12/31 00:48:20, hush wrote:
> > > > On 2015/12/31 00:42:47, boliu wrote:
> > > > > On 2015/12/31 00:39:09, hush wrote:
> > > > > > > This would be in the first onDraw after exitFullScreen mentioned
> > above?
> > > > > > yes.
> > > > > > 
> > > > > > > Ohh, so you re-restore the correct physical scroll offset, after
the
> > > next
> > > > > page
> > > > > > scale change?
> > > > > > yes.
> > > > > > > So you are assuming the next setPageScaleFactorAndLimits call
> > > > > > corresponds to this activation with the correct page scale?
> > > > > > Sorry, I made a mistake here in the code. I don't actually assume
the
> > next
> > > > > > setPageScaleFactorAndLimits call will contain the correct page
scale.
> I
> > > > should
> > > > > > have compared the incoming page scale with the
> "mInitialPageScaleFactor"
> > > > > stored
> > > > > > in the transition state.
> > > > > > The assumption is that we will get a bunch of
> > setPageScaleFactorAndLimits
> > > > > after
> > > > > > exiting fullscreen, and eventually there will be a
> > > > setPageScaleFactorAndLimits
> > > > > > that sets the page scale to the original scale before fullscreen.
> > > > > 
> > > > > I don't think that's ever gonna work reliably..
> > > > > 
> > > > > Feels like we have to just restore the old page scale synchronously
> inside
> > > > > exitFullScreen, then the scroll restore in the first onDraw will
> converted
> > > to
> > > > > the correct css offset
> > > > 
> > > > There will be several activations on BrowserViewRenderer containing the
> > stale
> > > > page scale factor, after exit fullscreen.
> > > 
> > > It needs to be plumbed all the way to cc impl-side? Would be similar to
> > > ContentViewCore.pinchByDelta, but guaranteed to be synchronous in the
> webview
> > > sense.
> > > 
> > > Otherwise, I don't see any way to do this reliably. How bad is the issue
in
> > > practice?
> > > 
> > > > 
> > > > So if AwContents immediately sets the initial page scale factor to
> > > > BrowserViewRenderer duing exitFullScreen, this value will be overwritten
> to
> > a
> > > > wrong value again, by another activation.
> > > > That means BrowserViewRenderer has to somehow know the page scale factor
> > from
> > > > the activation is wrong and ignore it until it is right. And this
further
> > > means
> > > > BrowserViewRenderer has to know something about fullscreen transitions
to
> > make
> > > > that ignore decision. I think it is too much for BVR to know. That's why
I
> > > > didn't choose to do this initially.
> > 
> > The thing is even if I plumb the page scale factor on the cc-impl side, I'm
> not
> > sure if this works eventually. Will this value on impl side stick when there
> are
> > multiple commits from blink with a different page scale factor?
> > 
> > In practice, the user almost never get to the correct location after exiting
> > full screen, whether it is chrome or a webview app.
> > You can try loading youtube mobile site on Chrome, or this site:
> > http://www.quirksmode.org/html5/tests/video.html
> 
> Oh doesn't even work in chrome? Then all hope is lost..
> 
> I mean have to make sure blink does the right thing first before fixing
webview.
> This sort of hacky patch-up fix is just going to cause more problems when it
> doesn't work.

Yeah, try Chrome stable and you will see. Haha...

Powered by Google App Engine
This is Rietveld 408576698