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

[iOS] Change the doodle top margin calculation

This CL changes the way the top margin of the doodle is computed when
the fullscreen flags are enabled and the NTP isn't contained directly
in BVC. It uses the StatusBarHeight() instead of the passed topMargin
which is wrong on cold start.

Bug: 902259
Test: M71 fix, test all types of new tab animation and ntp layout.
Change-Id: I33af04db418664c6fd033477329353d645379f4c
Reviewed-on: https://chromium-review.googlesource.com/c/1337498
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609737}
parent 401a63f8
......@@ -158,12 +158,14 @@ source_set("content_suggestions_ui_util") {
"//components/strings",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/content_suggestions/cells:cells_ui",
"//ios/chrome/browser/ui/location_bar:constants",
"//ios/chrome/browser/ui/ntp",
"//ios/chrome/browser/ui/toolbar/public",
"//ios/third_party/material_components_ios",
"//ios/web/public",
"//ui/base",
]
configs += [ "//build/config/compiler:enable_arc" ]
......
......@@ -11,10 +11,12 @@
#import "ios/chrome/browser/ui/location_bar/location_bar_constants.h"
#import "ios/chrome/browser/ui/ntp/new_tab_page_header_constants.h"
#import "ios/chrome/browser/ui/toolbar/public/toolbar_utils.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#include "ios/chrome/browser/ui/util/dynamic_type_util.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ios/web/public/features.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -112,6 +114,12 @@ CGFloat doodleHeight(BOOL logoIsShowing) {
CGFloat doodleTopMargin(BOOL toolbarPresent, CGFloat topInset) {
if (!IsCompactWidth() && !IsCompactHeight())
return kDoodleTopMarginRegularXRegular;
if (base::FeatureList::IsEnabled(
web::features::kBrowserContainerFullscreen) &&
base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen) &&
!base::FeatureList::IsEnabled(kBrowserContainerContainsNTP)) {
topInset = StatusBarHeight();
}
return topInset + kDoodleTopMarginOther +
AlignValueToPixel(kDoodleScaledTopMarginOther *
SystemSuggestedFontSizeMultiplier());
......
......@@ -81,7 +81,8 @@ bool IsWKWebViewSnapshotsEnabled() {
CGFloat StatusBarHeight() {
if (base::FeatureList::IsEnabled(
web::features::kBrowserContainerFullscreen) &&
base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen)) {
base::FeatureList::IsEnabled(web::features::kOutOfWebFullscreen) &&
base::FeatureList::IsEnabled(kBrowserContainerContainsNTP)) {
DCHECK(!base::ios::IsRunningOnIOS11OrLater());
}
......
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