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

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

Issue 2560993002: [Mac] Fix omnibox text overlap (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
index bfd36c11934ffeafa2f50d92b86e64fe6c527eb3..7e7e900e6fa5d787848f896f4e20264ce44caa49 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
@@ -36,7 +36,10 @@ const CGFloat kRightDecorationXOffset = 2.0;
const CGFloat kLeftDecorationXOffset = 1.0;
// How much the text frame needs to overlap the rightmost left decoration.
-const CGFloat kTextFrameDecorationOverlap = 5.0;
+const CGFloat kTextFrameDecorationOverlap = 4.0;
+
+// How much the text in the cell should be offset from its left.
+const CGFloat kTitleFrameXOffset = 1.0;
// How long to wait for mouse-up on the location icon before assuming
// that the user wants to drag.
@@ -395,7 +398,15 @@ size_t CalculatePositionsInFrame(
// Superclass draws text portion WRT original |cellFrame|.
ui::ScopedCGContextSmoothFonts fontSmoothing;
- [super drawInteriorWithFrame:cellFrame inView:controlView];
+ NSAttributedString* attrString = self.attributedStringValue;
+ [attrString drawInRect:[self titleRectForBounds:cellFrame]];
+}
+
+- (NSRect)titleRectForBounds:(NSRect)rect {
+ NSRect titleRect = [super titleRectForBounds:rect];
+ titleRect.origin.x += kTitleFrameXOffset;
+ titleRect.size.width -= kTitleFrameXOffset;
+ return titleRect;
}
- (BOOL)canDropAtLocationInWindow:(NSPoint)location

Powered by Google App Engine
This is Rietveld 408576698