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

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

Issue 1802643002: Adjust locationbar text vertical position under Material Design. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code cleanup. Created 4 years, 9 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5087453f323047a4b245edf5d0713aa1838bd88e..705cc157d18a91ee2cafcbcd35d81ab828921dad 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
@@ -15,6 +15,7 @@
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#import "chrome/browser/ui/cocoa/url_drop_target.h"
#import "chrome/browser/ui/cocoa/view_id_util.h"
+#import "ui/base/cocoa/nsview_additions.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
@@ -361,9 +362,20 @@ const CGFloat kAnimationDuration = 0.2;
[nc removeObserver:self
name:NSWindowDidResizeNotification
object:[self window]];
+ [nc removeObserver:self
+ name:NSWindowDidChangeScreenNotification
+ object:[self window]];
}
}
+- (void)windowDidChangeScreen {
+ // Inform the AutocompleteTextFieldCell's of the coordinate system line
+ // width needed to draw a single-pixel line. This value changes as we move
+ // between Retina and non-Retina displays.
+ [[self cell] setSinglePixelLineWidth:[self cr_lineWidth]];
+ [self setNeedsDisplay];
+}
+
- (void)viewDidMoveToWindow {
if (![self window]) {
return;
@@ -387,6 +399,14 @@ const CGFloat kAnimationDuration = 0.2;
selector:@selector(windowDidResize:)
name:NSWindowDidResizeNotification
object:[self window]];
+ [nc addObserver:self
+ selector:@selector(windowDidChangeScreen)
+ name:NSWindowDidChangeScreenNotification
+ object:[self window]];
+
+ // Make sure the cell has the current line width.
+ [[self cell] setSinglePixelLineWidth:[self cr_lineWidth]];
+
// Only register for drops if not in a popup window. Lazily create the
// drop handler when the type of window is known.
BrowserWindowController* windowController =
« 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