Commit 9f95184b authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] Tweak tab grid segmented control backgrounds.

This CL makes the background separators for the segmented control
transparent (by making the background view itself transparent). It also
adds an alpha parameter for the background color in anticipation of
making the background itself somewhat transparent.

Bug: 849647, 849646
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ia17c32297a73de9de2a4903a84829f6c5f4dae75
Reviewed-on: https://chromium-review.googlesource.com/1091536Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565469}
parent f8c77740
......@@ -30,7 +30,8 @@
// smaller ones in the view hierarchy but are masked out by the slider view, so
// they are only seen when the slider is over them.
//
// This control is built out of several views. From the bottom up, they are:
// This control is built out of several views. From the (z-axis) bottom up, they
// are:
//
// * The background view, a grey roundrect with vertical transparent bars.
// * The background image views.
......@@ -97,6 +98,8 @@ const NSTimeInterval kSliderMoveDuration = 0.2;
const int kSliderColor = 0xF8F9FA;
// Color for the background view.
const int kBackgroundColor = 0x5F6368;
// Alpha for the background view.
const CGFloat kBackgroundAlpha = 1.0;
// Returns the point that's at the center of |rect|.
CGPoint RectCenter(CGRect rect) {
......@@ -180,7 +183,6 @@ NSString* StringForItemCount(long count) {
CGRect frame = CGRectMake(0, 0, kOverallWidth, kOverallHeight);
if (self = [super initWithFrame:frame]) {
// Default to the regular tab page as the selected page.
_selectedPage = TabGridPageRegularTabs;
}
return self;
......@@ -535,8 +537,12 @@ NSString* StringForItemCount(long count) {
@implementation TabGridPageControlBackground
- (instancetype)init {
return
self =
[super initWithFrame:CGRectMake(0, 0, kBackgroundWidth, kSegmentHeight)];
if (self) {
self.backgroundColor = UIColor.clearColor;
}
return self;
}
- (CGSize)intrinsicContentsSize {
......@@ -545,7 +551,7 @@ NSString* StringForItemCount(long count) {
- (void)drawRect:(CGRect)rect {
CGContextRef drawing = UIGraphicsGetCurrentContext();
UIColor* backgroundColor = UIColorFromRGB(kBackgroundColor);
UIColor* backgroundColor = UIColorFromRGB(kBackgroundColor, kBackgroundAlpha);
CGContextSetFillColorWithColor(drawing, backgroundColor.CGColor);
CGRect fillRect = CGRectMake(0, 0, kSegmentWidth, kSegmentHeight);
CGContextFillRect(drawing, fillRect);
......
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