summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/hyperlink_button_cell.mm
diff options
context:
space:
mode:
authormrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 20:09:18 +0000
committermrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 20:09:18 +0000
commita8e4a8fa39604cd309e1e3d62cf9c552dcfe541d (patch)
tree9ac98acea8834eff2c6298f931d03324b06fab21 /chrome/browser/cocoa/hyperlink_button_cell.mm
parent6a0ee4ec5905be6182b20218da1c276fc7e457fd (diff)
downloadchromium_src-a8e4a8fa39604cd309e1e3d62cf9c552dcfe541d.zip
chromium_src-a8e4a8fa39604cd309e1e3d62cf9c552dcfe541d.tar.gz
chromium_src-a8e4a8fa39604cd309e1e3d62cf9c552dcfe541d.tar.bz2
Resize the "For quick access..." and "Import bookmarks now..." components shown in the bookmark bar when there are no bookmarks in the bar, when the window resizes. Show ellipses when each gets trimmed and hide them when they get too small.
BookmarkBar.xib changes: Connect the "Import bookmarks now..." button up to the importBookmarksButton_ outlet in the BookmarkBarView. BUG=32557 TEST=1) Start up a browser with no bookmarks on the bookmarks bar. 2) Verify that the "For quick access..." and "Import bookmarks now..." test fully shows. 3) Start shrinking the width of the browser window. 4) Verify that the "Import bookmarks now..." text is shrunk/clipped and finally disappears as the window gets narrower. 5) Continue shrinking the width and verify that the "For quick access..." text is shrunk/clipped with ellipses as the window gets narrower. 6) Grow the window and verify that the "For quick access..." reappears and then the "Import book now..." does. Review URL: http://codereview.chromium.org/2243002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/hyperlink_button_cell.mm')
-rw-r--r--chrome/browser/cocoa/hyperlink_button_cell.mm15
1 files changed, 9 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/hyperlink_button_cell.mm b/chrome/browser/cocoa/hyperlink_button_cell.mm
index a087d29..12c4fec 100644
--- a/chrome/browser/cocoa/hyperlink_button_cell.mm
+++ b/chrome/browser/cocoa/hyperlink_button_cell.mm
@@ -81,15 +81,18 @@
];
}
-// Override the drawing point for the cell so that the custom style attributes
-// can always be applied.
+// Override the drawing for the cell so that the custom style attributes
+// can always be applied and so that ellipses will appear when appropriate.
- (NSRect)drawTitle:(NSAttributedString*)title
withFrame:(NSRect)frame
inView:(NSView*)controlView {
- scoped_nsobject<NSAttributedString> attrString(
- [[NSAttributedString alloc] initWithString:[title string]
- attributes:[self linkAttributes]]);
- return [super drawTitle:attrString.get() withFrame:frame inView:controlView];
+ NSDictionary* linkAttributes = [self linkAttributes];
+ NSString* plainTitle = [title string];
+ [plainTitle drawWithRect:frame
+ options:(NSStringDrawingUsesLineFragmentOrigin |
+ NSStringDrawingTruncatesLastVisibleLine)
+ attributes:linkAttributes];
+ return frame;
}
// Override the default behavior to draw the border. Instead, change the cursor.