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

Stop animator in final position if no animation

If the omnibox expansion should be done without animation, stop the
animator in its final position right after it begins.

Bug: 791033
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I7af68d6dcd43a0643365003f2b7fff70fec3dc72
Reviewed-on: https://chromium-review.googlesource.com/803714Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521632}
parent cdce727d
...@@ -540,10 +540,9 @@ ...@@ -540,10 +540,9 @@
// There's no Toolbar expanding on iPad. // There's no Toolbar expanding on iPad.
if (IsIPadIdiom()) if (IsIPadIdiom())
return; return;
NSTimeInterval duration = animated ? ios::material::kDuration1 : 0;
UIViewPropertyAnimator* animator = [[UIViewPropertyAnimator alloc] UIViewPropertyAnimator* animator = [[UIViewPropertyAnimator alloc]
initWithDuration:duration initWithDuration:ios::material::kDuration1
curve:UIViewAnimationCurveEaseInOut curve:UIViewAnimationCurveEaseInOut
animations:^{ animations:^{
}]; }];
...@@ -551,6 +550,11 @@ ...@@ -551,6 +550,11 @@
[self.locationBarView addExpandOmniboxAnimations:animator]; [self.locationBarView addExpandOmniboxAnimations:animator];
[self.toolbarViewController addToolbarExpansionAnimations:animator]; [self.toolbarViewController addToolbarExpansionAnimations:animator];
[animator startAnimation]; [animator startAnimation];
if (!animated) {
[animator stopAnimation:NO];
[animator finishAnimationAtPosition:UIViewAnimatingPositionEnd];
}
} }
// Animates |_toolbar| and |_locationBarView| for omnibox contraction. // Animates |_toolbar| and |_locationBarView| for omnibox contraction.
......
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