Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/omnibox/page_info_view_controller.h" | 5 #import "ios/chrome/browser/ui/omnibox/page_info_view_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 return 0; | 501 return 0; |
| 502 } | 502 } |
| 503 // The size of the initial frame is irrelevant since it will be changed based | 503 // The size of the initial frame is irrelevant since it will be changed based |
| 504 // on the size for the string inside. | 504 // on the size for the string inside. |
| 505 CGRect frame = CGRectMake(kButtonXOffset, offset, 100, 10); | 505 CGRect frame = CGRectMake(kButtonXOffset, offset, 100, 10); |
| 506 | 506 |
| 507 UIFont* font = [MDCTypography captionFont]; | 507 UIFont* font = [MDCTypography captionFont]; |
| 508 CGSize sizeWithFont = | 508 CGSize sizeWithFont = |
| 509 [[[button titleLabel] text] cr_pixelAlignedSizeWithFont:font]; | 509 [[[button titleLabel] text] cr_pixelAlignedSizeWithFont:font]; |
| 510 frame.size = sizeWithFont; | 510 frame.size = sizeWithFont; |
| 511 // According to iOS Human Interface Guidelines, minimal size of UIButton | |
| 512 // should be 44x44. | |
| 513 frame.size.height = MAX(44, frame.size.height); | |
|
pkl (ping after 24h if needed)
2017/03/02 14:34:22
Do we normally prefer std::max over MAX ?
Olivier
2017/03/03 08:27:38
$ find . -name "*.mm" -exec grep "std::max(" {} \;
| |
| 511 | 514 |
| 512 [button setFrame:frame]; | 515 [button setFrame:frame]; |
| 513 | 516 |
| 514 [button.titleLabel setFont:font]; | 517 [button.titleLabel setFont:font]; |
| 515 [button.titleLabel setTextAlignment:NSTextAlignmentLeft]; | 518 [button.titleLabel setTextAlignment:NSTextAlignmentLeft]; |
| 516 [button setTitleColor:PageInfoHelpButtonColor() | 519 [button setTitleColor:PageInfoHelpButtonColor() |
| 517 forState:UIControlStateNormal]; | 520 forState:UIControlStateNormal]; |
| 518 [button setTitleColor:PageInfoHelpButtonColor() | 521 [button setTitleColor:PageInfoHelpButtonColor() |
| 519 forState:UIControlStateSelected]; | 522 forState:UIControlStateSelected]; |
| 520 [button setBackgroundColor:[UIColor clearColor]]; | 523 [button setBackgroundColor:[UIColor clearColor]]; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 [opacityAnimation setFromValue:@1]; | 631 [opacityAnimation setFromValue:@1]; |
| 629 [opacityAnimation setToValue:@0]; | 632 [opacityAnimation setToValue:@0]; |
| 630 [[containerView_ layer] addAnimation:opacityAnimation forKey:@"animateOut"]; | 633 [[containerView_ layer] addAnimation:opacityAnimation forKey:@"animateOut"]; |
| 631 | 634 |
| 632 [popupContainer_ setAlpha:0]; | 635 [popupContainer_ setAlpha:0]; |
| 633 [containerView_ setAlpha:0]; | 636 [containerView_ setAlpha:0]; |
| 634 [CATransaction commit]; | 637 [CATransaction commit]; |
| 635 } | 638 } |
| 636 | 639 |
| 637 @end | 640 @end |
| OLD | NEW |