Commit f93055ca authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Fix fullscreen PWAs not updating the webcontents size.

We were previously only updating the layout sizes used
for the browser compositor layouts, but not the underlying
web contents.

BUG=905270

Change-Id: I1f36a46db4bf5f83e6adc8dce75551a059ec7b57
Reviewed-on: https://chromium-review.googlesource.com/c/1335952
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608136}
parent 247de386
...@@ -301,14 +301,7 @@ public class CompositorViewHolder extends FrameLayout ...@@ -301,14 +301,7 @@ public class CompositorViewHolder extends FrameLayout
mShowingFullscreen = isInFullscreen; mShowingFullscreen = isInFullscreen;
if (mSystemUiFullscreenResizeRunnable == null) { if (mSystemUiFullscreenResizeRunnable == null) {
mSystemUiFullscreenResizeRunnable = () -> { mSystemUiFullscreenResizeRunnable = this::handleWindowInsetChanged;
View contentView = getContentView();
if (contentView != null) {
Point viewportSize = getViewportSize();
setSize(getWebContents(), contentView, viewportSize.x, viewportSize.y);
}
onViewportChanged();
};
} else { } else {
getHandler().removeCallbacks(mSystemUiFullscreenResizeRunnable); getHandler().removeCallbacks(mSystemUiFullscreenResizeRunnable);
} }
...@@ -367,13 +360,25 @@ public class CompositorViewHolder extends FrameLayout ...@@ -367,13 +360,25 @@ public class CompositorViewHolder extends FrameLayout
mInsetObserverView = view; mInsetObserverView = view;
if (mInsetObserverView != null) { if (mInsetObserverView != null) {
mInsetObserverView.addObserver(this); mInsetObserverView.addObserver(this);
onViewportChanged(); handleWindowInsetChanged();
} }
} }
@Override @Override
public void onInsetChanged(int left, int top, int right, int bottom) { public void onInsetChanged(int left, int top, int right, int bottom) {
if (mShowingFullscreen) onViewportChanged(); if (mShowingFullscreen) handleWindowInsetChanged();
}
private void handleWindowInsetChanged() {
// Notify the WebContents that the size has changed.
View contentView = getContentView();
if (contentView != null) {
Point viewportSize = getViewportSize();
setSize(getWebContents(), contentView, viewportSize.x, viewportSize.y);
}
// Notify the compositor layout that the size has changed. The layout does not drive
// the WebContents sizing, so this needs to be done in addition to the above size update.
onViewportChanged();
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment