Title: [136073] trunk/Source/WebCore
Revision
136073
Author
[email protected]
Date
2012-11-28 16:13:19 -0800 (Wed, 28 Nov 2012)

Log Message

[mac] WebHTMLConverter should maintain font size even when there is no related NSFont
https://bugs.webkit.org/show_bug.cgi?id=103568

Reviewed by Alexey Proskuryakov.

WebHTMLConverter should use the default font at the correct size when it
encounters a font that cannot be backed by an NSFont (e.g. a WebFont).

* platform/mac/HTMLConverter.mm:
(+[WebHTMLConverter editingAttributedStringFromRange:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136072 => 136073)


--- trunk/Source/WebCore/ChangeLog	2012-11-29 00:11:38 UTC (rev 136072)
+++ trunk/Source/WebCore/ChangeLog	2012-11-29 00:13:19 UTC (rev 136073)
@@ -1,3 +1,16 @@
+2012-11-28  Tim Horton  <[email protected]>
+
+        [mac] WebHTMLConverter should maintain font size even when there is no related NSFont
+        https://bugs.webkit.org/show_bug.cgi?id=103568
+
+        Reviewed by Alexey Proskuryakov.
+
+        WebHTMLConverter should use the default font at the correct size when it
+        encounters a font that cannot be backed by an NSFont (e.g. a WebFont).
+
+        * platform/mac/HTMLConverter.mm:
+        (+[WebHTMLConverter editingAttributedStringFromRange:]):
+
 2012-11-23  Dirk Schulze  <[email protected]>
 
         CSS parser does not support -webkit-mask-size for -webkit-mask shorthand

Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.mm (136072 => 136073)


--- trunk/Source/WebCore/platform/mac/HTMLConverter.mm	2012-11-29 00:11:38 UTC (rev 136072)
+++ trunk/Source/WebCore/platform/mac/HTMLConverter.mm	2012-11-29 00:13:19 UTC (rev 136073)
@@ -1667,6 +1667,7 @@
 // This function uses TextIterator, which makes offsets in its result compatible with HTML editing.
 + (NSAttributedString *)editingAttributedStringFromRange:(Range*)range
 {
+    NSFontManager *fontManager = [NSFontManager sharedFontManager];
     NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
     NSUInteger stringLength = 0;
     RetainPtr<NSMutableDictionary> attrs(AdoptNS, [[NSMutableDictionary alloc] init]);
@@ -1702,6 +1703,8 @@
             [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
         if (NSFont *font = style->font().primaryFont()->getNSFont())
             [attrs.get() setObject:font forKey:NSFontAttributeName];
+        else
+            [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style->font().primaryFont()->platformData().size()] forKey:NSFontAttributeName];
         if (style->visitedDependentColor(CSSPropertyColor).alpha())
             [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
         else
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to