Commit 4eaca7ca authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Various NTP fixes for UI Refresh.

-Fix tapping NTP action cells when omnibox is focused.
-Do not remove action items when most visited is empty.
-Disable dynamic type sizes on most visited and action items.
-Fix omnibox visibility on iPad when search provider changes.

Bug: 846764, 852108, 850469, 848762
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ie1c38be47fb9a60325387a78f55eb1a548dae831
Reviewed-on: https://chromium-review.googlesource.com/1110148
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570777}
parent 8e2b0520
......@@ -35,8 +35,7 @@ const CGFloat kCountBorderWidth = 24;
if (self) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = [UIColor colorWithWhite:0 alpha:kTitleAlpha];
_titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
_titleLabel.font = [UIFont systemFontOfSize:12];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.preferredMaxLayoutWidth = [[self class] defaultSize].width;
_titleLabel.numberOfLines = kLabelNumLines;
......
......@@ -33,8 +33,7 @@ const CGFloat kIconSizeLegacy = 48;
_titleLabel = [[UILabel alloc] init];
if (IsUIRefreshPhase1Enabled()) {
_titleLabel.textColor = [UIColor colorWithWhite:0 alpha:kTitleAlpha];
_titleLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
_titleLabel.font = [UIFont systemFontOfSize:12];
} else {
_titleLabel.textColor =
[UIColor colorWithWhite:kLabelTextColor alpha:1.0];
......@@ -46,12 +45,10 @@ const CGFloat kIconSizeLegacy = 48;
_faviconView = [[FaviconViewNew alloc] init];
if (IsUIRefreshPhase1Enabled()) {
_faviconView.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleTitle2];
_faviconView.font = [UIFont systemFontOfSize:22];
} else {
_faviconView.font = [MDCTypography headlineFont];
}
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_faviconView.translatesAutoresizingMaskIntoConstraints = NO;
......
......@@ -232,8 +232,7 @@ void configureSearchHintLabel(UILabel* searchHintLabel,
}
if (IsUIRefreshPhase1Enabled()) {
[searchHintLabel setTextColor:[UIColor colorWithWhite:0 alpha:kHintAlpha]];
searchHintLabel.font =
[UIFont preferredFontForTextStyle:UIFontTextStyleTitle3];
searchHintLabel.font = [UIFont systemFontOfSize:20];
} else {
[searchHintLabel
setTextColor:
......
......@@ -7,6 +7,7 @@
#include "base/ios/ios_util.h"
#import "base/mac/foundation_util.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cell.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_action_cell.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_cell.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_controlling.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h"
......@@ -166,6 +167,7 @@ initWithCollectionController:
}
- (void)invalidateLayout {
[self updateFakeOmniboxOnNewWidth:self.collectionView.bounds.size.width];
[self.collectionView.collectionViewLayout invalidateLayout];
}
......@@ -262,10 +264,13 @@ initWithCollectionController:
BOOL isMostVisitedCell =
content_suggestions::nearestAncestor(
touch.view, [ContentSuggestionsMostVisitedCell class]) != nil;
BOOL isMostVisitedActionCell =
content_suggestions::nearestAncestor(
touch.view, [ContentSuggestionsMostVisitedActionCell class]) != nil;
BOOL isSuggestionCell =
content_suggestions::nearestAncestor(
touch.view, [ContentSuggestionsCell class]) != nil;
return !isMostVisitedCell && !isSuggestionCell;
return !isMostVisitedCell && !isMostVisitedActionCell && !isSuggestionCell;
}
- (UIView*)nearestAncestorOfView:(UIView*)view withClass:(Class)aClass {
......
......@@ -162,8 +162,10 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3};
self.headerView.cr_heightSizeClass == REGULAR &&
IsUIRefreshPhase1Enabled()) {
CGFloat progress =
[self.headerView searchFieldProgressForOffset:offset
safeAreaInsets:safeAreaInsets];
self.logoIsShowing
? [self.headerView searchFieldProgressForOffset:offset
safeAreaInsets:safeAreaInsets]
: 1;
if (self.isShowing) {
[self.toolbarDelegate setScrollProgressForTabletOmnibox:progress];
}
......
......@@ -218,7 +218,9 @@ initWithContentService:(ntp_snippets::ContentSuggestionsService*)contentService
[sectionsInfo addObject:self.promoSectionInfo];
}
if (self.mostVisitedItems.count > 0) {
// Since action items are always visible in UI Refresh, always add
// |mostVisitedSectionInfo| in UI Refresh.
if (self.mostVisitedItems.count > 0 || IsUIRefreshPhase1Enabled()) {
[sectionsInfo addObject:self.mostVisitedSectionInfo];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment