Commit 91fdd0eb authored by Nazerke's avatar Nazerke Committed by Chromium LUCI CQ

[ios] Fix the crash in [BrowserViewController willAnimateViewReveal:]

This CL guards [self.tabStripView screenshotForAnimation] by checking if
the flag is disabled.
The problem is that in TabStripCoordinator's -view, the coordinator's
view controller is cast to UIView<TabStripContaining>. However, the view
does not actually conform to this protocol, so calling the protocol
method leads to an does not respond to selector issue.

This guard will stop the crashes with no current implementation of
taking the snapshot.

Bug: 1158298,1128249
Change-Id: Ia939e565451f3e705989c0dc0769ba038f45f922
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612846
Commit-Queue: Nazerke Kalidolda <nazerke@google.com>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841957}
parent 3779691d
......@@ -2895,7 +2895,7 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// 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) {
if (self.tabStripView && !base::FeatureList::IsEnabled(kModernTabStrip)) {
self.tabStripSnapshot = [self.tabStripView screenshotForAnimation];
self.tabStripSnapshot.translatesAutoresizingMaskIntoConstraints = NO;
self.tabStripSnapshot.transform =
......@@ -2956,26 +2956,29 @@ NSString* const kBrowserViewControllerSnackbarCategory =
case ViewRevealState::Hidden:
self.view.superview.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformIdentity;
self.tabStripSnapshot.transform =
[self.tabStripView adjustTransformForRTL:CGAffineTransformIdentity];
if (!base::FeatureList::IsEnabled(kModernTabStrip))
self.tabStripSnapshot.transform =
[self.tabStripView adjustTransformForRTL:CGAffineTransformIdentity];
break;
case ViewRevealState::Peeked:
self.view.superview.transform = CGAffineTransformMakeTranslation(
0, self.thumbStripPanHandler.peekedHeight);
self.view.transform = CGAffineTransformMakeTranslation(
0, -self.tabStripView.frame.size.height - self.headerOffset);
self.tabStripSnapshot.transform = [self.tabStripView
adjustTransformForRTL:CGAffineTransformMakeTranslation(
0, self.tabStripView.frame.size.height)];
if (!base::FeatureList::IsEnabled(kModernTabStrip))
self.tabStripSnapshot.transform = [self.tabStripView
adjustTransformForRTL:CGAffineTransformMakeTranslation(
0, self.tabStripView.frame.size.height)];
break;
case ViewRevealState::Revealed:
self.view.superview.transform = CGAffineTransformMakeTranslation(
0, self.thumbStripPanHandler.revealedHeight);
self.view.transform = CGAffineTransformMakeTranslation(
0, -self.tabStripView.frame.size.height - self.headerOffset);
self.tabStripSnapshot.transform = [self.tabStripView
adjustTransformForRTL:CGAffineTransformMakeTranslation(
0, self.tabStripView.frame.size.height)];
if (!base::FeatureList::IsEnabled(kModernTabStrip))
self.tabStripSnapshot.transform = [self.tabStripView
adjustTransformForRTL:CGAffineTransformMakeTranslation(
0, self.tabStripView.frame.size.height)];
break;
}
}
......
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