diff options
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; |