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

Unified Diff: chrome/browser/cocoa/location_bar/image_decoration.mm

Issue 3015046: [Mac] M6 Omnibox positioning changes. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Wordsmith per Rohit. Created 10 years, 5 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
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) {

Powered by Google App Engine
This is Rietveld 408576698