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

Side by Side 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 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
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 - (NSString*)suggestText { 293 - (NSString*)suggestText {
294 return suggestText_; 294 return suggestText_;
295 } 295 }
296 296
297 - (NSColor*)suggestColor { 297 - (NSColor*)suggestColor {
298 return suggestColor_; 298 return suggestColor_;
299 } 299 }
300 300
301 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration { 301 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration {
302 const NSRect frame = 302 NSPoint point;
303 [[self cell] frameForDecoration:decoration inFrame:[self bounds]]; 303 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
304 const NSPoint point = decoration->GetBubblePointInFrame(frame); 304 // Under MD, dialogs have no arrow and anchor to corner of the decoration
305 // frame, not a specific point within it. See http://crbug.com/566115.
306 BOOL isLeftDecoration;
307 const NSRect frame =
308 [[self cell] backgroundFrameForDecoration:decoration
309 inFrame:[self bounds]
310 isLeftDecoration:&isLeftDecoration];
311 point.y = NSMaxY(frame);
312 point.x = isLeftDecoration ? NSMinX(frame) : NSMaxX(frame);
313 } else {
314 const NSRect frame =
315 [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
316 point = decoration->GetBubblePointInFrame(frame);
317 }
318
305 return [self convertPoint:point toView:nil]; 319 return [self convertPoint:point toView:nil];
306 } 320 }
307 321
308 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where 322 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where
309 // changes to the cell layout should be flushed. LocationBarViewMac 323 // changes to the cell layout should be flushed. LocationBarViewMac
310 // and ToolbarController are calling this routine directly, and I 324 // and ToolbarController are calling this routine directly, and I
311 // think they are probably wrong. 325 // think they are probably wrong.
312 // http://crbug.com/40053 326 // http://crbug.com/40053
313 - (void)updateMouseTracking { 327 - (void)updateMouseTracking {
314 // This will force |resetCursorRects| to be called, as it is not to be called 328 // This will force |resetCursorRects| to be called, as it is not to be called
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 NSMinY(frame), 609 NSMinY(frame),
596 suggestWidth, 610 suggestWidth,
597 NSHeight(frame)); 611 NSHeight(frame));
598 612
599 gfx::ScopedNSGraphicsContextSaveGState saveGState; 613 gfx::ScopedNSGraphicsContextSaveGState saveGState;
600 NSRectClip(suggestRect); 614 NSRectClip(suggestRect);
601 [cell drawInteriorWithFrame:frame inView:controlView]; 615 [cell drawInteriorWithFrame:frame inView:controlView];
602 } 616 }
603 617
604 } // namespace autocomplete_text_field 618 } // namespace autocomplete_text_field
OLDNEW
« 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