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

Unified Diff: ios/chrome/browser/ui/favicon/favicon_view.mm

Issue 2785053003: Default state for the favicon view (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/favicon/favicon_view.mm
diff --git a/ios/chrome/browser/ui/favicon/favicon_view.mm b/ios/chrome/browser/ui/favicon/favicon_view.mm
index 3857c898e60d6173e79ae969983d20f701a0931c..9a5486f301fc6ff261cee8d05e7124c285dd9e4a 100644
--- a/ios/chrome/browser/ui/favicon/favicon_view.mm
+++ b/ios/chrome/browser/ui/favicon/favicon_view.mm
@@ -13,6 +13,8 @@
namespace {
// Default corner radius for the favicon image view.
const CGFloat kDefaultCornerRadius = 3;
+// Percentage of white for the default background, when there is no attributes.
+const CGFloat kDefaultWhitePercentage = 0.47;
}
@interface FaviconViewNew () {
@@ -39,7 +41,8 @@ const CGFloat kDefaultCornerRadius = 3;
_faviconImageView.image = nil;
_faviconFallbackLabel = [[UILabel alloc] initWithFrame:self.bounds];
- _faviconFallbackLabel.backgroundColor = [UIColor clearColor];
+ _faviconFallbackLabel.backgroundColor =
+ [UIColor colorWithWhite:kDefaultWhitePercentage alpha:1];
_faviconFallbackLabel.textAlignment = NSTextAlignmentCenter;
_faviconFallbackLabel.isAccessibilityElement = NO;
_faviconFallbackLabel.clipsToBounds = YES;
@@ -62,6 +65,15 @@ const CGFloat kDefaultCornerRadius = 3;
}
- (void)configureWithAttributes:(FaviconAttributes*)attributes {
+ if (!attributes) {
+ self.faviconFallbackLabel.backgroundColor =
+ [UIColor colorWithWhite:kDefaultWhitePercentage alpha:1];
+ self.faviconFallbackLabel.text = nil;
+ self.faviconFallbackLabel.hidden = NO;
+ self.faviconImageView.hidden = YES;
+ return;
+ }
+
if (attributes.faviconImage) {
self.faviconImageView.image = attributes.faviconImage;
self.faviconImageView.hidden = NO;
« no previous file with comments | « ios/chrome/browser/ui/favicon/favicon_view.h ('k') | ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698