| OLD | NEW |
| 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 #import "ios/chrome/browser/ui/favicon/favicon_view.h" | 5 #import "ios/chrome/browser/ui/favicon/favicon_view.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 7 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 _faviconFallbackLabel.layer.cornerRadius = kDefaultCornerRadius; | 49 _faviconFallbackLabel.layer.cornerRadius = kDefaultCornerRadius; |
| 50 _faviconFallbackLabel.text = nil; | 50 _faviconFallbackLabel.text = nil; |
| 51 | 51 |
| 52 [self addSubview:_faviconFallbackLabel]; | 52 [self addSubview:_faviconFallbackLabel]; |
| 53 [self addSubview:_faviconImageView]; | 53 [self addSubview:_faviconImageView]; |
| 54 | 54 |
| 55 [_faviconImageView setTranslatesAutoresizingMaskIntoConstraints:NO]; | 55 [_faviconImageView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| 56 [_faviconFallbackLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; | 56 [_faviconFallbackLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| 57 | 57 |
| 58 // Both image and fallback label are centered and match the size of favicon. | 58 // Both image and fallback label are centered and match the size of favicon. |
| 59 AddSameCenterConstraints(_faviconImageView, self); | 59 AddSameConstraints(_faviconFallbackLabel, self); |
| 60 AddSameCenterConstraints(_faviconFallbackLabel, self); | 60 AddSameConstraints(_faviconImageView, self); |
| 61 AddSameSizeConstraint(_faviconFallbackLabel, self); | |
| 62 AddSameSizeConstraint(_faviconImageView, self); | |
| 63 } | 61 } |
| 64 return self; | 62 return self; |
| 65 } | 63 } |
| 66 | 64 |
| 67 - (void)configureWithAttributes:(FaviconAttributes*)attributes { | 65 - (void)configureWithAttributes:(FaviconAttributes*)attributes { |
| 68 if (!attributes) { | 66 if (!attributes) { |
| 69 self.faviconFallbackLabel.backgroundColor = | 67 self.faviconFallbackLabel.backgroundColor = |
| 70 [UIColor colorWithWhite:kDefaultWhitePercentage alpha:1]; | 68 [UIColor colorWithWhite:kDefaultWhitePercentage alpha:1]; |
| 71 self.faviconFallbackLabel.text = nil; | 69 self.faviconFallbackLabel.text = nil; |
| 72 self.faviconFallbackLabel.hidden = NO; | 70 self.faviconFallbackLabel.hidden = NO; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 91 self.faviconFallbackLabel.font = font; | 89 self.faviconFallbackLabel.font = font; |
| 92 } | 90 } |
| 93 | 91 |
| 94 #pragma mark - UIView | 92 #pragma mark - UIView |
| 95 | 93 |
| 96 - (CGSize)intrinsicContentSize { | 94 - (CGSize)intrinsicContentSize { |
| 97 return CGSizeMake(kFaviconPreferredSize, kFaviconPreferredSize); | 95 return CGSizeMake(kFaviconPreferredSize, kFaviconPreferredSize); |
| 98 } | 96 } |
| 99 | 97 |
| 100 @end | 98 @end |
| OLD | NEW |