Commit 687567cf authored by Eugene But's avatar Eugene But Committed by Commit Bot

Always use _contentArea as superview for Tab's view.

Previously BVC used self.view as superview for tab.view to
animate NTP opening. This disallowed to create a view
controller for _contentArea because views hierarchy should
always match view controller's hierarchy.

To allow view controller creation, this CL always uses _contentArea
as superview for tab.view. In order to avoid animation issues,
_contentArea is temporary resized during NTP opening animation. Doing
this resize is fine in the short term, because _contentArea always
hosts NTP for this specific case. In the long term this code will be
removed because we will need a different NTP opening animation.

A separate _contentArea view controller will allow to fix download
manager presentation. That view controller will be a base view
controller for download manager coordinator, so download manager will
be presented in _contentArea behind the bottom toolbar.

_contentArea is created in a separate CL: crrev.com/c/981684

Bug: 818264
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I6e642d9e8fd856ef4c1a0fceb1cf7615dad050a7
Reviewed-on: https://chromium-review.googlesource.com/985150Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547442}
parent b411cf48
......@@ -4979,17 +4979,21 @@ bubblePresenterForFeature:(const base::Feature&)feature
};
self.inNewTabAnimation = YES;
CGRect oldContentAreaFrame = _contentArea.frame;
if (!background) {
UIView* animationParentView = _contentArea;
// Create the new page image, and load with the new tab snapshot except if
// it is the NTP.
CGFloat newPageOffset = 0;
UIView* newPage;
UIView* newPage = nil;
CGFloat offset = 0;
if (tab.webState->GetLastCommittedURL() == kChromeUINewTabURL &&
!_isOffTheRecord && !IsIPadIdiom()) {
offset = 0;
animationParentView = self.view;
// Temporary expand content area to take whole view space. Otherwise the
// animated NTP will be clipped by content area bound. Previous frame is
// stored in |oldContentAreaFrame| and will be reset back on animation
// completion.
_contentArea.frame = self.view.frame;
newPage = tab.view;
newPage.userInteractionEnabled = NO;
// Compute a frame for the new page by removing the status bar height from
......@@ -5010,7 +5014,7 @@ bubblePresenterForFeature:(const base::Feature&)feature
}
newPageOffset = newPage.frame.origin.y;
[animationParentView addSubview:newPage];
[_contentArea addSubview:newPage];
CGPoint origin = [self lastTapPoint];
page_animation_util::AnimateInPaperWithAnimationAndCompletion(
newPage, -newPageOffset, offset, origin, _isOffTheRecord, NULL, ^{
......@@ -5033,6 +5037,7 @@ bubblePresenterForFeature:(const base::Feature&)feature
self.foregroundTabWasAddedCompletionBlock();
self.foregroundTabWasAddedCompletionBlock = nil;
}
_contentArea.frame = oldContentAreaFrame;
});
} else {
// SnapshotTabHelper::UpdateSnapshot will force a screen redraw, so take the
......
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