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

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

Issue 2478673002: [Mac] Hover/Pressed background for the Omnibox decorations (Closed)
Patch Set: nit 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/content_setting_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
index fd005bf7f945ad122710570ea0b622c1e07200b7..2d29915dfa517d385eb023209b41670067d79d69 100644
--- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
@@ -59,15 +59,14 @@ const double kInMotionMultiplier = 1.0 / kInMotionInterval;
// Padding for the animated text with respect to the image.
const CGFloat kTextMarginPadding = 4;
-const CGFloat kIconMarginPadding = 2;
+const CGFloat kIconMarginPadding = 4;
const CGFloat kBorderPadding = 3;
-// Padding between the divider between the omnibox text and the divider. The
-// desired value for each side is 8px. We get 5px on the left side by
-// subtracting kBorderPadding from 8px.
-const CGFloat kRightDividerPadding = 8.0;
-const CGFloat kLeftDividerPadding = 5.0;
-const CGFloat kDividerPadding = kLeftDividerPadding + kRightDividerPadding;
+// Padding between the divider and the decoration on the right.
+const CGFloat kDividerPadding = 1;
+
+// Padding between the divider and the text.
+const CGFloat kTextDividerPadding = 2;
// Color of the vector graphic icons. Used when the location is not dark.
// SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF);
@@ -383,17 +382,20 @@ void ContentSettingDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
NSRect remainder = frame;
remainder.origin.x = NSMaxX(icon_rect) + kTextMarginPadding;
remainder.size.width =
- NSMaxX(background_rect) - NSMinX(remainder) - kLeftDividerPadding;
+ NSMaxX(background_rect) - NSMinX(remainder) - kTextDividerPadding;
DrawAttributedString(animated_text_, remainder);
- NSBezierPath* line = [NSBezierPath bezierPath];
- [line setLineWidth:1];
- [line moveToPoint:NSMakePoint(NSMaxX(background_rect) - kLeftDividerPadding,
- NSMinY(background_rect))];
- [line lineToPoint:NSMakePoint(NSMaxX(background_rect) - kLeftDividerPadding,
- NSMaxY(background_rect))];
- [GetDividerColor(owner_->IsLocationBarDark()) set];
- [line stroke];
+ // Draw the divider if available.
+ if (state() == LocationBarDecorationState::NORMAL) {
+ NSBezierPath* line = [NSBezierPath bezierPath];
+ [line setLineWidth:1];
+ [line moveToPoint:NSMakePoint(NSMaxX(background_rect) - kDividerPadding,
+ NSMinY(background_rect))];
+ [line lineToPoint:NSMakePoint(NSMaxX(background_rect) - kDividerPadding,
+ NSMaxY(background_rect))];
+ [GetDividerColor(owner_->IsLocationBarDark()) set];
+ [line stroke];
+ }
} else {
// No animation, draw the image as normal.
ImageDecoration::DrawInFrame(frame, control_view);

Powered by Google App Engine
This is Rietveld 408576698