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

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

Issue 1909453004: [Mac][Material Design] Adjust EV chip to match Material Design spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 4 years, 8 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/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 ba2e49238f6c29c7915df4a9d5bb88369cf241dd..7bdd563e1a2d4fc05c0886bf054690ea4f26ae8e 100644
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
@@ -31,9 +31,10 @@ const CGFloat kBackgroundYInset = 4.0;
} // namespace
-BubbleDecoration::BubbleDecoration() {
+BubbleDecoration::BubbleDecoration() : baseline_offset_(0) {
attributes_.reset([[NSMutableDictionary alloc] init]);
- [attributes_ setObject:GetFont() forKey:NSFontAttributeName];
+ [attributes_ setObject:LocationBarDecoration::GetFont()
+ forKey:NSFontAttributeName];
}
BubbleDecoration::~BubbleDecoration() {
@@ -102,6 +103,7 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
if (label_) {
NSRect textRect = frame;
textRect.origin.x = textOffset;
+ textRect.origin.y += baseline_offset_;
textRect.size.width = NSMaxX(decoration_frame) - NSMinX(textRect);
DrawLabel(label_, attributes_, textRect);
}
@@ -135,6 +137,10 @@ void BubbleDecoration::DrawWithBackgroundInFrame(NSRect background_frame,
DrawInFrame(frame, control_view);
}
+NSFont* BubbleDecoration::GetFont() const {
+ return [attributes_ objectForKey:NSFontAttributeName];
+}
+
NSImage* BubbleDecoration::GetImage() {
return image_;
}
@@ -154,3 +160,11 @@ void BubbleDecoration::SetLabel(NSString* label) {
void BubbleDecoration::SetTextColor(NSColor* text_color) {
[attributes_ setObject:text_color forKey:NSForegroundColorAttributeName];
}
+
+void BubbleDecoration::SetFont(NSFont* font) {
+ [attributes_ setObject:font forKey:NSFontAttributeName];
+}
+
+void BubbleDecoration::SetBaselineOffset(CGFloat offset) {
+ baseline_offset_ = offset;
+}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/bubble_decoration.h ('k') | chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698