Commit 6af30a58 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Fix FindInPage/TextZoom button spacing on iPad

According to design, on iPad the spacing between buttons (not text
fields) and an adajcent edge should be greater.

Fixed: 1053988
Change-Id: Id061603e32e184864cba61ee11c6e6a946b41e49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066541Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#743121}
parent b0d8aa43
......@@ -22,6 +22,9 @@
namespace {
// Horizontal padding betwee all elements (except the previous/next buttons).
const CGFloat kPadding = 8;
// Horizontal padding between the last button and the trailing edge in a
// Regular x Regular environment.
const CGFloat kIPadButtonEdgeSpacing = 17;
const CGFloat kInputFieldCornerRadius = 10;
const CGFloat kFontSize = 15;
const CGFloat kButtonFontSize = 17;
......@@ -97,6 +100,9 @@ const CGFloat kButtonLength = 44;
[self.inputField setContentHuggingPriority:UILayoutPriorityDefaultLow - 1
forAxis:UILayoutConstraintAxisHorizontal];
const CGFloat closeButtonTrailingPadding =
ShouldShowCompactToolbar() ? kPadding : kIPadButtonEdgeSpacing;
[NSLayoutConstraint activateConstraints:@[
// Input Field.
[self.inputField.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
......@@ -133,7 +139,7 @@ const CGFloat kButtonLength = 44;
// Use button intrinsic width.
[self.closeButton.trailingAnchor
constraintEqualToAnchor:safeArea.trailingAnchor
constant:-kPadding],
constant:-closeButtonTrailingPadding],
]];
}
......
......@@ -38,6 +38,7 @@ source_set("text_zoom_ui") {
"//components/strings:components_strings",
"//ios/chrome/app/strings:ios_strings",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/util",
"//ios/chrome/common/colors",
"//ui/base",
]
......
......@@ -8,6 +8,7 @@
#include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/commands/text_zoom_commands.h"
#import "ios/chrome/browser/ui/text_zoom/text_zoom_constants.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/dynamic_color_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#include "ios/chrome/grit/ios_strings.h"
......@@ -20,6 +21,9 @@
namespace {
// Horizontal padding between all elements (except the previous/next buttons).
const CGFloat kPadding = 8;
// Horizontal padding between buttons and an adjacent superview edge in a
// Regular x Regular environment.
const CGFloat kIPadButtonEdgeSpacing = 17;
const CGFloat kButtonFontSize = 17;
const CGFloat kButtonSize = 44;
// Spacing between the increment/decrement buttons and the central divider.
......@@ -64,13 +68,16 @@ const CGFloat kDividerWidth = 1;
[self.view addSubview:self.centerItemsStackView];
[self.view addSubview:self.closeButton];
const CGFloat buttonEdgeSpacing =
ShouldShowCompactToolbar() ? kPadding : kIPadButtonEdgeSpacing;
[NSLayoutConstraint activateConstraints:@[
// Reset button.
[self.resetButton.centerYAnchor
constraintEqualToAnchor:self.view.centerYAnchor],
[self.resetButton.leadingAnchor
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor
constant:kPadding],
constant:buttonEdgeSpacing],
// Use button intrinsic width.
[self.resetButton.heightAnchor constraintEqualToConstant:kButtonSize],
// Center items stack view.
......@@ -85,7 +92,7 @@ const CGFloat kDividerWidth = 1;
constraintEqualToAnchor:self.view.centerYAnchor],
[self.closeButton.trailingAnchor
constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor
constant:-kPadding],
constant:-buttonEdgeSpacing],
// Use button intrinsic width.
[self.closeButton.heightAnchor constraintEqualToConstant:kButtonSize],
]];
......
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