Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: ios/chrome/browser/ui/ntp/new_tab_page_bar.mm

Issue 2590223002: [ios] Fixes the recent tabs button on the NTP. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar.h" 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 - (void)layoutSubviews { 136 - (void)layoutSubviews {
137 [super layoutSubviews]; 137 [super layoutSubviews];
138 138
139 // |buttonWidth_| changes with the screen orientation when the NTP button bar 139 // |buttonWidth_| changes with the screen orientation when the NTP button bar
140 // is enabled. 140 // is enabled.
141 [self calculateButtonWidth]; 141 [self calculateButtonWidth];
142 142
143 CGFloat logoWidth = logoView_.get().image.size.width; 143 CGFloat logoWidth = logoView_.get().image.size.width;
144 CGFloat padding = [self useIconsInButtons] ? logoWidth : 0; 144 CGFloat padding = [self useIconsInButtons] ? logoWidth : 0;
145 CGFloat buttonPadding = floor((CGRectGetWidth(self.bounds) - padding - 145 CGFloat buttonPadding = floor((CGRectGetWidth(self.bounds) - padding -
146 (buttonWidth_ * self.buttons.count) / 2) + 146 buttonWidth_ * self.buttons.count) /
147 2 +
147 padding); 148 padding);
148 149
149 for (NSUInteger i = 0; i < self.buttons.count; ++i) { 150 for (NSUInteger i = 0; i < self.buttons.count; ++i) {
150 NewTabPageBarButton* button = [self.buttons objectAtIndex:i]; 151 NewTabPageBarButton* button = [self.buttons objectAtIndex:i];
151 LayoutRect layout = LayoutRectMake( 152 LayoutRect layout = LayoutRectMake(
152 buttonPadding + (i * buttonWidth_), CGRectGetWidth(self.bounds), 0, 153 buttonPadding + (i * buttonWidth_), CGRectGetWidth(self.bounds), 0,
153 buttonWidth_, CGRectGetHeight(self.bounds)); 154 buttonWidth_, CGRectGetHeight(self.bounds));
154 button.frame = LayoutRectGetRect(layout); 155 button.frame = LayoutRectGetRect(layout);
155 [button 156 [button
156 setContentToDisplay:[self useIconsInButtons] 157 setContentToDisplay:[self useIconsInButtons]
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return !IsIPadIdiom() || IsCompactTablet(); 322 return !IsIPadIdiom() || IsCompactTablet();
322 } 323 }
323 324
324 - (BOOL)showOverlay { 325 - (BOOL)showOverlay {
325 // The bar buttons launch modal dialogs on tap on iPhone. Don't show overlay 326 // The bar buttons launch modal dialogs on tap on iPhone. Don't show overlay
326 // in this case. 327 // in this case.
327 return IsIPadIdiom(); 328 return IsIPadIdiom();
328 } 329 }
329 330
330 @end 331 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698