Skip to content

Commit

Permalink
Partial Fix to Android Omnibox scrolling revealing other content
Browse files Browse the repository at this point in the history
ChromeFullscreenManager::updateViewportSize calculates the changes in control
offsets, and determines when to toggle the resizing of the renderer's view.

Currently all viewport updates are blocked while a gesture or scrolling is
occurring.

This change updates the method to also perform the update if we've changed the
resize state. Allowing the renderer to resize to account for the larger region
when scrolling the controls away.

While this prevents showing older content, it only does so for normal speed
scrolls. A quick flick can lead to such a rapid change in viewport, that we
still have some frames of old content.

Bug: 916144
Change-Id: Ibbf8d6daa89691945e011022f9509fea4783cfe2
Reviewed-on: https://chromium-review.googlesource.com/c/1387945
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Matthew Jones <mdjones@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623741}
  • Loading branch information
jonross authored and Commit Bot committed Jan 17, 2019
1 parent 12ac477 commit 935a93c
Showing 1 changed file with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,17 +465,39 @@ public void removeListener(FullscreenListener listener) {
* Updates viewport size to have it render the content correctly.
*/
public void updateViewportSize() {
if (mInGesture || mContentViewScrolling) return;

// Update content viewport size only when the browser controls are not animating.
int topContentOffset = (int) mRendererTopContentOffset;
int topControlOffset = Math.max(mRendererTopControlOffset, -getTopControlsHeight());
int bottomControlOffset = (int) mRendererBottomControlOffset;
if ((topContentOffset != 0 && topContentOffset != getTopControlsHeight())
&& bottomControlOffset != 0 && bottomControlOffset != getBottomControlsHeight()) {

// Controls resize the view only when they are being displayed at their
// maximum. Otherwise when the viewport is small, we can show unrelated
// graphical textures while scrolling the controls away.
// For top controls this is when the offset matches the height.
// For bottom controls this is the inverse, an offset of 0 means fully
// displayed. When there are no bottom controls, their height is 0.
boolean controlsResizeView = topControlOffset == 0 && bottomControlOffset == 0;

// Do not update the size during a gesture or scroll. Unless there has
// been a change in how a view resizes for controls, due to the viewport
// growing in size. When growing the viewport, it must be done
// immediately, otheriwse we render old textures in the expanded region.
// When shrinking the viewport, we can wait for the user input to finish
// before adjusting.
if (mControlsResizeView == controlsResizeView) {
if (mInGesture || mContentViewScrolling) return;
if ((topContentOffset != 0 && topContentOffset != getTopControlsHeight())
&& bottomControlOffset != 0
&& bottomControlOffset != getBottomControlsHeight()) {
return;
}
} else if ((mInGesture || mContentViewScrolling)
&& topContentOffset == getTopControlsHeight()) {
// When shrinking the viewport, we can wait for the user input to finish
// before adjusting.
return;
}
boolean controlsResizeView =
topContentOffset > 0 || bottomControlOffset < getBottomControlsHeight();

mControlsResizeView = controlsResizeView;
Tab tab = getTab();
if (tab == null) return;
Expand Down

0 comments on commit 935a93c

Please sign in to comment.