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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/split_block_button.mm

Issue 308063002: Round up button's dimensions so width and height are always pixel-aligned.. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
« 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/cocoa/website_settings/split_block_button.h" 5 #import "chrome/browser/ui/cocoa/website_settings/split_block_button.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 location = kInsideLeftCell; 255 location = kInsideLeftCell;
256 else if ([self mouse:mousePoint inRect:[self rightCellRect]]) 256 else if ([self mouse:mousePoint inRect:[self rightCellRect]])
257 location = kInsideRightCell; 257 location = kInsideRightCell;
258 return location; 258 return location;
259 } 259 }
260 260
261 - (void)sizeToFit { 261 - (void)sizeToFit {
262 NSSize leftSize = [leftCell_ cellSize]; 262 NSSize leftSize = [leftCell_ cellSize];
263 NSSize rightSize = [rightCell_ cellSize]; 263 NSSize rightSize = [rightCell_ cellSize];
264 NSSize size = NSMakeSize( 264 NSSize size = NSMakeSize(
265 std::max(leftSize.width + rightSize.width, 265 std::ceil(std::max(leftSize.width + rightSize.width,
266 constrained_window_button::kButtonMinWidth), 266 constrained_window_button::kButtonMinWidth)),
267 std::max(leftSize.height, rightSize.height)); 267 std::ceil(std::max(leftSize.height, rightSize.height)));
268 [self setFrameSize:size]; 268 [self setFrameSize:size];
269 } 269 }
270 270
271 - (NSRect)leftCellRect { 271 - (NSRect)leftCellRect {
272 return [leftCell_ rect]; 272 return [leftCell_ rect];
273 } 273 }
274 274
275 - (NSRect)rightCellRect { 275 - (NSRect)rightCellRect {
276 NSRect leftFrame, rightFrame; 276 NSRect leftFrame, rightFrame;
277 NSDivideRect([self bounds], &leftFrame, &rightFrame, 277 NSDivideRect([self bounds], &leftFrame, &rightFrame,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 [super drawBorderAndBackgroundWithFrame:NSOffsetRect(frame, -4, 0) 331 [super drawBorderAndBackgroundWithFrame:NSOffsetRect(frame, -4, 0)
332 inView:controlView]; 332 inView:controlView];
333 } 333 }
334 334
335 - (NSRect)rect { 335 - (NSRect)rect {
336 NSSize size = [self cellSize]; 336 NSSize size = [self cellSize];
337 return NSMakeRect(0, 0, std::ceil(size.width), std::ceil(size.height)); 337 return NSMakeRect(0, 0, std::ceil(size.width), std::ceil(size.height));
338 } 338 }
339 339
340 @end 340 @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