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 = ...@@ -2879,18 +2879,24 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// parent is hidden but the view itself is not, the snapshot will not be a // parent is hidden but the view itself is not, the snapshot will not be a
// blank view. // blank view.
[self.tabStripSnapshot removeFromSuperview]; [self.tabStripSnapshot removeFromSuperview];
self.tabStripSnapshot = [self.tabStripView screenshotForAnimation]; // During initial setup, the tab strip view may be nil, but the missing
self.tabStripSnapshot.translatesAutoresizingMaskIntoConstraints = NO; // snapshot will never be visible because all three animation methods are
self.tabStripSnapshot.transform = // called in succession.
currentViewRevealState == ViewRevealState::Hidden if (self.tabStripView) {
? [self.tabStripView adjustTransformForRTL:CGAffineTransformIdentity] self.tabStripSnapshot = [self.tabStripView screenshotForAnimation];
: [self.tabStripView self.tabStripSnapshot.translatesAutoresizingMaskIntoConstraints = NO;
adjustTransformForRTL:CGAffineTransformMakeTranslation( self.tabStripSnapshot.transform =
0, currentViewRevealState == ViewRevealState::Hidden
self.tabStripView.frame.size.height)]; ? [self.tabStripView
self.tabStripView.hidden = YES; adjustTransformForRTL:CGAffineTransformIdentity]
[self.contentArea addSubview:self.tabStripSnapshot]; : [self.tabStripView
AddSameConstraints(self.tabStripSnapshot, 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. // Remove the fake status bar to allow the thumb strip animations to appear.
[_fakeStatusBarView removeFromSuperview]; [_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