WebCore:
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jan 2006 22:16:25 +0000 (22:16 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jan 2006 22:16:25 +0000 (22:16 +0000)
        Move off of -[NSFont widthOfString:] since it is now deprecated.
        Use the NSStringDrawing -[NSString sizeWithAttributes:] API.

        * bridge/mac/MacFrame.mm:
        (MacFrame::attributedString):
        * kwq/KWQTextArea.mm:
        (-[KWQTextAreaTextView sizeWithColumns:rows:]):

WebKit:

        Move off of -[NSFont widthOfString:] since it is now deprecated.
        Use the NSStringDrawing -[NSString sizeWithAttributes:] API.

        * WebCoreSupport.subproj/WebFileButton.m:
        (-[WebFileChooserButton bestVisualFrameSizeForCharacterCount:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12363 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bridge/mac/MacFrame.mm
WebCore/kwq/KWQTextArea.mm
WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebFileButton.m

index 20e6e90..37a8beb 100644 (file)
@@ -1,3 +1,13 @@
+2006-01-25  Timothy Hatcher  <timothy@apple.com>
+
+        Move off of -[NSFont widthOfString:] since it is now deprecated.
+        Use the NSStringDrawing -[NSString sizeWithAttributes:] API.
+
+        * bridge/mac/MacFrame.mm:
+        (MacFrame::attributedString):
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextAreaTextView sizeWithColumns:rows:]):
+
 2006-01-24  Tim Omernick  <timo@apple.com>
 
         Reviewed by Dave Harrison.
 2006-01-24  Tim Omernick  <timo@apple.com>
 
         Reviewed by Dave Harrison.
index 872771e..de6a17c 100644 (file)
@@ -2538,7 +2538,7 @@ NSAttributedString *MacFrame::attributedString(NodeImpl *_start, int startOffset
                                 QString marker = listRenderer->markerStringValue();
                                 listText += marker;
                                 // Use AppKit metrics.  Will be rendered by AppKit.
                                 QString marker = listRenderer->markerStringValue();
                                 listText += marker;
                                 // Use AppKit metrics.  Will be rendered by AppKit.
-                                float markerWidth = [font widthOfString: marker.getNSString()];
+                                float markerWidth = [marker.getNSString() sizeWithAttributes:[NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]].width;
                                 maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
                         }
 
                                 maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
                         }
 
index d429f85..9d9fca3 100644 (file)
@@ -862,8 +862,9 @@ static NSRange RangeOfParagraph(NSString *text, int paragraph)
     // because the text view will return a substituted font if the first character in
     // the text view requires font substitution, and we don't want the size to depend on
     // the text in the text view.
     // because the text view will return a substituted font if the first character in
     // the text view requires font substitution, and we don't want the size to depend on
     // the text in the text view.
-    
-    NSSize textSize = NSMakeSize(ceil(numColumns * [_font widthOfString:@"0"]), numRows * [_font defaultLineHeightForFont]);
+
+    float columnWidth = [@"0" sizeWithAttributes:[NSDictionary dictionaryWithObject:_font forKey:NSFontAttributeName]].width;
+    NSSize textSize = NSMakeSize(ceil(numColumns * columnWidth), numRows * [[textView layoutManager] defaultLineHeightForFont:_font]);
     NSSize textContainerSize = NSMakeSize(textSize.width + [[textView textContainer] lineFragmentPadding] * 2, textSize.height);
     NSSize textContainerInset = [textView textContainerInset];
     NSSize textViewSize = NSMakeSize(textContainerSize.width + textContainerInset.width, textContainerSize.height + textContainerInset.height); 
     NSSize textContainerSize = NSMakeSize(textSize.width + [[textView textContainer] lineFragmentPadding] * 2, textSize.height);
     NSSize textContainerInset = [textView textContainerInset];
     NSSize textViewSize = NSMakeSize(textContainerSize.width + textContainerInset.width, textContainerSize.height + textContainerInset.height); 
index db339ee..197976d 100644 (file)
@@ -1,3 +1,11 @@
+2006-01-25  Timothy Hatcher  <timothy@apple.com>
+
+        Move off of -[NSFont widthOfString:] since it is now deprecated.
+        Use the NSStringDrawing -[NSString sizeWithAttributes:] API.
+
+        * WebCoreSupport.subproj/WebFileButton.m:
+        (-[WebFileChooserButton bestVisualFrameSizeForCharacterCount:]):
+
 2006-01-23  Darin Adler  <darin@apple.com>
 
         - fixed some small localizable strings issues
 2006-01-23  Darin Adler  <darin@apple.com>
 
         - fixed some small localizable strings issues
index ca273f6..b858591 100644 (file)
     size.height -= BUTTON_TOP_MARGIN + BUTTON_BOTTOM_MARGIN;
     size.width -= BUTTON_LEFT_MARGIN + BUTTON_RIGHT_MARGIN;
     size.width += AFTER_BUTTON_SPACING + ICON_WIDTH + ICON_FILENAME_SPACING;
     size.height -= BUTTON_TOP_MARGIN + BUTTON_BOTTOM_MARGIN;
     size.width -= BUTTON_LEFT_MARGIN + BUTTON_RIGHT_MARGIN;
     size.width += AFTER_BUTTON_SPACING + ICON_WIDTH + ICON_FILENAME_SPACING;
-    size.width += count * [[_button font] widthOfString:@"x"];
+    size.width += count * [@"x" sizeWithAttributes:[NSDictionary dictionaryWithObject:[_button font] forKey:NSFontAttributeName]].width;
     return size;
 }
 
     return size;
 }