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

Unified Diff: chrome/browser/ui/cocoa/hyperlink_text_view.mm

Issue 40483003: [rAC, OSX] Add "generated CC" info bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes aplenty Created 7 years, 2 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/hyperlink_text_view.mm
diff --git a/chrome/browser/ui/cocoa/hyperlink_text_view.mm b/chrome/browser/ui/cocoa/hyperlink_text_view.mm
index b22167bee5be7d3034bd794ec8858bcb8c5acda4..7c498274a5eb4b3ba3115c9e917428472d31cf3e 100644
--- a/chrome/browser/ui/cocoa/hyperlink_text_view.mm
+++ b/chrome/browser/ui/cocoa/hyperlink_text_view.mm
@@ -144,4 +144,18 @@ const float kTextBaselineShift = -1.0;
acceptsFirstResponder_ = acceptsFirstResponder;
}
+- (void)setFrameSizeForWidth:(CGFloat)width {
Scott Hess - ex-Googler 2013/10/31 23:33:38 This is like -sizeToFit, except with a fixed width
groby-ooo-7-16 2013/11/01 00:28:59 Turns out minsize/maxsize don't bother sizeToFit t
+ // There's no direct API to compute desired sizes - use layouting instead.
+ // Layout in a rect with fixed width and "infinite" height.
+ [self setFrameSize:NSMakeSize(width, CGFLOAT_MAX)];
+
+ // Use the layout manager to compute size.
+ NSLayoutManager* layoutManager = [self layoutManager];
+ NSTextContainer* textContainer = [self textContainer];
+ [layoutManager ensureLayoutForTextContainer:textContainer];
+ NSRect newFrame = [layoutManager usedRectForTextContainer:textContainer];
+ [self setFrameSize:newFrame.size];
+}
+
+
@end

Powered by Google App Engine
This is Rietveld 408576698