Commit b85ebef5 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Update tab strip tab art for refresh.

Removes shadows around refresh artwork, and all the necessary pixel tweakage.

screenshot: https://screenshot.googleplex.com/pawpDoFFzVY

Bug: 844006
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I760902a0820b0426d75d571163cdc2ab7c7782a4
Reviewed-on: https://chromium-review.googlesource.com/1078912Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562828}
parent a7776af6
......@@ -72,10 +72,8 @@ const NSTimeInterval kDragAndDropLongPressDuration = 0.4;
// Tab dimensions.
const CGFloat kTabOverlap = 26.0;
const CGFloat kTabOverlapForCompactLayout = 30.0;
const CGFloat kTabOverlapForRefresh = 48.0;
const CGFloat kNewTabOverlap = 30.0;
const CGFloat kNewTabOverlapLegacy = 8.0;
const CGFloat kNewTabOverlap = 8.0;
const CGFloat kMaxTabWidth = 265.0;
const CGFloat kMaxTabWidthForCompactLayout = 225.0;
......@@ -83,7 +81,6 @@ const CGFloat kMaxTabWidthForCompactLayout = 225.0;
const CGFloat kTabSwitcherButtonWidth = 46.0;
const CGFloat kTabSwitcherButtonBackgroundWidth = 62.0;
const CGFloat kNewTabRightPadding = 4.0;
const CGFloat kMinTabWidth = 200.0;
const CGFloat kMinTabWidthForCompactLayout = 160.0;
......@@ -106,11 +103,7 @@ const CGFloat kDimmingViewBottomInsetHighRes = 0.0;
const CGFloat kDimmingViewBottomInset = 0.0;
// The size of the tab strip view.
const CGFloat kTabStripHeight = 54.0;
const CGFloat kTabStripHeightLegacy = 39.0;
// Shift everything down to account for the tab's top shadow.
const CGFloat kTopShadowOffset = 15;
const CGFloat kTabStripHeight = 39.0;
// The size of the new tab button.
const CGFloat kNewTabButtonWidth = 59.9;
......@@ -131,14 +124,6 @@ UIColor* BackgroundColor() {
return [UIColor colorWithRed:0.149 green:0.149 blue:0.164 alpha:1];
}
CGFloat NewTabOverlap() {
return IsUIRefreshPhase1Enabled() ? kNewTabOverlap : kNewTabOverlapLegacy;
}
CGFloat TopShadowOffset() {
return IsUIRefreshPhase1Enabled() ? kTopShadowOffset : 0;
}
// Returns the string to use for a numeric item count.
NSString* StringForItemCount(long count) {
if (count == 0)
......@@ -419,8 +404,7 @@ NSString* StringForItemCount(long count) {
// |self.view| setup.
CGRect tabStripFrame = [UIApplication sharedApplication].keyWindow.bounds;
tabStripFrame.size.height =
IsUIRefreshPhase1Enabled() ? kTabStripHeight : kTabStripHeightLegacy;
tabStripFrame.size.height = kTabStripHeight;
_view = [[UIView alloc] initWithFrame:tabStripFrame];
_view.autoresizingMask = (UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleBottomMargin);
......@@ -440,9 +424,7 @@ NSString* StringForItemCount(long count) {
// |self.buttonNewTab| setup.
CGRect buttonNewTabFrame = tabStripFrame;
buttonNewTabFrame.origin.y = TopShadowOffset();
buttonNewTabFrame.size.width = kNewTabButtonWidth;
buttonNewTabFrame.size.height -= TopShadowOffset();
_buttonNewTab = [[UIButton alloc] initWithFrame:buttonNewTabFrame];
_isIncognito = tabModel && tabModel.browserState->IsOffTheRecord();
// TODO(crbug.com/600829): Rewrite layout code and convert these masks to
......@@ -1119,8 +1101,7 @@ NSString* StringForItemCount(long count) {
- (CGFloat)tabStripVisibleSpace {
CGFloat availableSpace = CGRectGetWidth([_tabStripView bounds]) -
CGRectGetWidth([_buttonNewTab frame]) +
NewTabOverlap() - kNewTabRightPadding -
kTabSwitcherButtonWidth;
kNewTabOverlap;
return availableSpace;
}
......@@ -1143,10 +1124,10 @@ NSString* StringForItemCount(long count) {
int tabSwitcherButtonIdsAccessibilityLabel =
IDS_IOS_TAB_STRIP_ENTER_TAB_SWITCHER;
NSString* tabSwitcherButtonEnglishUiAutomationName = @"Enter Tab Switcher";
const CGFloat tabStripHeight = _view.frame.size.height - TopShadowOffset();
const CGFloat tabStripHeight = _view.frame.size.height;
CGRect buttonFrame =
CGRectMake(CGRectGetMaxX(_view.frame) - kTabSwitcherButtonWidth,
TopShadowOffset(), kTabSwitcherButtonWidth, tabStripHeight);
CGRectMake(CGRectGetMaxX(_view.frame) - kTabSwitcherButtonWidth, 0,
kTabSwitcherButtonWidth, tabStripHeight);
if (IsUIRefreshPhase1Enabled()) {
_tabSwitcherButton =
[TabStripCenteredButton buttonWithType:UIButtonTypeCustom];
......@@ -1231,7 +1212,7 @@ NSString* StringForItemCount(long count) {
// desired width, with the standard overlap, plus the new tab button.
CGSize contentSize = CGSizeMake(
_currentTabWidth * tabCount - ([self tabOverlap] * (tabCount - 1)) +
CGRectGetWidth([_buttonNewTab frame]) - NewTabOverlap(),
CGRectGetWidth([_buttonNewTab frame]) - kNewTabOverlap,
tabHeight);
if (CGSizeEqualToSize([_tabStripView contentSize], contentSize))
return;
......@@ -1281,8 +1262,6 @@ NSString* StringForItemCount(long count) {
}
- (CGFloat)tabOverlap {
if (IsUIRefreshPhase1Enabled())
return kTabOverlapForRefresh;
if (!IsCompactTablet())
return kTabOverlap;
return kTabOverlapForCompactLayout;
......@@ -1650,8 +1629,7 @@ NSString* StringForItemCount(long count) {
CGRect newTabFrame = [_buttonNewTab frame];
BOOL moveNewTab =
(newTabFrame.origin.x != virtualMaxX) && !_buttonNewTab.hidden;
newTabFrame.origin =
CGPointMake(virtualMaxX - NewTabOverlap(), TopShadowOffset());
newTabFrame.origin = CGPointMake(virtualMaxX - kNewTabOverlap, 0);
if (!animate && moveNewTab)
[_buttonNewTab setFrame:newTabFrame];
......
......@@ -40,18 +40,13 @@ const CGFloat kTabCloseTopInset = -1.0;
const CGFloat kTabCloseLeftInset = 0.0;
const CGFloat kTabCloseBottomInset = 0.0;
const CGFloat kTabCloseRightInset = 0.0;
const CGFloat kTabBackgroundLeftCapInset = 40.0;
const CGFloat kTabBackgroundLeftCapInsetLegacy = 24.0;
const CGFloat kFaviconLeftInset = 38;
const CGFloat kFaviconLeftInsetLegacy = 23.5;
const CGFloat kFaviconVerticalOffset = 17.0;
const CGFloat kFaviconVerticalOffsetLegacy = 2.0;
const CGFloat kTabBackgroundLeftCapInset = 24.0;
const CGFloat kFaviconLeftInset = 23.5;
const CGFloat kFaviconVerticalOffset = 2.0;
const CGFloat kTabStripLineMargin = 2.5;
const CGFloat kTabStripLineHeight = 0.5;
const CGFloat kCloseButtonHorizontalShift = 35;
const CGFloat kCloseButtonHorizontalShiftLegacy = 15;
const CGFloat kCloseButtonVerticalShift = 19.0;
const CGFloat kCloseButtonVerticalShiftLegacy = 4.0;
const CGFloat kCloseButtonHorizontalShift = 15;
const CGFloat kCloseButtonVerticalShift = 4.0;
const CGFloat kTitleLeftMargin = 8.0;
const CGFloat kTitleRightMargin = 0.0;
......@@ -357,17 +352,10 @@ const CGFloat kFaviconSize = 16.0;
@"V:[title(==titleHeight)]",
];
CGFloat closeButtonHorizontalShift = IsUIRefreshPhase1Enabled()
? kCloseButtonHorizontalShift
: kCloseButtonHorizontalShiftLegacy;
CGFloat faviconLeftInset =
IsUIRefreshPhase1Enabled() ? kFaviconLeftInset : kFaviconLeftInsetLegacy;
CGFloat faviconVerticalOffset = IsUIRefreshPhase1Enabled()
? kFaviconVerticalOffset
: kFaviconVerticalOffsetLegacy;
CGFloat closeButtonVerticalShift = IsUIRefreshPhase1Enabled()
? kCloseButtonVerticalShift
: kCloseButtonVerticalShiftLegacy;
CGFloat closeButtonHorizontalShift = kCloseButtonHorizontalShift;
CGFloat faviconLeftInset = kFaviconLeftInset;
CGFloat faviconVerticalOffset = kFaviconVerticalOffset;
CGFloat closeButtonVerticalShift = kCloseButtonVerticalShift;
NSDictionary* metrics = @{
@"closeButtonSize" : @(kCloseButtonSize),
@"closeButtonHorizontalShift" : @(closeButtonHorizontalShift),
......@@ -386,8 +374,6 @@ const CGFloat kFaviconSize = 16.0;
}
- (void)updateLineSeparator {
if (IsUIRefreshPhase1Enabled())
return;
UIColor* separatorColor =
_incognitoStyle ? [UIColor colorWithWhite:36 / 255.0 alpha:1.0]
: [UIColor colorWithWhite:185 / 255.0 alpha:1.0];
......@@ -400,9 +386,7 @@ const CGFloat kFaviconSize = 16.0;
NSString* incognito = _incognitoStyle ? @"incognito_" : @"";
NSString* imageName = [NSString
stringWithFormat:@"tabstrip_%@%@_tab%@", incognito, state, refresh];
CGFloat leftInset = IsUIRefreshPhase1Enabled()
? kTabBackgroundLeftCapInset
: kTabBackgroundLeftCapInsetLegacy;
CGFloat leftInset = kTabBackgroundLeftCapInset;
UIImage* backgroundImage =
StretchableImageFromUIImage([UIImage imageNamed:imageName], leftInset, 0);
[_backgroundImageView setImage:backgroundImage];
......
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