Commit e96d2112 authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] fix NTP size in animation

This CL fixes the size distortion of the incognito NTP in the new tab animation.

The foreground animation view was assuming that the content view it animated had the same bounds as itself; this isn't correct for the incognito NTP, which is shorter to accommodate the toolbar. This CL instead repositions the content view correctly without resizing it. It also makes the animation view shorter (by StatusBarHeight()) to make this calculation cleaner.

Bug: 868292
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Id49a3de2f3f62c246356da082f74285014a7b37a
Reviewed-on: https://chromium-review.googlesource.com/1160843Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580459}
parent 2b490039
......@@ -5369,8 +5369,11 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
// UI Refresh animation.
if (IsUIRefreshPhase1Enabled()) {
// The animation will have the same frame as |self|, minus the status bar,
// so shift it down and reduce its height accordingly.
CGRect frame = self.view.bounds;
frame.origin.y += StatusBarHeight();
frame.size.height -= StatusBarHeight();
frame = [self.contentArea convertRect:frame fromView:self.view];
ForegroundTabAnimationView* animatedView =
[[ForegroundTabAnimationView alloc] initWithFrame:frame];
......
......@@ -33,7 +33,13 @@ const CGFloat kPositionCoefficient = 0.25;
- (void)animateFrom:(CGPoint)originPoint withCompletion:(void (^)())completion {
CGPoint origin = [self convertPoint:originPoint fromView:nil];
self.contentView.frame = self.bounds;
// Position the content view so it sits at the bottom of |self|.
CGRect frame = self.contentView.frame;
CGFloat offset = self.frame.size.height - frame.size.height;
frame.origin.y = offset;
self.contentView.frame = frame;
self.backgroundColor = UIColor.clearColor;
// Translate the content view part of the way from the center of this view to
......
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