Commit 95815078 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Prevent Text Zoom from closing FIP unexpectedly

The root cause here was that [textZoomCoordinator stop] was being
called as part of some routine cleanup, and -stop was dismissing the
presenter, despite the presenter not presenting the coordinator's VC.
Now, the coordinator only dismisses the presenter if it is presenting
its own VC.

Bug: 1067526
Change-Id: I06372272f0651a36dec2e7bfdf18fce61d049488
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134256Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#756625}
parent 5626d004
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
} }
- (void)stop { - (void)stop {
if (!self.presenter.isPresenting) { if (![self.presenter isPresentingViewController:self.findBarController
.findBarViewController]) {
return; return;
} }
......
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
} }
- (void)stop { - (void)stop {
if (![self.presenter
isPresentingViewController:self.textZoomViewController]) {
return;
}
// If the Text Zoom UI is still active, the dismiss should be unanimated, // If the Text Zoom UI is still active, the dismiss should be unanimated,
// because the UI will be brought back later. // because the UI will be brought back later.
BOOL animated; BOOL animated;
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
- (BOOL)isPresentingViewController:(UIViewController*)viewController;
// Whether the presenter is currently presenting a view // Whether the presenter is currently presenting a view
@property(nonatomic, readonly, getter=isPresenting) BOOL presenting; @property(nonatomic, readonly, getter=isPresenting) BOOL presenting;
......
...@@ -72,6 +72,11 @@ const CGFloat kAnimationDuration = 0.15; ...@@ -72,6 +72,11 @@ const CGFloat kAnimationDuration = 0.15;
return self; return self;
} }
- (BOOL)isPresentingViewController:(UIViewController*)viewController {
return self.presenting && self.presentedViewController &&
self.presentedViewController == viewController;
}
- (void)prepareForPresentation { - (void)prepareForPresentation {
self.presenting = YES; self.presenting = YES;
self.backgroundView = [self createBackgroundView]; self.backgroundView = [self createBackgroundView];
......
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