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..0e86e42a6849e78e52e510e7d631a85f118da4e0 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, strong) UIStackView* toolbarContent; |
|
edchin
2017/04/10 05:50:57
Since this is added as a subview, it can be weak.
sczs
2017/04/11 18:47:59
Done.
|
| +@end |
| + |
| @implementation TabGridToolbar |
| +@synthesize toolbarContent = _toolbarContent; |
| + |
| - (instancetype)init { |
| if (self = [super init]) { |
| UIVisualEffect* blurEffect = |
| @@ -26,25 +33,35 @@ const CGFloat kToolbarHeight = 44.0f; |
| UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
| [self addSubview:toolbarView]; |
| - UIStackView* toolbarContent = [UIStackView cr_tabGridToolbarStackView]; |
| - [toolbarView.contentView addSubview:toolbarContent]; |
| + self.toolbarContent = [UIStackView cr_tabGridToolbarStackView]; |
| + [toolbarView.contentView addSubview:self.toolbarContent]; |
| // Sets the stackview to a fixed height, anchored to the bottom of the |
| // blur view. |
| - toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; |
| + self.toolbarContent.translatesAutoresizingMaskIntoConstraints = NO; |
|
edchin
2017/04/10 05:50:57
Use direct access in partially constructed states.
marq (ping after 24h)
2017/04/10 11:36:39
It's not explicitly defined, but it's a widely-acc
sczs
2017/04/11 18:47:59
Done.
|
| [NSLayoutConstraint activateConstraints:@[ |
| - [toolbarContent.heightAnchor constraintEqualToConstant:kToolbarHeight], |
| - [toolbarContent.leadingAnchor |
| + [self.toolbarContent.heightAnchor |
| + constraintEqualToConstant:kToolbarHeight], |
| + [self.toolbarContent.leadingAnchor |
| constraintEqualToAnchor:toolbarView.contentView.leadingAnchor], |
| - [toolbarContent.trailingAnchor |
| + [self.toolbarContent.trailingAnchor |
| constraintEqualToAnchor:toolbarView.contentView.trailingAnchor], |
| - [toolbarContent.bottomAnchor |
| + [self.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/10 05:50:57
Feel free to move the stackview construction and b
sczs
2017/04/11 18:47:59
Acknowledged.
|
| + CGRect rect = [view convertRect:menuButton.bounds fromView:menuButton]; |
| + return rect; |
| +} |
| + |
| #pragma mark - UIView |
| // Returns an intrinsic height so that explicit height constraints are |