Chromium Code Reviews| Index: ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm |
| diff --git a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm |
| index 8f583b4a2250204f12ba610555a88961efd7487a..a52dc15a6a4860b8e64f8821102dc01374fb4859 100644 |
| --- a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm |
| +++ b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.mm |
| @@ -4,6 +4,7 @@ |
| #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.h" |
| +#import "base/mac/foundation_util.h" |
| #import "ios/clean/chrome/browser/ui/tab_grid/ui_stack_view+cr_tab_grid.h" |
| #if !defined(__has_feature) || !__has_feature(objc_arc) |
| @@ -14,8 +15,14 @@ namespace { |
| const CGFloat kToolbarHeight = 44.0f; |
| } |
| +@interface TabGridToolbar () |
| +@property(nonatomic, weak) UIStackView* toolbarContent; |
| +@end |
| + |
| @implementation TabGridToolbar |
| +@synthesize toolbarContent = _toolbarContent; |
| + |
| - (instancetype)init { |
| if (self = [super init]) { |
| UIVisualEffect* blurEffect = |
| @@ -26,25 +33,34 @@ const CGFloat kToolbarHeight = 44.0f; |
| UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
| [self addSubview:toolbarView]; |
| - UIStackView* toolbarContent = [UIStackView cr_tabGridToolbarStackView]; |
| - [toolbarView.contentView addSubview:toolbarContent]; |
| + _toolbarContent = [UIStackView cr_tabGridToolbarStackView]; |
|
edchin
2017/04/12 09:13:37
The ivar is a weak reference so this will not reta
sczs
2017/04/12 15:44:59
Done.
|
| + [toolbarView.contentView addSubview:_toolbarContent]; |
| // Sets the stackview to a fixed height, anchored to the bottom of the |
| // blur view. |
| - toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; |
| + _toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; |
| [NSLayoutConstraint activateConstraints:@[ |
| - [toolbarContent.heightAnchor constraintEqualToConstant:kToolbarHeight], |
| - [toolbarContent.leadingAnchor |
| + [_toolbarContent.heightAnchor constraintEqualToConstant:kToolbarHeight], |
| + [_toolbarContent.leadingAnchor |
| constraintEqualToAnchor:toolbarView.contentView.leadingAnchor], |
| - [toolbarContent.trailingAnchor |
| + [_toolbarContent.trailingAnchor |
| constraintEqualToAnchor:toolbarView.contentView.trailingAnchor], |
| - [toolbarContent.bottomAnchor |
| + [_toolbarContent.bottomAnchor |
| constraintEqualToAnchor:toolbarView.contentView.bottomAnchor] |
| ]]; |
| } |
| return self; |
| } |
| +#pragma mark - ZoomTransitionDelegate |
| + |
| +- (CGRect)rectForZoomWithKey:(NSObject*)key inView:(UIView*)view { |
| + UIButton* menuButton = base::mac::ObjCCastStrict<UIButton>( |
| + [self.toolbarContent.arrangedSubviews lastObject]); |
|
edchin
2017/04/12 09:13:37
arrangedSubviews is already an array of UIViews. Y
sczs
2017/04/12 15:44:59
Done.
|
| + CGRect rect = [view convertRect:menuButton.bounds fromView:menuButton]; |
| + return rect; |
|
edchin
2017/04/12 09:13:37
nit: Use single line instead of two.
return [view
sczs
2017/04/12 15:44:59
Done.
|
| +} |
| + |
| #pragma mark - UIView |
| // Returns an intrinsic height so that explicit height constraints are |