Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: ios/clean/chrome/browser/ui/tab_grid/tab_grid_tab_cell.mm

Issue 2716773003: Revert "Revert of [tab_grid] Hack-in border for active tab. (patchset #5 id:80001 of https://codere… (Closed)
Patch Set: Fix cell refresh logic. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ====== New Architecture ===== 5 // ====== New Architecture =====
6 // = This code is only used in the new iOS Chrome architecture. = 6 // = This code is only used in the new iOS Chrome architecture. =
7 // ============================================================================ 7 // ============================================================================
8 8
9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_tab_cell.h" 9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_tab_cell.h"
10 10
11 #if !defined(__has_feature) || !__has_feature(objc_arc) 11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support." 12 #error "This file requires ARC support."
13 #endif 13 #endif
14 14
15 namespace { 15 namespace {
16 const CGFloat kCornerRadius = 4.0; 16 const CGFloat kSelectedBorderCornerRadius = 8.0f;
17 const CGFloat kSelectedBorderWidth = 2.0; 17 const CGFloat kSelectedBorderWidth = 4.0f;
18 } 18 }
19 19
20 @implementation TabGridTabCell 20 @implementation TabGridTabCell
21 21
22 @synthesize label = _label;
23
24 - (instancetype)initWithFrame:(CGRect)frame { 22 - (instancetype)initWithFrame:(CGRect)frame {
25 if ((self = [super initWithFrame:frame])) { 23 if ((self = [super initWithFrame:frame])) {
26 self.contentView.layer.cornerRadius = kCornerRadius; 24 self.selectedBackgroundView = [[UIView alloc] init];
27 self.selectedBackgroundView.layer.cornerRadius = kCornerRadius; 25 self.selectedBackgroundView.backgroundColor = [UIColor blackColor];
26 self.selectedBackgroundView.layer.cornerRadius =
27 kSelectedBorderCornerRadius;
28 self.selectedBackgroundView.layer.borderWidth = kSelectedBorderWidth; 28 self.selectedBackgroundView.layer.borderWidth = kSelectedBorderWidth;
29 self.selectedBackgroundView.layer.borderColor = [UIColor blueColor].CGColor; 29 self.selectedBackgroundView.layer.borderColor = self.tintColor.CGColor;
30 self.selectedBackgroundView.transform = CGAffineTransformScale( 30 self.selectedBackgroundView.transform = CGAffineTransformScale(
31 self.selectedBackgroundView.transform, 1.05, 1.05); 31 self.selectedBackgroundView.transform, 1.08, 1.08);
32
33 _label = [[UILabel alloc] initWithFrame:CGRectZero];
34 _label.translatesAutoresizingMaskIntoConstraints = NO;
35 _label.numberOfLines = 1;
36 _label.textAlignment = NSTextAlignmentCenter;
37 [self.contentView addSubview:_label];
38 [NSLayoutConstraint activateConstraints:@[
39 [_label.centerYAnchor
40 constraintEqualToAnchor:self.contentView.centerYAnchor],
41 [_label.leadingAnchor
42 constraintEqualToAnchor:self.contentView.layoutMarginsGuide
43 .leadingAnchor],
44 [_label.trailingAnchor
45 constraintEqualToAnchor:self.contentView.layoutMarginsGuide
46 .trailingAnchor],
47 ]];
48 } 32 }
49 return self; 33 return self;
50 } 34 }
51 35
52 @end 36 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698