| Index: chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
|
| diff --git a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
|
| index 633bdf2342ccf1ae36a60e68948b74d4e1d8fb0b..ec03925056f6abdd70c5427611b150aa9427e16e 100644
|
| --- a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
|
| +++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
|
| @@ -100,6 +100,14 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
|
| }
|
|
|
| - (BOOL)validate {
|
| + // Account for a subtle timing issue. -validate is called from the dialog's
|
| + // -accept. -accept then hides the dialog. If the data does not validate the
|
| + // dialog is then reshown, focusing on the first invalid field. This happens
|
| + // without running the message loop, so windowWillClose has not fired when
|
| + // the dialog and error bubble is reshown, leading to a missing error bubble.
|
| + // Resetting the anchor view here forces the bubble to show.
|
| + errorBubbleAnchorView_ = nil;
|
| +
|
| bool allValid = true;
|
| for (AutofillSectionContainer* details in details_.get()) {
|
| if (![[details view] isHidden])
|
| @@ -156,9 +164,17 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
|
| name:NSWindowWillCloseNotification
|
| object:[errorBubbleController_ window]];
|
| errorBubbleController_ = nil;
|
| + errorBubbleAnchorView_ = nil;
|
| }
|
|
|
| - (void)showErrorBubbleForField:(NSControl<AutofillInputField>*)field {
|
| + // If there is already a bubble controller handling this field, reuse.
|
| + if (errorBubbleController_ && errorBubbleAnchorView_ == field) {
|
| + [errorBubbleController_ setMessage:[field validityMessage]];
|
| +
|
| + return;
|
| + }
|
| +
|
| if (errorBubbleController_)
|
| [errorBubbleController_ close];
|
| DCHECK(!errorBubbleController_);
|
| @@ -203,6 +219,7 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
|
| [errorBubbleController_ setAnchorPoint:
|
| [parentWindow convertBaseToScreen:anchorPoint]];
|
|
|
| + errorBubbleAnchorView_ = field;
|
| [errorBubbleController_ showWindow:self];
|
| }
|
|
|
|
|