Commit 5731dd81 authored by David Jean's avatar David Jean Committed by Commit Bot

[ios] Fix resize issue with web content

Force resize of content when the content doesn't detect
it by itself.

Bug: 1091515, 1073446, 1071811
Change-Id: I1d548c3b11ad95b8c26998cf189b0cdc72095f4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339459
Commit-Queue: David Jean <djean@chromium.org>
Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795834}
parent 1c20da93
......@@ -1630,7 +1630,9 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// change on rotation.
[_toolbarUIUpdater updateState];
}
completion:nil];
completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
self.fullscreenController->ResizeViewport();
}];
}
- (void)dismissViewControllerAnimated:(BOOL)flag
......
......@@ -90,6 +90,9 @@ class FullscreenController {
// Exits fullscreen mode, animating in toolbars and resetting the progress to
// 1.0.
virtual void ExitFullscreen() = 0;
// Force content resize, when content isn't tracking resize by itself.
virtual void ResizeViewport() = 0;
};
#endif // IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_
......@@ -47,6 +47,7 @@ class FullscreenControllerImpl : public FullscreenController {
UIEdgeInsets GetCurrentViewportInsets() const override;
void EnterFullscreen() override;
void ExitFullscreen() override;
void ResizeViewport() override;
private:
......
......@@ -250,3 +250,13 @@ void FullscreenControllerImpl::EnterFullscreen() {
void FullscreenControllerImpl::ExitFullscreen() {
mediator_.ExitFullscreen();
}
void FullscreenControllerImpl::ResizeViewport() {
// TODO(crbug.com/1114054) this hack temporarily force change webview's
// height to trigger a width recomputation of its content. It will cause
// two renderings on the most liklely very rare case of window resizes.
CGFloat height = model_.GetBottomToolbarHeight();
CGFloat delta = height > 0 ? -1 : 1;
model_.SetBottomToolbarHeight(height + delta);
model_.SetBottomToolbarHeight(height);
}
......@@ -40,6 +40,7 @@ class TestFullscreenController : public FullscreenController {
UIEdgeInsets GetCurrentViewportInsets() const override;
void EnterFullscreen() override;
void ExitFullscreen() override;
void ResizeViewport() override;
// Calls FullscreenViewportInsetRangeChanged() on observers.
void OnFullscreenViewportInsetRangeChanged(UIEdgeInsets min_viewport_insets,
......
......@@ -122,3 +122,7 @@ void TestFullscreenController::OnFullscreenWillAnimate(
observer.FullscreenWillAnimate(this, animator);
}
}
void TestFullscreenController::ResizeViewport() {
// NOOP in tests.
}
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