OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |