Commit b9e188de authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

[UI Refresh] Change omnibox and location bar styling.

Updates fonts, spaces, colors in omnibox-related code to match the new
specs.

Bug: 852787
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ibe22b985011ce7ed3da9f83291f293e3942728c4
Reviewed-on: https://chromium-review.googlesource.com/1101026Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568693}
parent 7ffd5f6d
......@@ -20,6 +20,9 @@ const CGFloat kButtonSize = 28;
const CGFloat kButtonTrailingSpacing = 10;
// Font size used in the omnibox.
const CGFloat kFontSize = 17.0f;
} // namespace
@interface LocationBarSteadyView ()
......@@ -101,7 +104,7 @@ const CGFloat kButtonTrailingSpacing = 10;
[_locationLabel
setContentCompressionResistancePriority:UILayoutPriorityDefaultLow
forAxis:UILayoutConstraintAxisVertical];
_locationLabel.font = [UIFont systemFontOfSize:19.0];
_locationLabel.font = [UIFont systemFontOfSize:kFontSize];
// Container for location label and icon.
UIView* container = [[UIView alloc] init];
......
......@@ -159,7 +159,7 @@ typedef NS_ENUM(int, TrailingButtonState) {
- (void)updateForFullscreenProgress:(CGFloat)progress {
CGFloat alphaValue = fmax((progress - 0.85) / 0.15, 0);
CGFloat scaleValue = 0.75 + 0.25 * progress;
CGFloat scaleValue = 0.79 + 0.21 * progress;
self.locationBarSteadyView.trailingButton.alpha = alphaValue;
self.locationBarSteadyView.transform =
CGAffineTransformMakeScale(scaleValue, scaleValue);
......
......@@ -26,6 +26,9 @@ const CGFloat kleadingImageViewEdgeOffset = 9;
const CGFloat kTextFieldLeadingOffsetNoImage = 16;
// Space between the leading button and the textfield when a button is shown.
const CGFloat kTextFieldLeadingOffsetImage = 6;
// Space between the clear button and the edge of the omnibox.
const CGFloat kTextFieldClearButtonTrailingOffset = 4;
} // namespace
#pragma mark - OmniboxContainerView
......@@ -74,11 +77,10 @@ const CGFloat kTextFieldLeadingOffsetImage = 6;
[NSLayoutConstraint activateConstraints:@[
[_textField.trailingAnchor
constraintEqualToAnchor:self.layoutMarginsGuide.trailingAnchor],
[_textField.topAnchor
constraintEqualToAnchor:self.layoutMarginsGuide.topAnchor],
[_textField.bottomAnchor
constraintEqualToAnchor:self.layoutMarginsGuide.bottomAnchor],
constraintEqualToAnchor:self.trailingAnchor
constant:-kTextFieldClearButtonTrailingOffset],
[_textField.topAnchor constraintEqualToAnchor:self.topAnchor],
[_textField.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
_leadingTextfieldConstraint,
]];
......@@ -101,10 +103,9 @@ const CGFloat kTextFieldLeadingOffsetImage = 6;
} else {
[self addSubview:_leadingImageView];
self.leadingTextfieldConstraint.active = NO;
self.leadingImageViewLeadingConstraint =
[self.layoutMarginsGuide.leadingAnchor
constraintEqualToAnchor:self.leadingImageView.leadingAnchor
constant:-kleadingImageViewEdgeOffset];
self.leadingImageViewLeadingConstraint = [self.leadingAnchor
constraintEqualToAnchor:self.leadingImageView.leadingAnchor
constant:-kleadingImageViewEdgeOffset];
NSLayoutConstraint* leadingImageViewToTextField = nil;
leadingImageViewToTextField = [self.leadingImageView.trailingAnchor
......@@ -113,7 +114,7 @@ const CGFloat kTextFieldLeadingOffsetImage = 6;
[NSLayoutConstraint activateConstraints:@[
[_leadingImageView.centerYAnchor
constraintEqualToAnchor:self.layoutMarginsGuide.centerYAnchor],
constraintEqualToAnchor:self.centerYAnchor],
self.leadingImageViewLeadingConstraint,
leadingImageViewToTextField,
]];
......
......@@ -925,11 +925,18 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation";
}
- (UIColor*)selectedTextBackgroundColor {
return _selectedTextBackgroundColor ? _selectedTextBackgroundColor
: [UIColor colorWithRed:204.0 / 255
green:221.0 / 255
blue:237.0 / 255
alpha:1.0];
if (!_selectedTextBackgroundColor) {
if (IsUIRefreshPhase1Enabled()) {
_selectedTextBackgroundColor =
[self.tintColor colorWithAlphaComponent:0.2];
} else {
_selectedTextBackgroundColor = [UIColor colorWithRed:204.0 / 255
green:221.0 / 255
blue:237.0 / 255
alpha:1.0];
}
}
return _selectedTextBackgroundColor;
}
- (BOOL)isColorHidden:(UIColor*)color {
......
......@@ -6,6 +6,7 @@
#include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/omnibox/omnibox_container_view.h"
#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_constants.h"
#include "ios/chrome/browser/ui/ui_util.h"
#include "ios/chrome/browser/ui/uikit_ui_util.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
......@@ -15,13 +16,6 @@
#error "This file requires ARC support."
#endif
namespace {
// Font size used in the omnibox.
const CGFloat kFontSize = 19.0f;
} // namespace
@interface OmniboxViewController ()
// Override of UIViewController's view with a different type.
......@@ -48,15 +42,16 @@ const CGFloat kFontSize = 19.0f;
- (void)loadView {
UIColor* textColor = self.incognito ? [UIColor whiteColor]
: [UIColor colorWithWhite:0 alpha:0.7];
UIColor* textFieldTintColor =
self.incognito ? [UIColor whiteColor] : [UIColor blackColor];
UIColor* textFieldTintColor = self.incognito
? [UIColor whiteColor]
: UIColorFromRGB(kLocationBarTintBlue);
UIColor* iconTintColor = self.incognito
? [UIColor whiteColor]
: [UIColor colorWithWhite:0 alpha:0.7];
self.view = [[OmniboxContainerView alloc]
initWithFrame:CGRectZero
font:[UIFont systemFontOfSize:kFontSize]
font:[UIFont systemFontOfSize:kLocationBarFontSize]
textColor:textColor
textFieldTint:textFieldTintColor
iconTint:iconTintColor];
......
......@@ -447,6 +447,10 @@ const int styleCount = 2;
- (UIButton*)cancelButton {
UIButton* cancelButton = [UIButton buttonWithType:UIButtonTypeSystem];
cancelButton.titleLabel.font = [UIFont systemFontOfSize:kLocationBarFontSize];
cancelButton.tintColor = self.style == NORMAL
? UIColorFromRGB(kLocationBarTintBlue)
: [UIColor whiteColor];
[cancelButton setTitle:l10n_util::GetNSString(IDS_CANCEL)
forState:UIControlStateNormal];
[cancelButton setContentHuggingPriority:UILayoutPriorityDefaultHigh
......
......@@ -136,4 +136,10 @@ enum ToolbarControllerStyle {
ToolbarControllerStyleMaxStyles
};
// Tint color for location bar and omnibox.
extern const CGFloat kLocationBarTintBlue;
// Font size used in omnibox and location bar.
extern const CGFloat kLocationBarFontSize;
#endif // IOS_CHROME_BROWSER_UI_TOOLBAR_BUTTONS_TOOLBAR_CONSTANTS_H_
......@@ -64,7 +64,7 @@ const LayoutOffset kToolbarButtonAnimationOffset = -10.0;
const CGFloat kExpandedLocationBarHorizontalMargin = 8;
const CGFloat kContractedLocationBarHorizontalMargin = 19;
const CGFloat kAdaptiveLocationBarCornerRadius = 11;
const CGFloat kAdaptiveLocationBarCornerRadius = 18;
const CGFloat kAdaptiveLocationBarBackgroundAlpha = 0.12;
const CGFloat kAdaptiveLocationBarVerticalMargin = 6.0f;
......@@ -93,3 +93,6 @@ const NSInteger kFontSizeTenTabsOrMore = 9;
const CGFloat kToolbarShadowHeight = 2;
const CGFloat kToolbarFullBleedShadowHeight = 10;
const CGFloat kLocationBarTintBlue = 0x1A73E8;
const CGFloat kLocationBarFontSize = 17.0f;
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