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

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

Issue 2152823004: [Material][Mac] Animation for Omnibox Verbose State Chips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaning up Created 4 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/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 cdea965d56e39fda08c72b0b0b9357250576ccfe..148f9c7e0dcc2e4d0df036597feb1e1acaa90d45 100644
--- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm
@@ -24,12 +24,7 @@ CGFloat BubblePadding() {
return ui::MaterialDesignController::IsModeMaterial() ? 8.0 : 3.0;
}
-// Additional padding between the divider between the omnibox text and the
-// divider. The desired value is 8px. We get 3px by subtracting the existing
-// padding in location_bar_view from 8px.
-CGFloat DividerPadding() {
- return ui::MaterialDesignController::IsModeMaterial() ? 2.0 : 0.0;
-}
+const CGFloat kDividerPadding = 2.0;
// Padding between the icon and label.
CGFloat kIconLabelPadding = 4.0;
@@ -43,11 +38,23 @@ BubbleDecoration::BubbleDecoration() : retina_baseline_offset_(0) {
attributes_.reset([[NSMutableDictionary alloc] init]);
[attributes_ setObject:LocationBarDecoration::GetFont()
forKey:NSFontAttributeName];
+
+ base::scoped_nsobject<NSMutableParagraphStyle> style(
+ [[NSMutableParagraphStyle alloc] init]);
+ [style setLineBreakMode:NSLineBreakByClipping];
+ [attributes_ setObject:style forKey:NSParagraphStyleAttributeName];
}
BubbleDecoration::~BubbleDecoration() {
}
+// Additional padding between the divider between the omnibox text and the
+// divider. The desired value is 8px. We get 3px by subtracting the existing
+// padding in location_bar_view from 8px.
+CGFloat BubbleDecoration::DividerPadding() const {
+ return ui::MaterialDesignController::IsModeMaterial() ? kDividerPadding : 0.0;
+}
+
CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image,
NSString* label) {
if (!image && !label)
@@ -143,7 +150,12 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
[transform translateXBy:0 yBy:retina_baseline_offset_];
[transform concat];
}
- DrawLabel(label_, attributes_, textRect);
+
+ base::scoped_nsobject<NSAttributedString> str([[NSAttributedString alloc]
+ initWithString:label_
+ attributes:attributes_]);
+
+ DrawAttributedString(str, textRect);
}
}
« 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