Commit e31847db authored by adamta's avatar adamta Committed by Commit Bot

[iOS] Center Discover feed header for wider devices

Ensures that label and menu button don't surpass Discover feed cards in
Bling NTP. Mulder team recommends hardcoding a value since they can't
easily expose the card content width.

Bug: 1109685, 1085419
Change-Id: I2458a48464625d58009317cef3e4fc4ffc3453df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2325378
Commit-Queue: Adam Trudeau-Arcaro <adamta@google.com>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793621}
parent 0c0ee38a
......@@ -48,7 +48,7 @@ namespace {
using CSCollectionViewItem = CollectionViewItem<SuggestedContent>;
const CGFloat kMostVisitedBottomMargin = 13;
const CGFloat kCardBorderRadius = 11;
const CGFloat kDiscoverFeedContentWith = 430;
}
NSString* const kContentSuggestionsMostVisitedAccessibilityIdentifierPrefix =
......@@ -492,8 +492,7 @@ NSString* const kContentSuggestionsMostVisitedAccessibilityIdentifierPrefix =
UIEdgeInsets parentInset = [super collectionView:collectionView
layout:collectionViewLayout
insetForSectionAtIndex:section];
if ([self.collectionUpdater isHeaderSection:section] ||
[self.collectionUpdater isDiscoverSection:section]) {
if ([self.collectionUpdater isHeaderSection:section]) {
parentInset.top = 0;
parentInset.left = 0;
parentInset.right = 0;
......@@ -506,6 +505,13 @@ NSString* const kContentSuggestionsMostVisitedAccessibilityIdentifierPrefix =
if ([self.collectionUpdater isMostVisitedSection:section]) {
parentInset.bottom = kMostVisitedBottomMargin;
}
} else if ([self.collectionUpdater isDiscoverSection:section]) {
// TODO(crbug.com/1085419): Get card width from Mulder.
CGFloat feedCardWidth = kDiscoverFeedContentWith;
CGFloat margin =
MAX(0, (collectionView.frame.size.width - feedCardWidth) / 2);
parentInset.left = margin;
parentInset.right = margin;
} else if (self.styler.cellStyle == MDCCollectionViewCellStyleCard) {
CGFloat collectionWidth = collectionView.bounds.size.width;
CGFloat maxCardWidth =
......
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