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

Unified Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm

Issue 2524223002: MacViews: Anchor bubbles according to the MD spec. (Closed)
Patch Set: Fix BubbleBorder::GetBounds() Created 4 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
Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
index a2952039b42c22629a30f2bda87fd7fa038feef4..ac7c3113bf74c45f8bcfa1d8fbd0a7f5161a10b6 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
@@ -299,9 +299,23 @@ const CGFloat kAnimationDuration = 0.2;
}
- (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration {
- const NSRect frame =
- [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
- const NSPoint point = decoration->GetBubblePointInFrame(frame);
+ NSPoint point;
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
+ // Under MD, dialogs have no arrow and anchor to corner of the decoration
+ // frame, not a specific point within it. See http://crbug.com/566115.
+ BOOL isLeftDecoration;
+ const NSRect frame =
+ [[self cell] backgroundFrameForDecoration:decoration
+ inFrame:[self bounds]
+ isLeftDecoration:&isLeftDecoration];
+ point.y = NSMaxY(frame);
+ point.x = isLeftDecoration ? NSMinX(frame) : NSMaxX(frame);
+ } else {
+ const NSRect frame =
+ [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
+ point = decoration->GetBubblePointInFrame(frame);
+ }
+
return [self convertPoint:point toView:nil];
}
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | ui/views/bubble/bubble_border.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698