Commit 4dbb88c3 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Better track landscape omnibox with NTP fakebox.

Bug: 828887
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I121abc634c72e9429a9acdb39377b140143686bd
Reviewed-on: https://chromium-review.googlesource.com/1066295Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560795}
parent a1f085f5
...@@ -30,6 +30,9 @@ namespace { ...@@ -30,6 +30,9 @@ namespace {
// Left margin for search icon. // Left margin for search icon.
const CGFloat kSearchIconLeftMargin = 9; const CGFloat kSearchIconLeftMargin = 9;
// Landscape inset for fake omnibox background container
const CGFloat kBackgroundLandscapeInset = 169;
} // namespace } // namespace
@interface ContentSuggestionsHeaderView ()<ToolbarSnapshotProviding> @interface ContentSuggestionsHeaderView ()<ToolbarSnapshotProviding>
...@@ -236,10 +239,13 @@ const CGFloat kSearchIconLeftMargin = 9; ...@@ -236,10 +239,13 @@ const CGFloat kSearchIconLeftMargin = 9;
// Calculate the amount to shrink the width and height of background so that // Calculate the amount to shrink the width and height of background so that
// it's where the focused adapative toolbar focuses. // it's where the focused adapative toolbar focuses.
CGFloat inset = IsLandscape() ? kBackgroundLandscapeInset : 0;
self.backgroundLeadingConstraint.constant = self.backgroundLeadingConstraint.constant =
(safeAreaInsets.left + kExpandedLocationBarHorizontalMargin) * percent; (safeAreaInsets.left + kExpandedLocationBarHorizontalMargin + inset) *
percent;
self.backgroundTrailingConstraint.constant = self.backgroundTrailingConstraint.constant =
-(safeAreaInsets.right + kExpandedLocationBarHorizontalMargin) * percent; -(safeAreaInsets.right + kExpandedLocationBarHorizontalMargin + inset) *
percent;
CGFloat kLocationBarHeight = CGFloat kLocationBarHeight =
kAdaptiveToolbarHeight - 2 * kAdaptiveLocationBarVerticalMargin; kAdaptiveToolbarHeight - 2 * kAdaptiveLocationBarVerticalMargin;
...@@ -253,8 +259,8 @@ const CGFloat kSearchIconLeftMargin = 9; ...@@ -253,8 +259,8 @@ const CGFloat kSearchIconLeftMargin = 9;
// Adjust the position of the search field's subviews by adjusting their // Adjust the position of the search field's subviews by adjusting their
// constraint constant value. // constraint constant value.
CGFloat constantDiff = CGFloat constantDiff = percent * (ntp_header::kMaxHorizontalMarginDiff +
percent * (ntp_header::kMaxHorizontalMarginDiff + safeAreaInsets.left); inset + safeAreaInsets.left);
for (NSLayoutConstraint* constraint in constraints) { for (NSLayoutConstraint* constraint in constraints) {
if (constraint.constant > 0) if (constraint.constant > 0)
constraint.constant = constantDiff + ntp_header::kHintLabelSidePadding; constraint.constant = constantDiff + ntp_header::kHintLabelSidePadding;
......
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