Title: [174689] trunk/Source/WebKit/mac
- Revision
- 174689
- Author
- [email protected]
- Date
- 2014-10-14 11:05:12 -0700 (Tue, 14 Oct 2014)
Log Message
Addressing post-review comment.
https://bugs.webkit.org/show_bug.cgi?id=137550
Unreviewed.
* WebView/WebHTMLView.mm:
(fontNameForDescription):
(-[WebHTMLView _addToStyle:fontA:fontB:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (174688 => 174689)
--- trunk/Source/WebKit/mac/ChangeLog 2014-10-14 17:57:48 UTC (rev 174688)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-10-14 18:05:12 UTC (rev 174689)
@@ -1,3 +1,14 @@
+2014-10-14 Myles C. Maxfield <[email protected]>
+
+ Addressing post-review comment.
+ https://bugs.webkit.org/show_bug.cgi?id=137550
+
+ Unreviewed.
+
+ * WebView/WebHTMLView.mm:
+ (fontNameForDescription):
+ (-[WebHTMLView _addToStyle:fontA:fontB:]):
+
2014-10-14 Chris Dumez <[email protected]>
Use is<>() / downcast<>() for RenderImage
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (174688 => 174689)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2014-10-14 17:57:48 UTC (rev 174688)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2014-10-14 18:05:12 UTC (rev 174689)
@@ -4859,6 +4859,18 @@
return [[NSFontManager sharedFontManager] fontWithFamily:@"Times" traits:NSFontItalicTrait weight:STANDARD_BOLD_WEIGHT size:12.0f];
}
+static NSString *fontNameForDescription(NSString *familyName, BOOL italic, BOOL bold, int pointSize)
+{
+ // Find the font the same way the rendering code would later if it encountered this CSS.
+ FontDescription fontDescription;
+ fontDescription.setItalic(italic);
+ fontDescription.setWeight(bold ? FontWeight900 : FontWeight500);
+ fontDescription.setSpecifiedSize(pointSize);
+ FontCachePurgePreventer purgePreventer;
+ RefPtr<SimpleFontData> simpleFontData = fontCache().getCachedFontData(fontDescription, familyName, false, WebCore::FontCache::DoNotRetain);
+ return [simpleFontData->platformData().font() fontName];
+}
+
- (void)_addToStyle:(DOMCSSStyleDeclaration *)style fontA:(NSFont *)a fontB:(NSFont *)b
{
// Since there's no way to directly ask NSFontManager what style change it's going to do
@@ -4893,18 +4905,9 @@
// The family name may not be specific enough to get us the font specified.
// In some cases, the only way to get exactly what we are looking for is to use
// the Postscript name.
-
- // Find the font the same way the rendering code would later if it encountered this CSS.
- FontDescription fontDescription;
- fontDescription.setItalic(aIsItalic);
- fontDescription.setWeight(aIsBold ? FontWeight900 : FontWeight500);
- fontDescription.setSpecifiedSize(aPointSize);
- FontCachePurgePreventer purgePreventer;
- RefPtr<SimpleFontData> simpleFontData = fontCache().getCachedFontData(fontDescription, aFamilyName, false, WebCore::FontCache::DoNotRetain);
-
// If we don't find a font with the same Postscript name, then we'll have to use the
// Postscript name to make the CSS specific enough.
- if (![[simpleFontData->platformData().font() fontName] isEqualToString:[a fontName]])
+ if (![fontNameForDescription(aFamilyName, aIsItalic, aIsBold, aPointSize) isEqualToString:[a fontName]])
familyNameForCSS = [a fontName];
// FIXME: Need more sophisticated escaping code if we want to handle family names
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes