Commit 401fadcd authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] Remove UIRefresh flag from overscroll_view.

Bug: 884724
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I53368d4beeb536695e2190f0fdebf64f4198c6a4
Reviewed-on: https://chromium-review.googlesource.com/1251545
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595769}
parent e9d5c35e
...@@ -93,8 +93,6 @@ const CGFloat kActionLabelSidePadding = 15.0; ...@@ -93,8 +93,6 @@ const CGFloat kActionLabelSidePadding = 15.0;
// The value to use as the R, B, and B components for the action label text and // The value to use as the R, B, and B components for the action label text and
// selection layer animation. // selection layer animation.
const CGFloat kSelectionColor = 0.4; const CGFloat kSelectionColor = 0.4;
// The values to use for the R, G, and B components for the
const CGFloat kSelectionColorLegacy[] = {66.0 / 256, 133.0 / 256, 244.0 / 256};
// This function maps a value from a range to another. // This function maps a value from a range to another.
CGFloat MapValueToRange(FloatRange from, FloatRange to, CGFloat value) { CGFloat MapValueToRange(FloatRange from, FloatRange to, CGFloat value) {
...@@ -314,47 +312,42 @@ enum class OverscrollViewState { ...@@ -314,47 +312,42 @@ enum class OverscrollViewState {
[_highlightMaskLayer addSublayer:_reloadActionImageViewHighlighted.layer]; [_highlightMaskLayer addSublayer:_reloadActionImageViewHighlighted.layer];
[_highlightMaskLayer addSublayer:_closeTabActionImageViewHighlighted.layer]; [_highlightMaskLayer addSublayer:_closeTabActionImageViewHighlighted.layer];
if (IsUIRefreshPhase1Enabled()) { _addTabLabel = [[UILabel alloc] init];
_addTabLabel = [[UILabel alloc] init]; _addTabLabel.numberOfLines = 0;
_addTabLabel.numberOfLines = 0; _addTabLabel.lineBreakMode = NSLineBreakByWordWrapping;
_addTabLabel.lineBreakMode = NSLineBreakByWordWrapping; _addTabLabel.textAlignment = NSTextAlignmentLeft;
_addTabLabel.textAlignment = NSTextAlignmentLeft; _addTabLabel.alpha = 0.0;
_addTabLabel.alpha = 0.0; _addTabLabel.font =
_addTabLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; _addTabLabel.adjustsFontForContentSizeCategory = NO;
_addTabLabel.adjustsFontForContentSizeCategory = NO; _addTabLabel.textColor = [UIColor colorWithWhite:kSelectionColor alpha:1.0];
_addTabLabel.textColor = _addTabLabel.text =
[UIColor colorWithWhite:kSelectionColor alpha:1.0]; l10n_util::GetNSString(IDS_IOS_OVERSCROLL_NEW_TAB_LABEL);
_addTabLabel.text = [self addSubview:_addTabLabel];
l10n_util::GetNSString(IDS_IOS_OVERSCROLL_NEW_TAB_LABEL); _reloadLabel = [[UILabel alloc] init];
[self addSubview:_addTabLabel]; _reloadLabel.numberOfLines = 0;
_reloadLabel = [[UILabel alloc] init]; _reloadLabel.lineBreakMode = NSLineBreakByWordWrapping;
_reloadLabel.numberOfLines = 0; _reloadLabel.textAlignment = NSTextAlignmentCenter;
_reloadLabel.lineBreakMode = NSLineBreakByWordWrapping; _reloadLabel.alpha = 0.0;
_reloadLabel.textAlignment = NSTextAlignmentCenter; _reloadLabel.font =
_reloadLabel.alpha = 0.0; [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
_reloadLabel.font = _reloadLabel.adjustsFontForContentSizeCategory = NO;
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; _reloadLabel.textColor = [UIColor colorWithWhite:kSelectionColor alpha:1.0];
_reloadLabel.adjustsFontForContentSizeCategory = NO; _reloadLabel.text = l10n_util::GetNSString(IDS_IOS_OVERSCROLL_RELOAD_LABEL);
_reloadLabel.textColor = [self addSubview:_reloadLabel];
[UIColor colorWithWhite:kSelectionColor alpha:1.0]; _closeTabLabel = [[UILabel alloc] init];
_reloadLabel.text = _closeTabLabel.numberOfLines = 0;
l10n_util::GetNSString(IDS_IOS_OVERSCROLL_RELOAD_LABEL); _closeTabLabel.lineBreakMode = NSLineBreakByWordWrapping;
[self addSubview:_reloadLabel]; _closeTabLabel.textAlignment = NSTextAlignmentRight;
_closeTabLabel = [[UILabel alloc] init]; _closeTabLabel.alpha = 0.0;
_closeTabLabel.numberOfLines = 0; _closeTabLabel.font =
_closeTabLabel.lineBreakMode = NSLineBreakByWordWrapping; [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1];
_closeTabLabel.textAlignment = NSTextAlignmentRight; _closeTabLabel.adjustsFontForContentSizeCategory = NO;
_closeTabLabel.alpha = 0.0; _closeTabLabel.textColor =
_closeTabLabel.font = [UIColor colorWithWhite:kSelectionColor alpha:1.0];
[UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; _closeTabLabel.text =
_closeTabLabel.adjustsFontForContentSizeCategory = NO; l10n_util::GetNSString(IDS_IOS_OVERSCROLL_CLOSE_TAB_LABEL);
_closeTabLabel.textColor = [self addSubview:_closeTabLabel];
[UIColor colorWithWhite:kSelectionColor alpha:1.0];
_closeTabLabel.text =
l10n_util::GetNSString(IDS_IOS_OVERSCROLL_CLOSE_TAB_LABEL);
[self addSubview:_closeTabLabel];
}
_backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; _backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
[self addSubview:_backgroundView]; [self addSubview:_backgroundView];
...@@ -579,9 +572,6 @@ enum class OverscrollViewState { ...@@ -579,9 +572,6 @@ enum class OverscrollViewState {
} }
- (void)layoutActionLabels { - (void)layoutActionLabels {
if (!IsUIRefreshPhase1Enabled())
return;
// The text is truncated to be a maximum of half the width of the view. // The text is truncated to be a maximum of half the width of the view.
CGSize boundingSize = self.bounds.size; CGSize boundingSize = self.bounds.size;
boundingSize.width /= 2.0; boundingSize.width /= 2.0;
...@@ -996,13 +986,7 @@ enum class OverscrollViewState { ...@@ -996,13 +986,7 @@ enum class OverscrollViewState {
setImage:[UIImage imageNamed:kCloseActionActiveImage]]; setImage:[UIImage imageNamed:kCloseActionActiveImage]];
_selectionCircleLayer.fillColor = _selectionCircleLayer.fillColor =
IsUIRefreshPhase1Enabled() [UIColor colorWithWhite:kSelectionColor alpha:1.0].CGColor;
? [UIColor colorWithWhite:kSelectionColor alpha:1.0].CGColor
: [UIColor colorWithRed:kSelectionColorLegacy[0]
green:kSelectionColorLegacy[1]
blue:kSelectionColorLegacy[2]
alpha:1]
.CGColor;
_selectionCircleMaskLayer.fillColor = [[UIColor blackColor] CGColor]; _selectionCircleMaskLayer.fillColor = [[UIColor blackColor] CGColor];
} }
[_addTabActionImageView sizeToFit]; [_addTabActionImageView sizeToFit];
...@@ -1080,7 +1064,7 @@ enum class OverscrollViewState { ...@@ -1080,7 +1064,7 @@ enum class OverscrollViewState {
- (void)fadeInActionLabel:(UILabel*)actionLabel - (void)fadeInActionLabel:(UILabel*)actionLabel
previousActionLabel:(UILabel*)previousLabel { previousActionLabel:(UILabel*)previousLabel {
NSUInteger labelCount = (actionLabel ? 1 : 0) + (previousLabel ? 1 : 0); NSUInteger labelCount = (actionLabel ? 1 : 0) + (previousLabel ? 1 : 0);
if (!IsUIRefreshPhase1Enabled() || !labelCount) if (!labelCount)
return; return;
NSTimeInterval duration = labelCount * kActionLabelFadeDuration; NSTimeInterval duration = labelCount * kActionLabelFadeDuration;
......
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