Commit b999ed4a authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Update the toolbars in BVC's viewWillAppear

This CL changes how the broadcasted value of toolbar height is done.
The value is now broadcasted when the view will become visible instead
of when it did become visible.
Using this, the toolbar insets are updated when the view will become
visible, allowing a smoother animation when the screen has been rotated
in background.

Bug: 908796
Change-Id: I49e42fa9246ff76fc702243a3f6571cb81ab912c
Reviewed-on: https://chromium-review.googlesource.com/c/1356588Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613045}
parent 30cc3223
...@@ -1067,6 +1067,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -1067,6 +1067,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
return; return;
_visible = visible; _visible = visible;
[self updateBroadcastState];
} }
- (void)setViewVisible:(BOOL)viewVisible { - (void)setViewVisible:(BOOL)viewVisible {
...@@ -1075,7 +1076,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -1075,7 +1076,6 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
_viewVisible = viewVisible; _viewVisible = viewVisible;
self.visible = viewVisible; self.visible = viewVisible;
[self updateDialogPresenterActiveState]; [self updateDialogPresenterActiveState];
[self updateBroadcastState];
} }
- (void)setBroadcasting:(BOOL)broadcasting { - (void)setBroadcasting:(BOOL)broadcasting {
...@@ -1639,6 +1639,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -1639,6 +1639,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
self.viewVisible = YES; self.viewVisible = YES;
[self updateDialogPresenterActiveState]; [self updateDialogPresenterActiveState];
[self updateBroadcastState]; [self updateBroadcastState];
[_toolbarUIUpdater updateState];
// |viewDidAppear| can be called after |browserState| is destroyed. Since // |viewDidAppear| can be called after |browserState| is destroyed. Since
// |presentBubblesIfEligible| requires that |self.browserState| is not NULL, // |presentBubblesIfEligible| requires that |self.browserState| is not NULL,
...@@ -1745,10 +1746,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -1745,10 +1746,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
self.currentWebState->GetWebViewProxy().contentInset = contentPadding; self.currentWebState->GetWebViewProxy().contentInset = contentPadding;
} }
if (self.traitCollection.preferredContentSizeCategory != [_toolbarUIUpdater updateState];
previousTraitCollection.preferredContentSizeCategory) {
[_toolbarUIUpdater updateState];
}
// If the device's size class has changed from RegularXRegular to another and // If the device's size class has changed from RegularXRegular to another and
// vice-versa, the find bar should switch between regular mode and compact // vice-versa, the find bar should switch between regular mode and compact
...@@ -2442,7 +2440,12 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -2442,7 +2440,12 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
// Make new content visible, resizing it first as the orientation may // Make new content visible, resizing it first as the orientation may
// have changed from the last time it was displayed. // have changed from the last time it was displayed.
[self viewForTab:tab].frame = self.contentArea.bounds; if (base::FeatureList::IsEnabled(
web::features::kBrowserContainerFullscreen)) {
[_toolbarUIUpdater updateState];
} else {
[self viewForTab:tab].frame = self.contentArea.bounds;
}
NewTabPageTabHelper* NTPHelper = NewTabPageTabHelper* NTPHelper =
NewTabPageTabHelper::FromWebState(tab.webState); NewTabPageTabHelper::FromWebState(tab.webState);
if (NTPHelper && NTPHelper->IsActive()) { if (NTPHelper && NTPHelper->IsActive()) {
...@@ -2527,7 +2530,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -2527,7 +2530,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
} }
- (void)updateBroadcastState { - (void)updateBroadcastState {
self.broadcasting = self.active && self.viewVisible; self.broadcasting = self.active && self.visible;
} }
- (void)updateDialogPresenterActiveState { - (void)updateDialogPresenterActiveState {
......
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