summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 09:28:45 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 09:28:45 +0000
commit277ee5c1622bc65c6b42fedf6a0b477df6e71c09 (patch)
tree44fcd07492902b5e782a1772d6e47a7450814279
parent508d9ef56ef4b008eb195fe2a23e5fd9f4036ba0 (diff)
downloadchromium_src-277ee5c1622bc65c6b42fedf6a0b477df6e71c09.zip
chromium_src-277ee5c1622bc65c6b42fedf6a0b477df6e71c09.tar.gz
chromium_src-277ee5c1622bc65c6b42fedf6a0b477df6e71c09.tar.bz2
[rAc] [OSX] Fix padding beneath Autofill dialog title.
The padding was too large when there were no notifications visible. Fixed by tweaking how different sections define their paddings. Also, removed a TODO about moving notifications into the AutofillHeader class. After trying this, I decided that they're actually better where they are now, due to the fact that the AutofillHeader class is also used in conjunction with the sign-in view, for which no notifications are visible (but we still want to reserve vertical space for them when sizing the sign-in view so that the dialog's size doesn't bounce around). BUG=315977 TEST=Open rAc dialog, switch to local Autofill mode, enter data, confirm. Then open dialog again (should default to local Autofill mode with no notifications visible). The padding below the dialog title should be 20px rather than 30px. R=groby@chromium.org Review URL: https://codereview.chromium.org/111353002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240067 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_main_container.h3
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_main_container.mm10
-rw-r--r--chrome/browser/ui/cocoa/autofill/autofill_notification_container.mm11
3 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_main_container.h b/chrome/browser/ui/cocoa/autofill/autofill_main_container.h
index defeb23..f779f58 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_main_container.h
+++ b/chrome/browser/ui/cocoa/autofill/autofill_main_container.h
@@ -53,7 +53,8 @@ namespace autofill {
// Designated initializer.
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
-// Returns the preferred size for the footer at the specfied |width|.
+// Returns the preferred size for the footer and notifications at the specfied
+// |width|.
- (NSSize)decorationSizeForWidth:(CGFloat)width;
// Sets the anchor point for the notificationView_.
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm
index ad0410f..a74650b 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm
@@ -150,8 +150,6 @@ const SkColor kLegalDocumentsTextColor = SkColorSetRGB(102, 102, 102);
size.height += legalDocumentSize.height + autofill::kVerticalSpacing;
}
- // TODO(isherman): Move notifications into the AutofillHeader class, and
- // rename this method to -footerSizeForWidth:.
NSSize notificationSize =
[notificationContainer_ preferredSizeForWidth:width];
size.height += notificationSize.height;
@@ -165,7 +163,7 @@ const SkColor kLegalDocumentsTextColor = SkColorSetRGB(102, 102, 102);
NSSize size = NSMakeSize(std::max(decorationSize.width, detailsSize.width),
decorationSize.height + detailsSize.height);
- size.height += 2 * autofill::kDetailVerticalPadding;
+ size.height += autofill::kDetailVerticalPadding;
return size;
}
@@ -207,15 +205,13 @@ const SkColor kLegalDocumentsTextColor = SkColorSetRGB(102, 102, 102);
// Buttons/checkbox/legal take up lower part of view, notifications the
// upper part. Adjust the detailsContainer to take up the remainder.
CGFloat remainingHeight =
- NSHeight(bounds) - currentY - NSHeight(notificationFrame) -
- autofill::kDetailVerticalPadding;
+ NSHeight(bounds) - currentY - NSHeight(notificationFrame);
NSRect containerFrame =
NSMakeRect(0, currentY, NSWidth(bounds), remainingHeight);
[[detailsContainer_ view] setFrame:containerFrame];
[detailsContainer_ performLayout];
- notificationFrame.origin =
- NSMakePoint(0, NSMaxY(containerFrame) + autofill::kDetailVerticalPadding);
+ notificationFrame.origin = NSMakePoint(0, NSMaxY(containerFrame));
[[notificationContainer_ view] setFrame:notificationFrame];
[notificationContainer_ performLayout];
}
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_notification_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_notification_container.mm
index f25680f..afcbdaa 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_notification_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_notification_container.mm
@@ -10,6 +10,10 @@
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_notification_controller.h"
+// Padding above the notifications section.
+const CGFloat kTopPadding =
+ autofill::kDetailVerticalPadding - autofill::kArrowHeight;
+
@implementation AutofillNotificationContainer
- (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate {
@@ -32,6 +36,9 @@
if ([notificationControllers_ count] == 0)
return preferredSize;
+ // A bit of padding above the arrow.
+ preferredSize.height += kTopPadding;
+
// If the first notification doesn't have an arrow, reserve empty space.
if (![[notificationControllers_ objectAtIndex:0] hasArrow])
preferredSize.height += autofill::kArrowHeight;
@@ -41,6 +48,8 @@
preferredSize.height += [controller preferredSizeForWidth:width].height;
}
+ preferredSize.height += autofill::kDetailVerticalPadding;
+
return preferredSize;
}
@@ -49,6 +58,8 @@
return;
NSRect remaining = [[self view] bounds];
+ remaining.origin.y += autofill::kDetailVerticalPadding;
+ remaining.size.height -= kTopPadding + autofill::kDetailVerticalPadding;
if (![[notificationControllers_ objectAtIndex:0] hasArrow])
remaining.size.height -= autofill::kArrowHeight;