Commit 1ec680be authored by gambard's avatar gambard Committed by Commit Bot

Update fake omnibox width on rotation

When rotating the device, the omnibox width should be set to the new
width. This width computation needs to take into account the y offset
of the collection and its new size.
So the calculation needs to be started from the collection.

Bug: 750637
Change-Id: I14dc8f878b815f7f32bd33f88691e9b39782e0d4
Reviewed-on: https://chromium-review.googlesource.com/595741Reviewed-by: default avatarElodie Banel <lod@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490956}
parent 59784d15
......@@ -124,21 +124,6 @@ const CGFloat kHintLabelSidePadding = 12;
[self.headerView hideToolbarViewsForNewTabPage];
}
#pragma mark - UIViewController
- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:
(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
void (^alongsideBlock)(id<UIViewControllerTransitionCoordinatorContext>) =
^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.fakeOmniboxWidthConstraint
setConstant:content_suggestions::searchFieldWidth(size.width)];
};
[coordinator animateAlongsideTransition:alongsideBlock completion:nil];
}
#pragma mark - ContentSuggestionsHeaderControlling
- (void)updateSearchFieldForOffset:(CGFloat)offset {
......
......@@ -210,6 +210,13 @@ BOOL ShouldCellsBeFullWidth(UITraitCollection* collection) {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[self.collectionUpdater updateMostVisitedForSize:size];
[self.collectionView reloadData];
void (^alongsideBlock)(id<UIViewControllerTransitionCoordinatorContext>) =
^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.headerCommandHandler
updateFakeOmniboxForScrollView:self.collectionView];
};
[coordinator animateAlongsideTransition:alongsideBlock completion:nil];
}
- (void)willTransitionToTraitCollection:(UITraitCollection*)newCollection
......
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