<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200563] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200563">200563</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2016-05-08 15:54:42 -0700 (Sun, 08 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[OS X] Migrate our Font classes entirely off of NSFont
https://bugs.webkit.org/show_bug.cgi?id=157464
Reviewed by Darin Adler.
Source/WebCore:
Because NSFont and CTFont are toll-free-bridged, we don't need NSFont at all anywhere.
No new tests because there is no behavior change.
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
(textMarkerRangeFromRange):
(visiblePositionForStartOfTextMarkerRange):
(visiblePositionForEndOfTextMarkerRange):
(AXAttributedStringRangeIsValid):
(AXAttributeStringSetFont):
(CreateCGColorIfDifferent):
(AXAttributeStringSetStyle):
(textMarkerRangeFromVisiblePositions):
* bindings/objc/DOM.mm:
(-[DOMElement _font]):
* bindings/objc/DOMPrivate.h:
* editing/cocoa/HTMLConverter.mm:
(_font):
(WebCore::editingAttributedStringFromRange):
* editing/mac/EditorMac.mm:
(WebCore::Editor::fontAttributesForSelectionStart):
* platform/graphics/Font.h:
(WebCore::Font::getCTFont):
(WebCore::Font::getNSFont): Deleted.
* platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformData::nsFont): Deleted.
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::determinePitch):
(WebCore::advanceForColorBitmapFont):
(WebCore::Font::platformWidthForGlyph):
(WebCore::renderingStyle): Deleted.
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
Source/WebKit/mac:
* WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::populate):
(PopupMenuMac::show):
* WebView/WebHTMLView.mm:
(fontNameForDescription):
(-[WebHTMLView _addToStyle:fontA:fontB:]):
Source/WebKit2:
* WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
(WebKit::WebPopupMenu::setUpPlatformData):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::fontAtSelection):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcDOMmm">trunk/Source/WebCore/bindings/objc/DOM.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcDOMPrivateh">trunk/Source/WebCore/bindings/objc/DOMPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreeditingcocoaHTMLConvertermm">trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingmacEditorMacmm">trunk/Source/WebCore/editing/mac/EditorMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFonth">trunk/Source/WebCore/platform/graphics/Font.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontPlatformDatah">trunk/Source/WebCore/platform/graphics/FontPlatformData.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontPlatformDataCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportPopupMenuMacmm">trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebPopupMenuMacmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/ChangeLog        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [OS X] Migrate our Font classes entirely off of NSFont
+ https://bugs.webkit.org/show_bug.cgi?id=157464
+
+ Reviewed by Darin Adler.
+
+ Because NSFont and CTFont are toll-free-bridged, we don't need NSFont at all anywhere.
+
+ No new tests because there is no behavior change.
+
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
+ (textMarkerRangeFromRange):
+ (visiblePositionForStartOfTextMarkerRange):
+ (visiblePositionForEndOfTextMarkerRange):
+ (AXAttributedStringRangeIsValid):
+ (AXAttributeStringSetFont):
+ (CreateCGColorIfDifferent):
+ (AXAttributeStringSetStyle):
+ (textMarkerRangeFromVisiblePositions):
+ * bindings/objc/DOM.mm:
+ (-[DOMElement _font]):
+ * bindings/objc/DOMPrivate.h:
+ * editing/cocoa/HTMLConverter.mm:
+ (_font):
+ (WebCore::editingAttributedStringFromRange):
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::fontAttributesForSelectionStart):
+ * platform/graphics/Font.h:
+ (WebCore::Font::getCTFont):
+ (WebCore::Font::getNSFont): Deleted.
+ * platform/graphics/FontPlatformData.h:
+ (WebCore::FontPlatformData::nsFont): Deleted.
+ * platform/graphics/cocoa/FontCocoa.mm:
+ (WebCore::Font::determinePitch):
+ (WebCore::advanceForColorBitmapFont):
+ (WebCore::Font::platformWidthForGlyph):
+ (WebCore::renderingStyle): Deleted.
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+
</ins><span class="cx"> 2016-05-08 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -724,7 +724,7 @@
</span><span class="cx"> if ([searchTextParameter isKindOfClass:[NSString class]])
</span><span class="cx"> searchText = searchTextParameter;
</span><span class="cx">
</span><del>- AccessibilityObject *startElement = nullptr;
</del><ins>+ AccessibilityObject* startElement = nullptr;
</ins><span class="cx"> if ([startElementParameter isKindOfClass:[WebAccessibilityObjectWrapper class]])
</span><span class="cx"> startElement = [startElementParameter accessibilityObject];
</span><span class="cx">
</span><span class="lines">@@ -831,7 +831,7 @@
</span><span class="cx"> return textMarkerRangeFromRange(m_object->axObjectCache(), range);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static id textMarkerRangeFromRange(AXObjectCache *cache, const RefPtr<Range> range)
</del><ins>+static id textMarkerRangeFromRange(AXObjectCache* cache, const RefPtr<Range> range)
</ins><span class="cx"> {
</span><span class="cx"> id startTextMarker = startOrEndTextmarkerForRange(cache, range, true);
</span><span class="cx"> id endTextMarker = startOrEndTextmarkerForRange(cache, range, false);
</span><span class="lines">@@ -980,12 +980,12 @@
</span><span class="cx"> return visiblePositionForTextMarker(m_object->axObjectCache(), textMarker);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static VisiblePosition visiblePositionForStartOfTextMarkerRange(AXObjectCache *cache, id textMarkerRange)
</del><ins>+static VisiblePosition visiblePositionForStartOfTextMarkerRange(AXObjectCache* cache, id textMarkerRange)
</ins><span class="cx"> {
</span><span class="cx"> return visiblePositionForTextMarker(cache, AXTextMarkerRangeStart(textMarkerRange));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static VisiblePosition visiblePositionForEndOfTextMarkerRange(AXObjectCache *cache, id textMarkerRange)
</del><ins>+static VisiblePosition visiblePositionForEndOfTextMarkerRange(AXObjectCache* cache, id textMarkerRange)
</ins><span class="cx"> {
</span><span class="cx"> return visiblePositionForTextMarker(cache, AXTextMarkerRangeEnd(textMarkerRange));
</span><span class="cx"> }
</span><span class="lines">@@ -1000,23 +1000,23 @@
</span><span class="cx">
</span><span class="cx"> // When modifying attributed strings, the range can come from a source which may provide faulty information (e.g. the spell checker).
</span><span class="cx"> // To protect against such cases the range should be validated before adding or removing attributes.
</span><del>-static BOOL AXAttributedStringRangeIsValid(NSAttributedString* attrString, NSRange range)
</del><ins>+static BOOL AXAttributedStringRangeIsValid(NSAttributedString *attrString, NSRange range)
</ins><span class="cx"> {
</span><span class="cx"> return (range.location < [attrString length] && NSMaxRange(range) <= [attrString length]);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void AXAttributeStringSetFont(NSMutableAttributedString* attrString, NSString* attribute, NSFont* font, NSRange range)
</del><ins>+static void AXAttributeStringSetFont(NSMutableAttributedString *attrString, NSString *attribute, CTFontRef font, NSRange range)
</ins><span class="cx"> {
</span><span class="cx"> if (!AXAttributedStringRangeIsValid(attrString, range))
</span><span class="cx"> return;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (font) {
</span><del>- NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
- [font fontName] , NSAccessibilityFontNameKey,
- [font familyName] , NSAccessibilityFontFamilyKey,
- [font displayName] , NSAccessibilityVisibleNameKey,
- [NSNumber numberWithFloat:[font pointSize]] , NSAccessibilityFontSizeKey,
- nil];
</del><ins>+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
+ static_cast<NSString *>(adoptCF(CTFontCopyPostScriptName(font)).get()), NSAccessibilityFontNameKey,
+ static_cast<NSString *>(adoptCF(CTFontCopyFamilyName(font)).get()), NSAccessibilityFontFamilyKey,
+ static_cast<NSString *>(adoptCF(CTFontCopyDisplayName(font)).get()), NSAccessibilityVisibleNameKey,
+ [NSNumber numberWithFloat:CTFontGetSize(font)], NSAccessibilityFontSizeKey,
+ nil];
</ins><span class="cx">
</span><span class="cx"> [attrString addAttribute:attribute value:dict range:range];
</span><span class="cx"> } else
</span><span class="lines">@@ -1024,10 +1024,10 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static CGColorRef CreateCGColorIfDifferent(NSColor* nsColor, CGColorRef existingColor)
</del><ins>+static CGColorRef CreateCGColorIfDifferent(NSColor *nsColor, CGColorRef existingColor)
</ins><span class="cx"> {
</span><span class="cx"> // get color information assuming NSDeviceRGBColorSpace
</span><del>- NSColor* rgbColor = [nsColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
</del><ins>+ NSColor *rgbColor = [nsColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
</ins><span class="cx"> if (rgbColor == nil)
</span><span class="cx"> rgbColor = [NSColor blackColor];
</span><span class="cx"> CGFloat components[4];
</span><span class="lines">@@ -1079,7 +1079,7 @@
</span><span class="cx"> const RenderStyle& style = renderer->style();
</span><span class="cx">
</span><span class="cx"> // set basic font info
</span><del>- AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFont().getNSFont(), range);
</del><ins>+ AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFont().getCTFont(), range);
</ins><span class="cx">
</span><span class="cx"> // set basic colors
</span><span class="cx"> AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style.visitedDependentColor(CSSPropertyColor)), range);
</span><span class="lines">@@ -1348,7 +1348,7 @@
</span><span class="cx"> return [attrString autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, const VisiblePosition& startPosition, const VisiblePosition& endPosition)
</del><ins>+static id textMarkerRangeFromVisiblePositions(AXObjectCache* cache, const VisiblePosition& startPosition, const VisiblePosition& endPosition)
</ins><span class="cx"> {
</span><span class="cx"> id startTextMarker = textMarkerForVisiblePosition(cache, startPosition);
</span><span class="cx"> id endTextMarker = textMarkerForVisiblePosition(cache, endPosition);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcDOMmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/DOM.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/DOM.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/bindings/objc/DOM.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -721,24 +721,13 @@
</span><span class="cx">
</span><span class="cx"> @implementation DOMElement (WebPrivate)
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
-- (NSFont *)_font
-{
- // FIXME: Could we move this function to WebCore::Element and autogenerate?
- auto renderer = core(self)->renderer();
- if (!renderer)
- return nil;
- return renderer->style().fontCascade().primaryFont().getNSFont();
-}
-#else
</del><span class="cx"> - (CTFontRef)_font
</span><span class="cx"> {
</span><del>- RenderObject* renderer = core(self)->renderer();
</del><ins>+ auto* renderer = core(self)->renderer();
</ins><span class="cx"> if (!renderer)
</span><span class="cx"> return nil;
</span><span class="cx"> return renderer->style().fontCascade().primaryFont().getCTFont();
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> - (NSData *)_imageTIFFRepresentation
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcDOMPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/DOMPrivate.h (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/DOMPrivate.h        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/bindings/objc/DOMPrivate.h        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -74,11 +74,9 @@
</span><span class="cx">
</span><span class="cx"> @interface DOMElement (WebPrivate)
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span><del>-- (NSFont *)_font;
</del><span class="cx"> - (NSData *)_imageTIFFRepresentation;
</span><del>-#else
-- (CTFontRef)_font;
</del><span class="cx"> #endif
</span><ins>+- (CTFontRef)_font;
</ins><span class="cx"> - (NSURL *)_getURLAttribute:(NSString *)name;
</span><span class="cx"> - (BOOL)isFocused;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingcocoaHTMLConvertermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -1034,23 +1034,13 @@
</span><span class="cx"> return platformResult;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx"> static PlatformFont *_font(Element& element)
</span><span class="cx"> {
</span><del>- auto renderer = element.renderer();
</del><ins>+ auto* renderer = element.renderer();
</ins><span class="cx"> if (!renderer)
</span><span class="cx"> return nil;
</span><del>- return renderer->style().fontCascade().primaryFont().getNSFont();
</del><ins>+ return toNSFont(renderer->style().fontCascade().primaryFont().getCTFont());
</ins><span class="cx"> }
</span><del>-#else
-static PlatformFont *_font(Element& element)
-{
- auto renderer = element.renderer();
- if (!renderer)
- return nil;
- return (PlatformFont *)renderer->style().fontCascade().primaryFont().getCTFont();
-}
-#endif
</del><span class="cx">
</span><span class="cx"> #define UIFloatIsZero(number) (fabs(number - 0) < FLT_EPSILON)
</span><span class="cx">
</span><span class="lines">@@ -2535,8 +2525,8 @@
</span><span class="cx"> [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
</span><span class="cx"> if (style.textDecorationsInEffect() & TextDecorationLineThrough)
</span><span class="cx"> [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
</span><del>- if (NSFont *font = style.fontCascade().primaryFont().getNSFont())
- [attrs.get() setObject:font forKey:NSFontAttributeName];
</del><ins>+ if (auto font = style.fontCascade().primaryFont().getCTFont())
+ [attrs.get() setObject:toNSFont(font) forKey:NSFontAttributeName];
</ins><span class="cx"> else
</span><span class="cx"> [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFont().platformData().size()] forKey:NSFontAttributeName];
</span><span class="cx"> if (style.visitedDependentColor(CSSPropertyColor).alpha())
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/mac/EditorMac.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -155,8 +155,8 @@
</span><span class="cx"> if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0)
</span><span class="cx"> [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
</span><span class="cx">
</span><del>- if (style->fontCascade().primaryFont().getNSFont())
- [result setObject:style->fontCascade().primaryFont().getNSFont() forKey:NSFontAttributeName];
</del><ins>+ if (auto ctFont = style->fontCascade().primaryFont().getCTFont())
+ [result setObject:toNSFont(ctFont) forKey:NSFontAttributeName];
</ins><span class="cx">
</span><span class="cx"> if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
</span><span class="cx"> [result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFonth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Font.h (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Font.h        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/platform/graphics/Font.h        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -172,15 +172,11 @@
</span><span class="cx"> String description() const;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if USE(APPKIT)
- NSFont* getNSFont() const { return m_platformData.nsFont(); }
-#endif
-
</del><span class="cx"> #if PLATFORM(IOS)
</span><del>- CTFontRef getCTFont() const { return m_platformData.font(); }
</del><span class="cx"> bool shouldNotBeUsedForArabic() const { return m_shouldNotBeUsedForArabic; };
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ CTFontRef getCTFont() const { return m_platformData.font(); }
</ins><span class="cx"> CFDictionaryRef getCFStringAttributes(bool enableKerning, FontOrientation) const;
</span><span class="cx"> const BitVector& glyphsSupportedBySmallCaps() const;
</span><span class="cx"> const BitVector& glyphsSupportedByAllSmallCaps() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontPlatformDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -130,12 +130,7 @@
</span><span class="cx"> RetainPtr<CFTypeRef> objectForEqualityCheck() const;
</span><span class="cx">
</span><span class="cx"> bool hasCustomTracking() const { return isSystemFont(); }
</span><del>-
-#if USE(APPKIT)
- // FIXME: Remove this when all NSFont usage is removed.
- NSFont *nsFont() const { return (NSFont *)m_font.get(); }
</del><span class="cx"> #endif
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> #if PLATFORM(WIN) || PLATFORM(COCOA)
</span><span class="cx"> bool isSystemFont() const { return m_isSystemFont; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -525,10 +525,16 @@
</span><span class="cx"> return createDerivativeFont(scaledFont.get(), size, m_platformData.orientation(), fontTraits, m_platformData.syntheticBold(), m_platformData.syntheticOblique());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline bool caseInsensitiveCompare(CFStringRef a, CFStringRef b)
+{
+ return a && CFStringCompare(a, b, kCFCompareCaseInsensitive) == kCFCompareEqualTo;
+}
+
</ins><span class="cx"> void Font::determinePitch()
</span><span class="cx"> {
</span><del>-#if USE(APPKIT)
- NSFont* f = m_platformData.nsFont();
</del><ins>+ CTFontRef ctFont = m_platformData.font();
+ ASSERT(ctFont);
+
</ins><span class="cx"> // Special case Osaka-Mono.
</span><span class="cx"> // According to <rdar://problem/3999467>, we should treat Osaka-Mono as fixed pitch.
</span><span class="cx"> // Note that the AppKit does not report Osaka-Mono as fixed pitch.
</span><span class="lines">@@ -541,18 +547,11 @@
</span><span class="cx"> // According to <rdar://problem/5454704>, we should not treat MonotypeCorsiva as fixed pitch.
</span><span class="cx"> // Note that AppKit does report MonotypeCorsiva as fixed pitch.
</span><span class="cx">
</span><del>- NSString *name = [f fontName];
- m_treatAsFixedPitch = ([f isFixedPitch] || [f _isFakeFixedPitch] || [name caseInsensitiveCompare:@"Osaka-Mono"] == NSOrderedSame) && [name caseInsensitiveCompare:@"MS-PGothic"] != NSOrderedSame && [name caseInsensitiveCompare:@"MonotypeCorsiva"] != NSOrderedSame;
-#else
- CTFontRef ctFont = m_platformData.font();
- m_treatAsFixedPitch = false;
- if (!ctFont)
- return; // CTFont is null in the case of SVG fonts for example.
-
</del><span class="cx"> RetainPtr<CFStringRef> fullName = adoptCF(CTFontCopyFullName(ctFont));
</span><span class="cx"> RetainPtr<CFStringRef> familyName = adoptCF(CTFontCopyFamilyName(ctFont));
</span><span class="cx">
</span><del>- m_treatAsFixedPitch = CGFontIsFixedPitch(m_platformData.cgFont()) || (fullName && (CFStringCompare(fullName.get(), CFSTR("Osaka-Mono"), kCFCompareCaseInsensitive) == kCFCompareEqualTo || CFStringCompare(fullName.get(), CFSTR("MS-PGothic"), kCFCompareCaseInsensitive) == kCFCompareEqualTo));
</del><ins>+ m_treatAsFixedPitch = (CTFontGetSymbolicTraits(ctFont) & kCTFontMonoSpaceTrait) || CGFontIsFixedPitch(m_platformData.cgFont()) || (caseInsensitiveCompare(fullName.get(), CFSTR("Osaka-Mono")) || caseInsensitiveCompare(fullName.get(), CFSTR("MS-PGothic")) || caseInsensitiveCompare(fullName.get(), CFSTR("MonotypeCorsiva")));
+#if PLATFORM(IOS)
</ins><span class="cx"> if (familyName && CFStringCompare(familyName.get(), CFSTR("Courier New"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
</span><span class="cx"> // Special case Courier New to not be treated as fixed pitch, as this will make use of a hacked space width which is undesireable for iPhone (see rdar://6269783).
</span><span class="cx"> m_treatAsFixedPitch = false;
</span><span class="lines">@@ -571,43 +570,14 @@
</span><span class="cx"> return boundingBox;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline CGFontRenderingStyle renderingStyle(const FontPlatformData& platformData)
-{
-#if USE(APPKIT)
- CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization;
- NSFont *font = platformData.nsFont();
- if (font) {
- switch ([font renderingMode]) {
- case NSFontIntegerAdvancementsRenderingMode:
- style = 0;
- break;
- case NSFontAntialiasedIntegerAdvancementsRenderingMode:
- style = kCGFontRenderingStyleAntialiasing;
- break;
- default:
- break;
- }
- }
- return style;
-
-#else
- UNUSED_PARAM(platformData);
- return kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
-#endif
-}
-
</del><span class="cx"> static inline Optional<CGSize> advanceForColorBitmapFont(const FontPlatformData& platformData, Glyph glyph)
</span><span class="cx"> {
</span><del>-#if PLATFORM(MAC)
- NSFont *font = platformData.nsFont();
</del><ins>+ CTFontRef font = platformData.font();
</ins><span class="cx"> if (!font || !platformData.isColorBitmapFont())
</span><span class="cx"> return Nullopt;
</span><del>- return NSSizeToCGSize([font advancementForGlyph:glyph]);
-#else
- UNUSED_PARAM(platformData);
- UNUSED_PARAM(glyph);
- return Nullopt;
-#endif
</del><ins>+ CGSize advance;
+ CTFontGetAdvancesForGlyphs(font, kCTFontOrientationDefault, &glyph, &advance, 1);
+ return advance;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline bool canUseFastGlyphAdvanceGetter(const FontPlatformData& platformData, Glyph glyph, CGSize& advance, bool& populatedAdvance)
</span><span class="lines">@@ -630,7 +600,8 @@
</span><span class="cx"> if ((horizontal || m_isBrokenIdeographFallback) && canUseFastGlyphAdvanceGetter(this->platformData(), glyph, advance, populatedAdvance)) {
</span><span class="cx"> float pointSize = platformData().size();
</span><span class="cx"> CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize);
</span><del>- if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, renderingStyle(platformData()), &glyph, 1, &advance)) {
</del><ins>+ CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
+ if (!CGFontGetGlyphAdvancesForStyle(platformData().cgFont(), &m, style, &glyph, 1, &advance)) {
</ins><span class="cx"> RetainPtr<CFStringRef> fullName = adoptCF(CGFontCopyFullName(platformData().cgFont()));
</span><span class="cx"> LOG_ERROR("Unable to cache glyph widths for %@ %f", fullName.get(), pointSize);
</span><span class="cx"> advance.width = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontPlatformDataCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -29,9 +29,7 @@
</span><span class="cx"> #import "WebCoreSystemInterface.h"
</span><span class="cx"> #import <wtf/text/WTFString.h>
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
-#import <AppKit/NSFont.h>
-#else
</del><ins>+#if PLATFORM(IOS)
</ins><span class="cx"> #import "CoreGraphicsSPI.h"
</span><span class="cx"> #import <CoreText/CoreText.h>
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [OS X] Migrate our Font classes entirely off of NSFont
+ https://bugs.webkit.org/show_bug.cgi?id=157464
+
+ Reviewed by Darin Adler.
+
+ * WebCoreSupport/PopupMenuMac.mm:
+ (PopupMenuMac::populate):
+ (PopupMenuMac::show):
+ * WebView/WebHTMLView.mm:
+ (fontNameForDescription):
+ (-[WebHTMLView _addToStyle:fontA:fontB:]):
+
</ins><span class="cx"> 2016-05-06 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename HitTestRequest DisallowShadowContent to DisallowUserAgentShadowContent
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportPopupMenuMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -81,12 +81,12 @@
</span><span class="cx"> PopupMenuStyle style = m_client->itemStyle(i);
</span><span class="cx"> RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] init]);
</span><span class="cx"> if (style.font() != FontCascade()) {
</span><del>- NSFont *font = style.font().primaryFont().getNSFont();
</del><ins>+ RetainPtr<CTFontRef> font = style.font().primaryFont().getCTFont();
</ins><span class="cx"> if (!font) {
</span><span class="cx"> CGFloat size = style.font().primaryFont().platformData().size();
</span><del>- font = style.font().weight() < FontWeightBold ? [NSFont systemFontOfSize:size] : [NSFont boldSystemFontOfSize:size];
</del><ins>+ font = adoptCF(CTFontCreateUIFontForLanguage(style.font().weight() < FontWeightBold ? kCTFontUIFontSystem : kCTFontUIFontEmphasizedSystem, size, nullptr));
</ins><span class="cx"> }
</span><del>- [attributes setObject:font forKey:NSFontAttributeName];
</del><ins>+ [attributes setObject:toNSFont(font.get()) forKey:NSFontAttributeName];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RetainPtr<NSMutableParagraphStyle> paragraphStyle = adoptNS([[NSParagraphStyle defaultParagraphStyle] mutableCopy]);
</span><span class="lines">@@ -154,13 +154,13 @@
</span><span class="cx"> [m_popup selectItemAtIndex:index];
</span><span class="cx"> [m_popup setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
</span><span class="cx">
</span><del>- NSMenu* menu = [m_popup menu];
</del><ins>+ NSMenu *menu = [m_popup menu];
</ins><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
</span><span class="cx"> [menu setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> NSPoint location;
</span><del>- NSFont* font = m_client->menuStyle().font().primaryFont().getNSFont();
</del><ins>+ CTFontRef font = m_client->menuStyle().font().primaryFont().getCTFont();
</ins><span class="cx">
</span><span class="cx"> // These values were borrowed from AppKit to match their placement of the menu.
</span><span class="cx"> const int popOverHorizontalAdjust = -10;
</span><span class="lines">@@ -172,8 +172,8 @@
</span><span class="cx"> titleFrame = r;
</span><span class="cx"> float vertOffset = roundf((NSMaxY(r) - NSMaxY(titleFrame)) + NSHeight(titleFrame));
</span><span class="cx"> // Adjust for fonts other than the system font.
</span><del>- NSFont* defaultFont = [NSFont systemFontOfSize:[font pointSize]];
- vertOffset += [font descender] - [defaultFont descender];
</del><ins>+ auto defaultFont = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, CTFontGetSize(font), nil));
+ vertOffset += CTFontGetDescent(font) - CTFontGetDescent(defaultFont.get());
</ins><span class="cx"> vertOffset = fminf(NSHeight(r), vertOffset);
</span><span class="cx">
</span><span class="cx"> float horizontalOffset = textDirection == LTR ? popOverHorizontalAdjust : 0;
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> }
</span><span class="cx">
</span><del>- WKPopupMenu(menu, location, roundf(NSWidth(r)), dummyView.get(), index, font, controlSize, !m_client->menuStyle().hasDefaultAppearance());
</del><ins>+ WKPopupMenu(menu, location, roundf(NSWidth(r)), dummyView.get(), index, toNSFont(font), controlSize, !m_client->menuStyle().hasDefaultAppearance());
</ins><span class="cx">
</span><span class="cx"> [m_popup dismissPopUp];
</span><span class="cx"> [dummyView removeFromSuperview];
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -5599,14 +5599,14 @@
</span><span class="cx"> return [[NSFontManager sharedFontManager] fontWithFamily:@"Times" traits:NSFontItalicTrait weight:STANDARD_BOLD_WEIGHT size:12.0f];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static NSString *fontNameForDescription(NSString *familyName, BOOL italic, BOOL bold)
</del><ins>+static RetainPtr<CFStringRef> fontNameForDescription(NSString *familyName, BOOL italic, BOOL bold)
</ins><span class="cx"> {
</span><span class="cx"> // Find the font the same way the rendering code would later if it encountered this CSS.
</span><span class="cx"> FontDescription fontDescription;
</span><span class="cx"> fontDescription.setIsItalic(italic);
</span><span class="cx"> fontDescription.setWeight(bold ? FontWeight900 : FontWeight500);
</span><span class="cx"> RefPtr<Font> font = FontCache::singleton().fontForFamily(fontDescription, familyName);
</span><del>- return [font->platformData().nsFont() fontName];
</del><ins>+ return adoptCF(CTFontCopyPostScriptName(font->getCTFont()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_addToStyle:(DOMCSSStyleDeclaration *)style fontA:(NSFont *)a fontB:(NSFont *)b
</span><span class="lines">@@ -5645,8 +5645,10 @@
</span><span class="cx"> // the Postscript name.
</span><span class="cx"> // If we don't find a font with the same Postscript name, then we'll have to use the
</span><span class="cx"> // Postscript name to make the CSS specific enough.
</span><del>- if (![fontNameForDescription(aFamilyName, aIsItalic, aIsBold) isEqualToString:[a fontName]])
- familyNameForCSS = [a fontName];
</del><ins>+ auto fontName = fontNameForDescription(aFamilyName, aIsItalic, aIsBold);
+ auto aName = [a fontName];
+ if (!fontName || !aName || !CFEqual(fontName.get(), static_cast<CFStringRef>(aName)))
+ familyNameForCSS = aName;
</ins><span class="cx">
</span><span class="cx"> // FIXME: Need more sophisticated escaping code if we want to handle family names
</span><span class="cx"> // with characters like single quote or backslash in their names.
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [OS X] Migrate our Font classes entirely off of NSFont
+ https://bugs.webkit.org/show_bug.cgi?id=157464
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
+ (WebKit::WebPopupMenu::setUpPlatformData):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::fontAtSelection):
+
</ins><span class="cx"> 2016-05-06 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename HitTestRequest DisallowShadowContent to DisallowUserAgentShadowContent
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebPopupMenuMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -39,15 +39,19 @@
</span><span class="cx"> {
</span><span class="cx"> #if USE(APPKIT)
</span><span class="cx"> // FIXME: font will be nil here for custom fonts, we should fix that.
</span><del>- NSFont *font = m_popupClient->menuStyle().font().primaryFont().getNSFont();
</del><ins>+ CTFontRef font = m_popupClient->menuStyle().font().primaryFont().getCTFont();
</ins><span class="cx"> if (!font)
</span><span class="cx"> return;
</span><del>-
- CFDictionaryRef fontDescriptorAttributes = (CFDictionaryRef)[[font fontDescriptor] fontAttributes];
- if (!fontDescriptorAttributes)
</del><ins>+
+ auto fontDescriptor = adoptCF(CTFontCopyFontDescriptor(font));
+ if (!fontDescriptor)
</ins><span class="cx"> return;
</span><ins>+
+ auto attributes = adoptCF(CTFontDescriptorCopyAttributes(fontDescriptor.get()));
+ if (!attributes)
+ return;
</ins><span class="cx">
</span><del>- data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
</del><ins>+ data.fontInfo.fontAttributeDictionary = attributes.get();
</ins><span class="cx"> data.shouldPopOver = m_popupClient->shouldPopOver();
</span><span class="cx"> data.hideArrows = !m_popupClient->menuStyle().hasDefaultAppearance();
</span><span class="cx"> data.menuSize = m_popupClient->menuStyle().menuSize();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (200562 => 200563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2016-05-08 21:56:57 UTC (rev 200562)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2016-05-08 22:54:42 UTC (rev 200563)
</span><span class="lines">@@ -363,11 +363,11 @@
</span><span class="cx"> Frame& frame = m_page->focusController().focusedOrMainFrame();
</span><span class="cx">
</span><span class="cx"> if (!frame.selection().selection().isNone()) {
</span><del>- const Font* font = frame.editor().fontForSelection(selectionHasMultipleFonts);
- NSFont *nsFont = font ? font->getNSFont() : nil;
- if (nsFont) {
- fontName = nsFont.fontName;
- fontSize = nsFont.pointSize;
</del><ins>+ if (auto* font = frame.editor().fontForSelection(selectionHasMultipleFonts)) {
+ if (auto ctFont = font->getCTFont()) {
+ fontName = adoptCF(CTFontCopyPostScriptName(ctFont)).get();
+ fontSize = CTFontGetSize(ctFont);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> send(Messages::WebPageProxy::FontAtSelectionCallback(fontName, fontSize, selectionHasMultipleFonts, callbackID));
</span></span></pre>
</div>
</div>
</body>
</html>