Index: chrome/browser/cocoa/location_bar/image_decoration.mm |
diff --git a/chrome/browser/cocoa/location_bar/image_decoration.mm b/chrome/browser/cocoa/location_bar/image_decoration.mm |
index a5cdc801d3daf576f91ae6db6a23300f1e26a206..980d98d27383345454e93a7e75e508b8d7b3b935 100644 |
--- a/chrome/browser/cocoa/location_bar/image_decoration.mm |
+++ b/chrome/browser/cocoa/location_bar/image_decoration.mm |
@@ -27,9 +27,12 @@ NSRect ImageDecoration::GetDrawRectInFrame(NSRect frame) { |
if (!image) |
return frame; |
+ // Center the image within the frame. |
const CGFloat delta_height = NSHeight(frame) - [image size].height; |
const CGFloat y_inset = std::floor(delta_height / 2.0); |
- return NSInsetRect(frame, 0.0, y_inset); |
+ const CGFloat delta_width = NSWidth(frame) - [image size].width; |
+ const CGFloat x_inset = std::floor(delta_width / 2.0); |
+ return NSInsetRect(frame, x_inset, y_inset); |
} |
CGFloat ImageDecoration::GetWidthForSpace(CGFloat width) { |