Commit b6e12d2c authored by Robbie Gibson's avatar Robbie Gibson Committed by Chromium LUCI CQ

[iOS] Fix startup crash from thumb strip snapshotting

This crash only appears when certain other flags are disabled and the
thumb strip is enabled (I didn't go through to find out exactly which
ones). The root cause is that with these flags disabled, the thumb strip
is created before the BVC's view is loaded, so the tab strip view has
not been created yet either.

Bug: 1094335
Change-Id: If70a670f366145514998ca5e1713a18c7770f58a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2608832Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#840169}
parent c6601a53
......@@ -2879,18 +2879,24 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// parent is hidden but the view itself is not, the snapshot will not be a
// blank view.
[self.tabStripSnapshot removeFromSuperview];
self.tabStripSnapshot = [self.tabStripView screenshotForAnimation];
self.tabStripSnapshot.translatesAutoresizingMaskIntoConstraints = NO;
self.tabStripSnapshot.transform =
currentViewRevealState == ViewRevealState::Hidden
? [self.tabStripView adjustTransformForRTL:CGAffineTransformIdentity]
: [self.tabStripView
adjustTransformForRTL:CGAffineTransformMakeTranslation(
0,
self.tabStripView.frame.size.height)];
self.tabStripView.hidden = YES;
[self.contentArea addSubview:self.tabStripSnapshot];
AddSameConstraints(self.tabStripSnapshot, self.tabStripView);
// During initial setup, the tab strip view may be nil, but the missing
// snapshot will never be visible because all three animation methods are
// called in succession.
if (self.tabStripView) {
self.tabStripSnapshot = [self.tabStripView screenshotForAnimation];
self.tabStripSnapshot.translatesAutoresizingMaskIntoConstraints = NO;
self.tabStripSnapshot.transform =
currentViewRevealState == ViewRevealState::Hidden
? [self.tabStripView
adjustTransformForRTL:CGAffineTransformIdentity]
: [self.tabStripView
adjustTransformForRTL:CGAffineTransformMakeTranslation(
0, self.tabStripView.frame.size
.height)];
self.tabStripView.hidden = YES;
[self.contentArea addSubview:self.tabStripSnapshot];
AddSameConstraints(self.tabStripSnapshot, self.tabStripView);
}
// Remove the fake status bar to allow the thumb strip animations to appear.
[_fakeStatusBarView removeFromSuperview];
......
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