| 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/history/favicon_view.h" | 5 #import "ios/chrome/browser/ui/history/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 30 matching lines...) Expand all Loading... |
| 41 _faviconFallbackLabel.backgroundColor = [UIColor clearColor]; | 41 _faviconFallbackLabel.backgroundColor = [UIColor clearColor]; |
| 42 _faviconFallbackLabel.textAlignment = NSTextAlignmentCenter; | 42 _faviconFallbackLabel.textAlignment = NSTextAlignmentCenter; |
| 43 _faviconFallbackLabel.isAccessibilityElement = NO; | 43 _faviconFallbackLabel.isAccessibilityElement = NO; |
| 44 _faviconFallbackLabel.text = nil; | 44 _faviconFallbackLabel.text = nil; |
| 45 | 45 |
| 46 [self addSubview:_faviconImage]; | 46 [self addSubview:_faviconImage]; |
| 47 [self addSubview:_faviconFallbackLabel]; | 47 [self addSubview:_faviconFallbackLabel]; |
| 48 | 48 |
| 49 [_faviconImage setTranslatesAutoresizingMaskIntoConstraints:NO]; | 49 [_faviconImage setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| 50 [_faviconFallbackLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; | 50 [_faviconFallbackLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; |
| 51 AddSameCenterConstraints(_faviconImage, self); | 51 AddSameConstraints(_faviconImage, self); |
| 52 AddSameSizeConstraint(_faviconImage, self); | 52 AddSameConstraints(_faviconFallbackLabel, self); |
| 53 AddSameCenterConstraints(_faviconFallbackLabel, self); | |
| 54 AddSameSizeConstraint(_faviconFallbackLabel, self); | |
| 55 _faviconSizeConstraints = @[ | 53 _faviconSizeConstraints = @[ |
| 56 [self.widthAnchor constraintEqualToConstant:0], | 54 [self.widthAnchor constraintEqualToConstant:0], |
| 57 [self.heightAnchor constraintEqualToConstant:0], | 55 [self.heightAnchor constraintEqualToConstant:0], |
| 58 ]; | 56 ]; |
| 59 [NSLayoutConstraint activateConstraints:_faviconSizeConstraints]; | 57 [NSLayoutConstraint activateConstraints:_faviconSizeConstraints]; |
| 60 } | 58 } |
| 61 return self; | 59 return self; |
| 62 } | 60 } |
| 63 | 61 |
| 64 - (void)setSize:(CGFloat)size { | 62 - (void)setSize:(CGFloat)size { |
| 65 _size = size; | 63 _size = size; |
| 66 for (NSLayoutConstraint* constraint in self.faviconSizeConstraints) { | 64 for (NSLayoutConstraint* constraint in self.faviconSizeConstraints) { |
| 67 constraint.constant = size; | 65 constraint.constant = size; |
| 68 } | 66 } |
| 69 } | 67 } |
| 70 | 68 |
| 71 @end | 69 @end |
| OLD | NEW |