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/autofill/password_generation_popup_view_cocoa.h
" | 5 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 autofill::kPopupBorderThickness, | 199 autofill::kPopupBorderThickness, |
200 contentWidth, | 200 contentWidth, |
201 controller_->kPopupPasswordSectionHeight)]; | 201 controller_->kPopupPasswordSectionHeight)]; |
202 | 202 |
203 // The key icon falls to the left of the title and password. | 203 // The key icon falls to the left of the title and password. |
204 const NSSize imageSize = [[keyIcon_ image] size]; | 204 const NSSize imageSize = [[keyIcon_ image] size]; |
205 const CGFloat keyX = controller_->kHorizontalPadding; | 205 const CGFloat keyX = controller_->kHorizontalPadding; |
206 const CGFloat keyY = | 206 const CGFloat keyY = |
207 std::ceil((controller_->kPopupPasswordSectionHeight / 2.0) - | 207 std::ceil((controller_->kPopupPasswordSectionHeight / 2.0) - |
208 (imageSize.height / 2.0)); | 208 (imageSize.height / 2.0)); |
209 [keyIcon_ setFrameOrigin:NSMakePoint(keyX, keyY)]; | 209 [keyIcon_ setFrame:{ NSMakePoint(keyX, keyY), imageSize }]; |
210 [keyIcon_ sizeToFit]; | |
211 | 210 |
212 // The title and password fall to the right of the key icon and are centered | 211 // The title and password fall to the right of the key icon and are centered |
213 // vertically as a group with some padding in between. | 212 // vertically as a group with some padding in between. |
214 [passwordTitleField_ sizeToFit]; | 213 [passwordTitleField_ sizeToFit]; |
215 [passwordField_ sizeToFit]; | 214 [passwordField_ sizeToFit]; |
216 const CGFloat groupHeight = NSHeight([passwordField_ frame]) + | 215 const CGFloat groupHeight = NSHeight([passwordField_ frame]) + |
217 kPasswordSectionVerticalSeparation + | 216 kPasswordSectionVerticalSeparation + |
218 NSHeight([passwordTitleField_ frame]); | 217 NSHeight([passwordTitleField_ frame]); |
219 const CGFloat groupX = | 218 const CGFloat groupX = |
220 NSMaxX([keyIcon_ frame]) + controller_->kHorizontalPadding; | 219 NSMaxX([keyIcon_ frame]) + controller_->kHorizontalPadding; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 329 |
331 - (NSFont*)boldFont { | 330 - (NSFont*)boldFont { |
332 return [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]; | 331 return [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]; |
333 } | 332 } |
334 | 333 |
335 - (NSFont*)textFont { | 334 - (NSFont*)textFont { |
336 return [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; | 335 return [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; |
337 } | 336 } |
338 | 337 |
339 @end | 338 @end |
OLD | NEW |