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

Unified Diff: chrome/browser/ui/cocoa/infobars/infobar_controller.mm

Issue 7601028: [Mac] Polish the infobars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typo Created 9 years, 4 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
« no previous file with comments | « DEPS ('k') | chrome/browser/ui/cocoa/translate/before_translate_infobar_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/infobars/infobar_controller.mm
diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm
index f5a5cfca7ccc6935806c11a2fd663d95bbf20b3e..79d257012a5ed3c327410540951d8fb25d6e2585 100644
--- a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm
@@ -26,6 +26,9 @@ namespace {
// Durations set to match the default SlideAnimation duration.
const float kAnimateOpenDuration = 0.12;
const float kAnimateCloseDuration = 0.12;
+
+// The baseline shift for text in the NSTextView.
+const float kTextBaselineShift = -1.0;
}
// This simple subclass of |NSTextView| just doesn't show the (text) cursor
@@ -233,6 +236,8 @@ const float kAnimateCloseDuration = 0.12;
forKey:NSFontAttributeName];
[attributes setObject:[NSCursor arrowCursor]
forKey:NSCursorAttributeName];
+ [attributes setObject:[NSNumber numberWithFloat:kTextBaselineShift]
+ forKey:NSBaselineOffsetAttributeName];
scoped_nsobject<NSAttributedString> attributedString(
[[NSAttributedString alloc] initWithString:message
attributes:attributes]);
@@ -321,9 +326,8 @@ const float kAnimateCloseDuration = 0.12;
linkOffset = [message length];
}
// Create an attributes dictionary for the entire message. We have
- // to expicitly set the font the control's font. We also override
- // the cursor to give us the normal cursor rather than the text
- // insertion cursor.
+ // to explicitly set the control's font. We also override the cursor to give
+ // us the normal cursor rather than the text insertion cursor.
NSMutableDictionary* linkAttributes = [NSMutableDictionary dictionary];
[linkAttributes setObject:[NSCursor arrowCursor]
forKey:NSCursorAttributeName];
@@ -356,6 +360,11 @@ const float kAnimateCloseDuration = 0.12;
attributes:linkAttributes]);
[infoText.get() insertAttributedString:attributedString.get()
atIndex:linkOffset];
+ // The entire text needs a baseline shift.
+ [infoText addAttribute:NSBaselineOffsetAttributeName
+ value:[NSNumber numberWithDouble:kTextBaselineShift]
+ range:NSMakeRange(0, [infoText length])];
+
// Update the label view with the new text.
[[label_.get() textStorage] setAttributedString:infoText];
}
« no previous file with comments | « DEPS ('k') | chrome/browser/ui/cocoa/translate/before_translate_infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698