Skip to content

Commit

Permalink
[iOS][MICE] Fix janky transition animations in web sign-in.
Browse files Browse the repository at this point in the history
Ensure that the total container height is set with the same value across
all subviews.

Fixed: 1228678
Change-Id: I4e9f250b11bf560a28fbe4c6b527c0afab3bb901
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3059486
Auto-Submit: Nohemi Fernandez <fernandex@chromium.org>
Commit-Queue: Jérôme <jlebel@chromium.org>
Reviewed-by: Jérôme <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#906788}
  • Loading branch information
Nohemi Fernandez authored and Chromium LUCI CQ committed Jul 29, 2021
1 parent b81b778 commit 63a9421
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ source_set("consistency_sheet") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"child_consistency_sheet_view_controller.h",
"consistency_sheet_constants.h",
"consistency_sheet_constants.mm",
"consistency_sheet_navigation_controller.h",
"consistency_sheet_navigation_controller.mm",
"consistency_sheet_presentation_controller.h",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_CONSISTENCY_PROMO_SIGNIN_CONSISTENCY_SHEET_CONSISTENCY_SHEET_CONSTANTS_H_
#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_CONSISTENCY_PROMO_SIGNIN_CONSISTENCY_SHEET_CONSISTENCY_SHEET_CONSTANTS_H_

#import <UIKit/UIKit.h>

// Maximum height ratio for the bottom sheet container view.
extern const CGFloat kMaxBottomSheetHeightRatioWithWindow;

#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_CONSISTENCY_PROMO_SIGNIN_CONSISTENCY_SHEET_CONSISTENCY_SHEET_CONSTANTS_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_sheet/consistency_sheet_constants.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif

const CGFloat kMaxBottomSheetHeightRatioWithWindow = 0.75;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "base/check.h"
#import "base/notreached.h"
#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_sheet/child_consistency_sheet_view_controller.h"
#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_sheet/consistency_sheet_constants.h"
#import "ios/chrome/browser/ui/authentication/signin/signin_constants.h"
#import "ios/chrome/common/ui/util/background_util.h"

Expand All @@ -18,9 +19,6 @@

namespace {

// Maximum height for ConsistencySheetNavigationController. This is a ratio
// related the window height.
constexpr CGFloat kMaxBottomSheetHeightRatioWithWindow = .75;
// Corner radius for centered style dialog.
constexpr CGFloat kCornerRadius = 12.;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_sheet/consistency_sheet_presentation_controller.h"

#import "base/check_op.h"
#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_sheet/consistency_sheet_constants.h"
#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_sheet/consistency_sheet_navigation_controller.h"
#import "ios/chrome/browser/ui/image_util/image_util.h"
#import "ios/chrome/browser/ui/util/accessibility_close_menu_button.h"
Expand Down Expand Up @@ -62,7 +63,7 @@ - (CGRect)frameOfPresentedViewInContainerView {
CGFloat width = availableWidth / 2.;
CGFloat height = MIN(
[self.navigationController layoutFittingSizeForWidth:width].height,
availableHeight / 2.);
availableHeight * kMaxBottomSheetHeightRatioWithWindow);

presentedViewFrame.origin.x += (availableWidth - width) / 2.;
presentedViewFrame.origin.y += (availableHeight - height) / 2.;
Expand Down

0 comments on commit 63a9421

Please sign in to comment.