Commit 6807a9f4 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Update NTP header view constraints on view load.

Bug: 859555
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I6c4c564f12ee0acb89fdcc9538f89e4277f1461a
Reviewed-on: https://chromium-review.googlesource.com/1139528Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575605}
parent 3553913a
......@@ -35,6 +35,9 @@
// Calls layoutIfNeeded on the header.
- (void)layoutHeader;
// Update any dynamic constraints.
- (void)updateConstraints;
// Returns the Y value to use for the scroll view's contentOffset when scrolling
// the omnibox to the top of the screen.
- (CGFloat)pinnedOffsetY;
......
......@@ -207,6 +207,10 @@ initWithCollectionController:
}
}
- (void)updateConstraints {
[self.headerController updateConstraints];
}
- (void)unfocusOmnibox {
[self.headerController unfocusOmnibox];
}
......
......@@ -21,6 +21,9 @@
// Unfocuses the omnibox.
- (void)unfocusOmnibox;
// Update any dynamic constraints.
- (void)updateConstraints;
// Returns the Y value to use for the scroll view's contentOffset when scrolling
// the omnibox to the top of the screen.
- (CGFloat)pinnedOffsetY;
......
......@@ -135,10 +135,7 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3};
if (IsSplitToolbarMode()) {
[self.toolbarDelegate setScrollProgressForTabletOmnibox:1];
}
// Update the doodle top margin to the new -doodleTopMargin value.
self.doodleTopMarginConstraint.constant =
content_suggestions::doodleTopMargin(YES);
[self updateConstraints];
};
[coordinator animateAlongsideTransition:transition completion:nil];
......@@ -198,6 +195,12 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3};
[self.headerView layoutIfNeeded];
}
// Update the doodle top margin to the new -doodleTopMargin value.
- (void)updateConstraints {
self.doodleTopMarginConstraint.constant =
content_suggestions::doodleTopMargin(YES);
}
- (CGFloat)pinnedOffsetY {
CGFloat headerHeight = content_suggestions::heightForLogoHeader(
self.logoIsShowing, self.promoCanShow, YES);
......
......@@ -193,6 +193,7 @@ BOOL ShouldCellsBeFullWidth(UITraitCollection* collection) {
updateMostVisitedForSize:self.collectionView.bounds.size];
[self.headerSynchronizer
updateFakeOmniboxOnNewWidth:self.collectionView.bounds.size.width];
[self.headerSynchronizer updateConstraints];
[self.collectionView reloadData];
if (ShouldCellsBeFullWidth(
[UIApplication sharedApplication].keyWindow.traitCollection)) {
......
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