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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm

Issue 2972593002: Mac: Fix up location bar decoration bubble anchoring. (Closed)
Patch Set: Created 3 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #import "base/mac/sdk_forward_declarations.h" 9 #import "base/mac/sdk_forward_declarations.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect { 285 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect {
286 [currentToolTips_ addObject:tooltip]; 286 [currentToolTips_ addObject:tooltip];
287 [self addToolTipRect:aRect owner:tooltip userData:nil]; 287 [self addToolTipRect:aRect owner:tooltip userData:nil];
288 } 288 }
289 289
290 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration { 290 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration {
291 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) 291 if (!ui::MaterialDesignController::IsSecondaryUiMaterial())
292 return [self arrowAnchorPointForDecoration:decoration]; 292 return [self arrowAnchorPointForDecoration:decoration];
293 293
294 // Under MD, dialogs have no arrow and anchor to corner of the decoration 294 // Under MD, dialogs have no arrow and anchor to corner of the location bar
295 // frame, not a specific point within it. See http://crbug.com/566115. 295 // frame, not a specific point within it. See http://crbug.com/566115.
296 BOOL isLeftDecoration; 296 BOOL isLeftDecoration = [[self cell] isLeftDecoration:decoration];
297 const NSRect frame = 297 const NSRect frame = [self bounds];
298 [[self cell] backgroundFrameForDecoration:decoration
299 inFrame:[self bounds]
300 isLeftDecoration:&isLeftDecoration];
301 NSPoint point = NSMakePoint(isLeftDecoration ? NSMinX(frame) : NSMaxX(frame), 298 NSPoint point = NSMakePoint(isLeftDecoration ? NSMinX(frame) : NSMaxX(frame),
302 NSMaxY(frame)); 299 NSMaxY(frame));
303 return [self convertPoint:point toView:nil]; 300 return [self convertPoint:point toView:nil];
304 } 301 }
305 302
306 - (NSPoint)arrowAnchorPointForDecoration:(LocationBarDecoration*)decoration { 303 - (NSPoint)arrowAnchorPointForDecoration:(LocationBarDecoration*)decoration {
307 const NSRect frame = 304 const NSRect frame =
308 [[self cell] frameForDecoration:decoration inFrame:[self bounds]]; 305 [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
309 NSPoint point = decoration->GetBubblePointInFrame(frame); 306 NSPoint point = decoration->GetBubblePointInFrame(frame);
310 return [self convertPoint:point toView:nil]; 307 return [self convertPoint:point toView:nil];
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // ThemedWindowDrawing implementation. 542 // ThemedWindowDrawing implementation.
546 543
547 - (void)windowDidChangeTheme { 544 - (void)windowDidChangeTheme {
548 [self updateColorsToMatchTheme]; 545 [self updateColorsToMatchTheme];
549 } 546 }
550 547
551 - (void)windowDidChangeActive { 548 - (void)windowDidChangeActive {
552 } 549 }
553 550
554 @end 551 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698