Commit 82ce7958 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Fix NTP layout issue during animations

This CL makes sure that the NTP is correctly layout with MultiWindow.
With MultiWindow, the NTP view is created with a frame of CGRectZero.
Without MultiWindow, the frame is the one of the app.
Forcing the layout after setting the frame, ensures that the elements
are correctly positioned and sized.

Fixed: 1121993
Change-Id: I1c8ae1c468934a36eedd7687348547bf5885e1e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410379
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Mark Cogan <marq@chromium.org>
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806670}
parent 2bf77d54
...@@ -2325,6 +2325,7 @@ NSString* const kBrowserViewControllerSnackbarCategory = ...@@ -2325,6 +2325,7 @@ NSString* const kBrowserViewControllerSnackbarCategory =
UIViewController* viewController = UIViewController* viewController =
_ntpCoordinatorsForWebStates[webState].viewController; _ntpCoordinatorsForWebStates[webState].viewController;
viewController.view.frame = [self ntpFrameForWebState:webState]; viewController.view.frame = [self ntpFrameForWebState:webState];
[viewController.view layoutIfNeeded];
// TODO(crbug.com/873729): For a newly created WebState, the session will // TODO(crbug.com/873729): For a newly created WebState, the session will
// not be restored until LoadIfNecessary call. Remove when fixed. // not be restored until LoadIfNecessary call. Remove when fixed.
webState->GetNavigationManager()->LoadIfNecessary(); webState->GetNavigationManager()->LoadIfNecessary();
...@@ -4410,6 +4411,7 @@ NSString* const kBrowserViewControllerSnackbarCategory = ...@@ -4410,6 +4411,7 @@ NSString* const kBrowserViewControllerSnackbarCategory =
newPage = [self viewForWebState:webState]; newPage = [self viewForWebState:webState];
newPage.userInteractionEnabled = NO; newPage.userInteractionEnabled = NO;
newPage.frame = self.view.bounds; newPage.frame = self.view.bounds;
[newPage layoutIfNeeded];
} else { } else {
[self viewForWebState:webState].frame = self.contentArea.bounds; [self viewForWebState:webState].frame = self.contentArea.bounds;
// Setting the frame here doesn't trigger a layout pass. Trigger it manually // Setting the frame here doesn't trigger a layout pass. Trigger it manually
......
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