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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm

Issue 99543005: [rAc] [OSX] Reduce gap between "shipping address" label and the shipping address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Center w.r.t. CVV input field Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
index e854cd2d1667e6a4645975d42ff2894b3586e154..c7877e0f390897f10126dd314748bc6a6cda2dec 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_suggestion_container.mm
@@ -35,10 +35,6 @@ const CGFloat kInfiniteSize = 1.0e6;
// an NSTextField does. (Which UX feedback was based on)
const CGFloat kLineFragmentPadding = 2.0;
-// Padding added on top of the label so its first line looks centered with
-// respect to the input field.
-const CGFloat kLabelTopPadding = 5.0;
-
}
// An attachment cell for a single icon - takes care of proper alignment of
@@ -109,7 +105,7 @@ const CGFloat kLabelTopPadding = 5.0;
base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle(
[[NSMutableParagraphStyle alloc] init]);
- [paragraphStyle setLineHeightMultiple:1.5];
+ [paragraphStyle setLineSpacing:0.5 * [[label_ font] pointSize]];
[label_ setDefaultParagraphStyle:paragraphStyle];
inputField_.reset([[AutofillTextField alloc] initWithFrame:NSZeroRect]);
@@ -171,7 +167,6 @@ const CGFloat kLabelTopPadding = 5.0;
- (NSSize)preferredSize {
NSSize size = [label_ bounds].size;
- size.height += kLabelTopPadding;
// Final inputField_ sizing/spacing depends on a TODO(estade) in Views code.
if (![inputField_ isHidden]) {
@@ -195,19 +190,21 @@ const CGFloat kLabelTopPadding = 5.0;
NSRect labelFrame = [label_ bounds];
labelFrame.origin.x = NSMinX(bounds);
- labelFrame.origin.y =
- NSMaxY(bounds) - kLabelTopPadding - NSHeight(labelFrame) - kTopPadding;
+ labelFrame.origin.y = NSMaxY(bounds) - NSHeight(labelFrame) - kTopPadding;
// Position input field - top is aligned to top of label field.
if (![inputField_ isHidden]) {
- NSRect inputfieldFrame = [inputField_ frame];
- inputfieldFrame.origin.x = NSMaxX(bounds) - NSWidth(inputfieldFrame);
- inputfieldFrame.origin.y =
- NSMaxY(labelFrame) + kLabelTopPadding - NSHeight(inputfieldFrame);
- [inputField_ setFrameOrigin:inputfieldFrame.origin];
+ NSRect inputFieldFrame = [inputField_ frame];
+ inputFieldFrame.origin.x = NSMaxX(bounds) - NSWidth(inputFieldFrame);
+ inputFieldFrame.origin.y = NSMaxY(labelFrame) - NSHeight(inputFieldFrame);
+ [inputField_ setFrameOrigin:inputFieldFrame.origin];
+
+ // Vertically center the label with respect to the input field.
+ labelFrame.origin.y -=
+ roundf((NSHeight(inputFieldFrame) - NSHeight(labelFrame)) / 2.0);
groby-ooo-7-16 2013/12/13 19:25:20 I'm still not sure this works - if the label is mu
Ilya Sherman 2013/12/14 00:03:06 Is there ever a case where the label is multi-line
groby-ooo-7-16 2013/12/14 00:08:40 Hm. Looking at the mocks, it seems the CVV challen
Ilya Sherman 2013/12/14 01:15:26 Alright, added the manual futz factor back in, but
// Due to fixed width, fields are guaranteed to not overlap.
- DCHECK_LE(NSMaxX(labelFrame), NSMinX(inputfieldFrame));
+ DCHECK_LE(NSMaxX(labelFrame), NSMinX(inputFieldFrame));
}
[spacer_ setFrame:spacerFrame];
« 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