Chromium Code Reviews| Index: ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm |
| diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm |
| index 48003841e5e842087ebc234347379bafe143ab22..3d08f60e3d20512a27cd0a3b5a01be3067aa546e 100644 |
| --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm |
| +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm |
| @@ -34,6 +34,7 @@ CGFloat kHorizontalMargin = 8.0f; |
| @property(nonatomic, strong) ToolbarButton* shareButton; |
| @property(nonatomic, strong) ToolbarButton* reloadButton; |
| @property(nonatomic, strong) ToolbarButton* stopButton; |
| +@property(nonatomic, assign) CGRect currentFrame; |
| @end |
| @implementation ToolbarViewController |
| @@ -49,6 +50,7 @@ CGFloat kHorizontalMargin = 8.0f; |
| @synthesize shareButton = _shareButton; |
| @synthesize reloadButton = _reloadButton; |
| @synthesize stopButton = _stopButton; |
| +@synthesize currentFrame = _currentFrame; |
| - (instancetype)init { |
| self = [super init]; |
| @@ -59,6 +61,8 @@ CGFloat kHorizontalMargin = 8.0f; |
| return self; |
| } |
| +#pragma mark - View lifecyle |
| + |
| - (void)viewDidLoad { |
| self.view.backgroundColor = [UIColor lightGrayColor]; |
| @@ -92,6 +96,17 @@ CGFloat kHorizontalMargin = 8.0f; |
| constraintEqualToAnchor:self.view.trailingAnchor |
| constant:-kHorizontalMargin], |
| ]]; |
| + |
| + self.currentFrame = self.view.frame; |
| +} |
| + |
| +- (void)viewWillLayoutSubviews { |
| + // We need to dismiss the ToolsMenu everytime the Toolbar frame changes |
| + // (e.g. Size changes, rotation changes, etc.) |
| + if (!CGRectEqualToRect(self.currentFrame, self.view.frame)) { |
|
marq (ping after 24h)
2017/05/10 10:57:02
UIViewController (via the UIContentContainer proto
sczs
2017/05/10 15:32:32
I agree, its much better.
Done.
|
| + [self.dispatcher closeToolsMenu]; |
| + } |
| + self.currentFrame = self.view.frame; |
| } |
| #pragma mark - Components Setup |