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

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

Issue 82593002: [rAC, OSX] Align bubble arrow based on location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm ('k') | 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_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 ee4ee05773429ab1bbd2400f997e1dab892a649e..c3bda1916b76c3dfc6e34a389c708b6d3317be3e 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
+#import "chrome/browser/ui/cocoa/info_bubble_view.h"
@implementation AutofillDetailsContainer
@@ -157,14 +158,6 @@
}
}
-- (NSPoint)anchorPointFromView:(NSView*)view {
- // All math done in window coordinates, since views might be flipped.
- NSRect viewRect = [view convertRect:[view bounds] toView:nil];
- NSPoint anchorPoint =
- NSMakePoint(NSMidX(viewRect), NSMinY(viewRect));
- return [[view window] convertBaseToScreen:anchorPoint];
-}
-
- (void)errorBubbleWindowWillClose:(NSNotification*)notification {
DCHECK_EQ([notification object], [errorBubbleController_ window]);
@@ -195,7 +188,24 @@
// Compute anchor point (in window coords - views might be flipped).
NSRect viewRect = [field convertRect:[field bounds] toView:nil];
- NSPoint anchorPoint = NSMakePoint(NSMidX(viewRect), NSMinY(viewRect));
+
+ // If a bubble at maximum size with a left-aligned edge would exceed the
+ // window width, align the right edge of bubble and view. In all other
+ // cases, left edge of bubble and view align.
Ilya Sherman 2013/11/22 04:32:10 nit: Suggested rephrasing: "In all other cases, al
groby-ooo-7-16 2013/11/22 04:50:15 Done.
+ NSPoint anchorPoint;
+ if ((NSMinX(viewRect) + [errorBubbleController_ maxWidth]) >
Ilya Sherman 2013/11/22 04:32:10 Hmm, why maxWidth rather than actual width?
groby-ooo-7-16 2013/11/22 04:50:15 If I don't do that, the arrow/edge alignment might
Ilya Sherman 2013/11/22 04:58:09 I see, that makes sense. Mind recording that as c
groby-ooo-7-16 2013/11/22 19:12:13 Done.
+ NSWidth([parentWindow frame])) {
Ilya Sherman 2013/11/22 04:32:10 Hmm, you're comparing a coordinate to a width. Is
groby-ooo-7-16 2013/11/22 04:50:15 That is indeed intentional. The viewRect is in the
Ilya Sherman 2013/11/22 04:58:09 Ah, I missed that the viewRect was guaranteed to b
groby-ooo-7-16 2013/11/22 19:12:13 Done.
+ anchorPoint = NSMakePoint(NSMaxX(viewRect), NSMinY(viewRect));
+ [[errorBubbleController_ bubble] setArrowLocation:info_bubble::kTopRight];
+ [[errorBubbleController_ bubble] setAlignment:
+ info_bubble::kAlignRightEdgeToAnchorEdge];
+
+ } else {
+ anchorPoint = NSMakePoint(NSMinX(viewRect), NSMinY(viewRect));
+ [[errorBubbleController_ bubble] setArrowLocation:info_bubble::kTopLeft];
+ [[errorBubbleController_ bubble] setAlignment:
+ info_bubble::kAlignLeftEdgeToAnchorEdge];
+ }
[errorBubbleController_ setAnchorPoint:
[parentWindow convertBaseToScreen:anchorPoint]];
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_bubble_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698