Commit 16bcfa59 authored by rsesek@chromium.org's avatar rsesek@chromium.org

[Mac] Polish the infobars.

This makes sure all the text sizes and baselines are correct. Roll GTM DEPS
r452:453 to pick up a fix for sizeToFit on rounded texture buttons.

BUG=86410
TEST=Anal polish.

Review URL: http://codereview.chromium.org/7601028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96058 0039d316-1c4b-4281-b951-d872f2087c98
parent d6773feb
......@@ -323,7 +323,7 @@ deps_os = {
"/trunk/deps/reference_builds/chrome_mac@89574",
"src/third_party/GTM":
(Var("googlecode_url") % "google-toolbox-for-mac") + "/trunk@452",
(Var("googlecode_url") % "google-toolbox-for-mac") + "/trunk@453",
"src/third_party/pdfsqueeze":
(Var("googlecode_url") % "pdfsqueeze") + "/trunk@4",
"src/third_party/lighttpd":
......
......@@ -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];
}
......
......@@ -19,6 +19,10 @@ NSButton* CreateNSButtonWithResourceIDAndParameter(
NSButton* button = [[NSButton alloc] init];
[button setTitle:base::SysUTF16ToNSString(title)];
[button setBezelStyle:NSTexturedRoundedBezelStyle];
// Round textured buttons have a different font size than the default button.
NSFont* font = [NSFont systemFontOfSize:
[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
[[button cell] setFont:font];
return button;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment