Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_collection_view_layout.h" | 5 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_collection_view_layout.h" |
| 6 | 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) | 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." | 8 #error "This file requires ARC support." |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 const CGFloat kMinTabWidth = 200.0f; | 12 const CGFloat kMinTabWidth = 200.0f; |
| 13 const CGFloat kMaxTabWidth = 250.0f; | 13 const CGFloat kMaxTabWidth = 250.0f; |
| 14 const CGFloat kInterTabSpacing = 20.0f; | 14 const CGFloat kInterTabSpacing = 20.0f; |
| 15 const UIEdgeInsets kSectionInset = {20.0f, 20.0f, 20.0f, 20.0f}; | 15 const UIEdgeInsets kSectionInset = {10.0f, 20.0f, 20.0f, 20.0f}; |
|
marq (ping after 24h)
2017/03/02 06:04:54
Nit: Prefer not to use static struct assignment to
edchin
2017/03/02 07:12:43
Will do.
edchin
2017/03/16 07:19:59
Done.
| |
| 16 } | 16 } |
| 17 | 17 |
| 18 @implementation TabGridCollectionViewLayout | 18 @implementation TabGridCollectionViewLayout |
| 19 | 19 |
| 20 #pragma mark - UICollectionViewLayout | 20 #pragma mark - UICollectionViewLayout |
| 21 | 21 |
| 22 // This is called whenever the layout is invalidated, including during rotation. | 22 // This is called whenever the layout is invalidated, including during rotation. |
| 23 - (void)prepareLayout { | 23 - (void)prepareLayout { |
| 24 [super prepareLayout]; | 24 [super prepareLayout]; |
| 25 [self updateLayoutWithBounds:[[self collectionView] bounds].size]; | 25 [self updateLayoutWithBounds:[[self collectionView] bounds].size]; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 37 columns++; | 37 columns++; |
| 38 tabWidth = (boundsSize.width - kInterTabSpacing * (columns + 1)) / columns; | 38 tabWidth = (boundsSize.width - kInterTabSpacing * (columns + 1)) / columns; |
| 39 } | 39 } |
| 40 self.itemSize = CGSizeMake(tabWidth, tabWidth); | 40 self.itemSize = CGSizeMake(tabWidth, tabWidth); |
| 41 self.sectionInset = kSectionInset; | 41 self.sectionInset = kSectionInset; |
| 42 self.minimumLineSpacing = kInterTabSpacing; | 42 self.minimumLineSpacing = kInterTabSpacing; |
| 43 self.minimumInteritemSpacing = kInterTabSpacing; | 43 self.minimumInteritemSpacing = kInterTabSpacing; |
| 44 } | 44 } |
| 45 | 45 |
| 46 @end | 46 @end |
| OLD | NEW |