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

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

Issue 2471583002: [Mac] Change the omnibox decoration padding (Closed)
Patch Set: Fixed tests 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/bubble_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
index ed332a3816be226cb827b193702ce22dca5ebd5a..714e4b291917a7a7243fea6be34e115729fa0506 100644
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
@@ -17,19 +17,19 @@
namespace {
// This is used to increase the right margin of this decoration.
-const CGFloat kRightSideMargin = 1.0;
+const CGFloat kLeftSidePadding = 6.0;
// Padding between the icon/label and bubble edges.
-const CGFloat kBubblePadding = 8.0;
+const CGFloat kBubblePadding = 7.0;
// Additional padding between the divider and the label.
-const CGFloat kDividerPadding = 2.0;
+const CGFloat kDividerPadding = 6.0;
// Padding between the icon and label.
const CGFloat kIconLabelPadding = 4.0;
-// Inset for the background.
-const CGFloat kBackgroundYInset = 4.0;
+// Inset for the image frame.
+const CGFloat kImageFrameYInset = 4.0;
} // namespace
@@ -61,11 +61,11 @@ CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image,
const CGFloat label_width =
std::floor([label sizeWithAttributes:attributes_].width);
return kBubblePadding + image_width + kIconLabelPadding + label_width +
- DividerPadding();
+ DividerPadding() + kLeftSidePadding;
}
NSRect BubbleDecoration::GetImageRectInFrame(NSRect frame) {
- NSRect image_rect = NSInsetRect(frame, 0.0, kBackgroundYInset);
+ NSRect image_rect = NSInsetRect(frame, 0.0, kImageFrameYInset);
if (image_) {
// Center the image vertically.
const NSSize image_size = [image_ size];
@@ -94,12 +94,13 @@ CGFloat BubbleDecoration::GetWidthForSpace(CGFloat width) {
}
void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
- const NSRect decoration_frame = NSInsetRect(frame, 0.0, kBackgroundYInset);
+ const NSRect decoration_frame = NSInsetRect(frame, 0.0, kImageFrameYInset);
CGFloat text_offset = NSMinX(decoration_frame);
if (image_) {
// Center the image vertically.
const NSSize image_size = [image_ size];
NSRect image_rect = decoration_frame;
+ image_rect.origin.x += kLeftSidePadding;
image_rect.origin.y +=
std::floor((NSHeight(decoration_frame) - image_size.height) / 2.0);
image_rect.size = image_size;
@@ -145,14 +146,6 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
}
}
-void BubbleDecoration::DrawWithBackgroundInFrame(NSRect background_frame,
- NSRect frame,
- NSView* control_view) {
- NSRect rect = NSInsetRect(background_frame, 0, 1);
- rect.size.width -= kRightSideMargin;
- DrawInFrame(frame, control_view);
-}
-
NSFont* BubbleDecoration::GetFont() const {
return [attributes_ objectForKey:NSFontAttributeName];
}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/bubble_decoration.h ('k') | chrome/browser/ui/cocoa/location_bar/image_decoration.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698