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 = { ...@@ -323,7 +323,7 @@ deps_os = {
"/trunk/deps/reference_builds/chrome_mac@89574", "/trunk/deps/reference_builds/chrome_mac@89574",
"src/third_party/GTM": "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": "src/third_party/pdfsqueeze":
(Var("googlecode_url") % "pdfsqueeze") + "/trunk@4", (Var("googlecode_url") % "pdfsqueeze") + "/trunk@4",
"src/third_party/lighttpd": "src/third_party/lighttpd":
......
...@@ -26,6 +26,9 @@ namespace { ...@@ -26,6 +26,9 @@ namespace {
// Durations set to match the default SlideAnimation duration. // Durations set to match the default SlideAnimation duration.
const float kAnimateOpenDuration = 0.12; const float kAnimateOpenDuration = 0.12;
const float kAnimateCloseDuration = 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 // This simple subclass of |NSTextView| just doesn't show the (text) cursor
...@@ -233,6 +236,8 @@ const float kAnimateCloseDuration = 0.12; ...@@ -233,6 +236,8 @@ const float kAnimateCloseDuration = 0.12;
forKey:NSFontAttributeName]; forKey:NSFontAttributeName];
[attributes setObject:[NSCursor arrowCursor] [attributes setObject:[NSCursor arrowCursor]
forKey:NSCursorAttributeName]; forKey:NSCursorAttributeName];
[attributes setObject:[NSNumber numberWithFloat:kTextBaselineShift]
forKey:NSBaselineOffsetAttributeName];
scoped_nsobject<NSAttributedString> attributedString( scoped_nsobject<NSAttributedString> attributedString(
[[NSAttributedString alloc] initWithString:message [[NSAttributedString alloc] initWithString:message
attributes:attributes]); attributes:attributes]);
...@@ -321,9 +326,8 @@ const float kAnimateCloseDuration = 0.12; ...@@ -321,9 +326,8 @@ const float kAnimateCloseDuration = 0.12;
linkOffset = [message length]; linkOffset = [message length];
} }
// Create an attributes dictionary for the entire message. We have // Create an attributes dictionary for the entire message. We have
// to expicitly set the font the control's font. We also override // to explicitly set the control's font. We also override the cursor to give
// the cursor to give us the normal cursor rather than the text // us the normal cursor rather than the text insertion cursor.
// insertion cursor.
NSMutableDictionary* linkAttributes = [NSMutableDictionary dictionary]; NSMutableDictionary* linkAttributes = [NSMutableDictionary dictionary];
[linkAttributes setObject:[NSCursor arrowCursor] [linkAttributes setObject:[NSCursor arrowCursor]
forKey:NSCursorAttributeName]; forKey:NSCursorAttributeName];
...@@ -356,6 +360,11 @@ const float kAnimateCloseDuration = 0.12; ...@@ -356,6 +360,11 @@ const float kAnimateCloseDuration = 0.12;
attributes:linkAttributes]); attributes:linkAttributes]);
[infoText.get() insertAttributedString:attributedString.get() [infoText.get() insertAttributedString:attributedString.get()
atIndex:linkOffset]; 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. // Update the label view with the new text.
[[label_.get() textStorage] setAttributedString:infoText]; [[label_.get() textStorage] setAttributedString:infoText];
} }
......
...@@ -19,6 +19,10 @@ NSButton* CreateNSButtonWithResourceIDAndParameter( ...@@ -19,6 +19,10 @@ NSButton* CreateNSButtonWithResourceIDAndParameter(
NSButton* button = [[NSButton alloc] init]; NSButton* button = [[NSButton alloc] init];
[button setTitle:base::SysUTF16ToNSString(title)]; [button setTitle:base::SysUTF16ToNSString(title)];
[button setBezelStyle:NSTexturedRoundedBezelStyle]; [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; 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