Skip to content

Commit 935a93c

Browse files
jonrossCommit Bot
authored andcommitted
Partial Fix to Android Omnibox scrolling revealing other content
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 <[email protected]> Reviewed-by: Matthew Jones <[email protected]> Commit-Queue: Jonathan Ross <[email protected]> Cr-Commit-Position: refs/heads/master@{#623741}
1 parent 12ac477 commit 935a93c

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

chrome/android/java/src/org/chromium/chrome/browser/fullscreen/ChromeFullscreenManager.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,17 +465,39 @@ public void removeListener(FullscreenListener listener) {
465465
* Updates viewport size to have it render the content correctly.
466466
*/
467467
public void updateViewportSize() {
468-
if (mInGesture || mContentViewScrolling) return;
469-
470468
// Update content viewport size only when the browser controls are not animating.
471469
int topContentOffset = (int) mRendererTopContentOffset;
470+
int topControlOffset = Math.max(mRendererTopControlOffset, -getTopControlsHeight());
472471
int bottomControlOffset = (int) mRendererBottomControlOffset;
473-
if ((topContentOffset != 0 && topContentOffset != getTopControlsHeight())
474-
&& bottomControlOffset != 0 && bottomControlOffset != getBottomControlsHeight()) {
472+
473+
// Controls resize the view only when they are being displayed at their
474+
// maximum. Otherwise when the viewport is small, we can show unrelated
475+
// graphical textures while scrolling the controls away.
476+
// For top controls this is when the offset matches the height.
477+
// For bottom controls this is the inverse, an offset of 0 means fully
478+
// displayed. When there are no bottom controls, their height is 0.
479+
boolean controlsResizeView = topControlOffset == 0 && bottomControlOffset == 0;
480+
481+
// Do not update the size during a gesture or scroll. Unless there has
482+
// been a change in how a view resizes for controls, due to the viewport
483+
// growing in size. When growing the viewport, it must be done
484+
// immediately, otheriwse we render old textures in the expanded region.
485+
// When shrinking the viewport, we can wait for the user input to finish
486+
// before adjusting.
487+
if (mControlsResizeView == controlsResizeView) {
488+
if (mInGesture || mContentViewScrolling) return;
489+
if ((topContentOffset != 0 && topContentOffset != getTopControlsHeight())
490+
&& bottomControlOffset != 0
491+
&& bottomControlOffset != getBottomControlsHeight()) {
492+
return;
493+
}
494+
} else if ((mInGesture || mContentViewScrolling)
495+
&& topContentOffset == getTopControlsHeight()) {
496+
// When shrinking the viewport, we can wait for the user input to finish
497+
// before adjusting.
475498
return;
476499
}
477-
boolean controlsResizeView =
478-
topContentOffset > 0 || bottomControlOffset < getBottomControlsHeight();
500+
479501
mControlsResizeView = controlsResizeView;
480502
Tab tab = getTab();
481503
if (tab == null) return;

0 commit comments

Comments
 (0)