<!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>[184495] branches/safari-601.1.32.2-branch</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/184495">184495</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-05-18 10:01:03 -0700 (Mon, 18 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/184353">r184353</a>. rdar://problem/20809399</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011322branchLayoutTestsChangeLog">branches/safari-601.1.32.2-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6011322branchLayoutTestsplatformmacfastcsscss2systemfontsexpectedtxt">branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/css/css2-system-fonts-expected.txt</a></li>
<li><a href="#branchessafari6011322branchLayoutTestsplatformmacfastformsselectoptgrouprenderingexpectedtxt">branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt</a></li>
<li><a href="#branchessafari6011322branchLayoutTestsplatformmacfastformsvalidationmessageappearanceexpectedtxt">branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/validation-message-appearance-expected.txt</a></li>
<li><a href="#branchessafari6011322branchSourceWebCoreChangeLog">branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011322branchSourceWebCorecssCSSParsercpp">branches/safari-601.1.32.2-branch/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#branchessafari6011322branchSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm">branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm</a></li>
<li><a href="#branchessafari6011322branchSourceWebCoreplatformgraphicsmacFontCacheMacmm">branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#branchessafari6011322branchSourceWebCoreplatformmacThemeMacmm">branches/safari-601.1.32.2-branch/Source/WebCore/platform/mac/ThemeMac.mm</a></li>
<li><a href="#branchessafari6011322branchSourceWebCorerenderingRenderThemeMacmm">branches/safari-601.1.32.2-branch/Source/WebCore/rendering/RenderThemeMac.mm</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#branchessafari6011322branchLayoutTestsplatformmacmavericksfastcsscss2systemfontsexpectedtxt">branches/safari-601.1.32.2-branch/LayoutTests/platform/mac-mavericks/fast/css/css2-system-fonts-expected.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011322branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/LayoutTests/ChangeLog (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/LayoutTests/ChangeLog        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/LayoutTests/ChangeLog        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-05-18 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r184353. rdar://problem/20809399
+
+ 2015-05-14 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [Mac] Expose more font weights for -apple-system
+ https://bugs.webkit.org/show_bug.cgi?id=144707
+
+ Reviewed by Simon Fraser.
+
+ * platform/mac/fast/text/systemFont-expected.txt: Update expectations.
+ * platform/mac/fast/text/systemFont.html: Update test to include font weights for -apple-system.
+ * platform/mac/fast/css/css2-system-fonts-expected.txt: Updated to not hardcode the system font family name.
+ * platform/mac-mavericks/fast/css/css2-system-fonts-expected.txt: Ditto.
+ * platform/mac/fast/forms/select/optgroup-rendering-expected.txt: Updated to not use synthetic bold.
+ * platform/mac/fast/forms/validation-message-appearance-expected.txt: Ditto.
+
</ins><span class="cx"> 2015-05-12 Dana Burkart <dburkart@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r184116. rdar://problem/20774613
</span></span></pre></div>
<a id="branchessafari6011322branchLayoutTestsplatformmacfastcsscss2systemfontsexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/css/css2-system-fonts-expected.txt (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/css/css2-system-fonts-expected.txt        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/css/css2-system-fonts-expected.txt        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -1,10 +1,10 @@
</span><span class="cx"> This tests platform specific system font styles. If any of the styles appear in monospace the test fails.
</span><del>-caption: normal normal normal 13px/16px '.HelveticaNeueDeskInterface-Regular'
-icon: normal normal normal 13px/16px '.HelveticaNeueDeskInterface-Regular'
-menu: normal normal normal 13px/16px '.HelveticaNeueDeskInterface-Regular'
-message-box: normal normal normal 13px/16px '.HelveticaNeueDeskInterface-Regular'
-small-caption: normal normal normal 11px/13px '.HelveticaNeueDeskInterface-Regular'
-status-bar: normal normal normal 10px/12px '.HelveticaNeueDeskInterface-Regular'
--webkit-mini-control: normal normal normal 9px/11px '.HelveticaNeueDeskInterface-Regular'
--webkit-small-control: normal normal normal 11px/13px '.HelveticaNeueDeskInterface-Regular'
--webkit-control: normal normal normal 13px/16px '.HelveticaNeueDeskInterface-Regular'
</del><ins>+caption: normal normal normal 13px/16px -apple-system
+icon: normal normal normal 13px/16px -apple-system
+menu: normal normal normal 13px/16px -apple-menu
+message-box: normal normal normal 13px/16px -apple-system
+small-caption: normal normal normal 11px/13px -apple-system
+status-bar: normal normal normal 10px/12px -apple-status-bar
+-webkit-mini-control: normal normal normal 9px/11px -apple-system
+-webkit-small-control: normal normal normal 11px/13px -apple-system
+-webkit-control: normal normal normal 13px/16px -apple-system
</ins></span></pre></div>
<a id="branchessafari6011322branchLayoutTestsplatformmacfastformsselectoptgrouprenderingexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> RenderBlock {HTML} at (0,0) size 800x323
</span><span class="cx"> RenderBody {BODY} at (8,8) size 784x307
</span><span class="cx"> RenderBlock {FORM} at (0,0) size 784x307
</span><del>- RenderListBox {SELECT} at (2,2) size 67x281 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
- RenderText {#text} at (71,264) size 4x18
- text run at (71,264) width 4: " "
- RenderBR {BR} at (75,264) size 0x18
</del><ins>+ RenderListBox {SELECT} at (2,2) size 69x281 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
+ RenderText {#text} at (73,264) size 4x18
+ text run at (73,264) width 4: " "
+ RenderBR {BR} at (77,264) size 0x18
</ins><span class="cx"> RenderMenuList {SELECT} at (2,287) size 75x18 [bgcolor=#FFFFFF]
</span><span class="cx"> RenderBlock (anonymous) at (0,0) size 75x18
</span><span class="cx"> RenderText at (8,2) size 30x13
</span></span></pre></div>
<a id="branchessafari6011322branchLayoutTestsplatformmacfastformsvalidationmessageappearanceexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/validation-message-appearance-expected.txt (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/validation-message-appearance-expected.txt        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/LayoutTests/platform/mac/fast/forms/validation-message-appearance-expected.txt        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -25,8 +25,8 @@
</span><span class="cx"> RenderBlock {DIV} at (10,10) size 0x64
</span><span class="cx"> RenderBlock {DIV} at (10,10) size 200x64
</span><span class="cx"> RenderBlock {DIV} at (0,0) size 200x16
</span><del>- RenderText {#text} at (0,0) size 86x16
- text run at (0,0) width 86: "value missing"
</del><ins>+ RenderText {#text} at (0,0) size 90x16
+ text run at (0,0) width 90: "value missing"
</ins><span class="cx"> RenderBlock {DIV} at (0,16) size 200x48
</span><span class="cx"> RenderText {#text} at (0,0) size 147x16
</span><span class="cx"> text run at (0,0) width 147: "Needs at least 8 letters."
</span></span></pre></div>
<a id="branchessafari6011322branchLayoutTestsplatformmacmavericksfastcsscss2systemfontsexpectedtxt"></a>
<div class="delfile"><h4>Deleted: branches/safari-601.1.32.2-branch/LayoutTests/platform/mac-mavericks/fast/css/css2-system-fonts-expected.txt (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/LayoutTests/platform/mac-mavericks/fast/css/css2-system-fonts-expected.txt        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/LayoutTests/platform/mac-mavericks/fast/css/css2-system-fonts-expected.txt        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -1,10 +0,0 @@
</span><del>-This tests platform specific system font styles. If any of the styles appear in monospace the test fails.
-caption: normal normal normal 13px/16px '.LucidaGrandeUI'
-icon: normal normal normal 13px/16px '.LucidaGrandeUI'
-menu: normal normal normal 13px/16px '.LucidaGrandeUI'
-message-box: normal normal normal 13px/16px '.LucidaGrandeUI'
-small-caption: normal normal normal 11px/13px '.LucidaGrandeUI'
-status-bar: normal normal normal 10px/12px '.LucidaGrandeUI'
--webkit-mini-control: normal normal normal 9px/11px '.LucidaGrandeUI'
--webkit-small-control: normal normal normal 11px/13px '.LucidaGrandeUI'
--webkit-control: normal normal normal 13px/16px '.LucidaGrandeUI'
</del></span></pre></div>
<a id="branchessafari6011322branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/ChangeLog        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2015-05-18 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r184353. rdar://problem/20809399
+
+ 2015-05-14 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [Mac] Expose more font weights for -apple-system
+ https://bugs.webkit.org/show_bug.cgi?id=144707
+
+ Reviewed by Simon Fraser.
+
+ Previously, when we parsed a CSS declaration of the form font: keyword; where keyword
+ is one of caption, icon, menu, message-box, small-caption, -webkit-mini-control, -webkit-small-control,
+ or -webkit-control (which html.css does for form controls), we would ask the system what the appropriate
+ system font is, get that font's family name, and synthesize a font-family CSS property for the element.
+ Then, later when we actually go to look up the font, we would look up the font by family name using this
+ information. However, this round-tripping of a font through a family name is actually lossy, and is not
+ guaranteed to preserve system-font-ness (which we use for various things including metrics calculations).
+
+ This patch modifies this logic to specify a token family name instead, which the font lookup code special
+ cases (and reacts by making the appropriate system-font lookup call). This approach is currently how iOS
+ handles these system fonts; this patch simply brings this approach to OS X.
+
+ There is also an added progression here. We used to simply call [NSFont fontWithName:size:] on the system
+ font family name (which the parser found for us) which entirely disregards weight. This means that we
+ used to be getting synthesized bold in form controls which ask for a heavy weight. Migrating to this
+ system-font aware call means that we get the real bold font instead of synthesized bold.
+
+ Once this system-font-ness is guaranteed to be preserved between parsing time and font lookup time, we
+ can safely migrate to using [NSFont systemFontOfSize:weight] instead of [NSFont systemFontOfSize:] on
+ platforms which support it.
+
+ Tests: fast/text/systemFont.html
+ fast/css/css2-system-fonts.html
+ fast/forms/select/optgroup-rendering.html
+ fast/forms/validation-message-appearance.html
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseSystemFont): Add a comment regarding why we are bothering with expanding out
+ the font property in the first place.
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::FontCascade::primaryFontIsSystemFont): Update to use new system font tokens.
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::toNSFontWeight): New static method to map font weights to NSFontWeight constants available on
+ Yosemite and later.
+ (WebCore::fontWithFamilySpecialCase): Pull all these special-case font token name handling into a
+ separate function, which returns an Optional.
+ (WebCore::fontWithFamily):
+ * platform/mac/ThemeMac.mm:
+ (WebCore::ThemeMac::controlFont): Use the font token name instead of the generated system font family
+ name.
+ * platform/spi/mac/NSFontSPI.h: Add [NSFont systemFontWithSize:weight:] and the proper NSFontWeight
+ constants.
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::updateCachedSystemFontDescription): Use the font token names instead of the
+ generated system font family name.
+ (WebCore::RenderThemeMac::setFontFromControlSize): Ditto.
+
</ins><span class="cx"> 2015-05-13 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r183976.
</span></span></pre></div>
<a id="branchessafari6011322branchSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/Source/WebCore/css/CSSParser.cpp (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/Source/WebCore/css/CSSParser.cpp        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/css/CSSParser.cpp        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -6617,6 +6617,7 @@
</span><span class="cx"> if (!fontDescription.isAbsoluteSize())
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ // We must set font's constituent properties, even for system fonts, so the cascade functions correctly.
</ins><span class="cx"> ShorthandScope scope(this, CSSPropertyFont);
</span><span class="cx"> addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(fontDescription.italic() == FontItalicOn ? CSSValueItalic : CSSValueNormal), important);
</span><span class="cx"> addProperty(CSSPropertyFontWeight, cssValuePool().createValue(fontDescription.weight()), important);
</span></span></pre></div>
<a id="branchessafari6011322branchSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -687,9 +687,12 @@
</span><span class="cx"> const auto& fontData = primaryFont();
</span><span class="cx"> return !fontData.isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
</span><span class="cx"> #else
</span><del>- // System fonts are hidden by having a name that begins with a period, so simply search
- // for that here rather than try to keep the list up to date.
- return firstFamily().startsWith('.');
</del><ins>+ const String& firstFamily = this->firstFamily();
+ return equalIgnoringASCIICase(firstFamily, "-webkit-system-font")
+ || equalIgnoringASCIICase(firstFamily, "-apple-system-font")
+ || equalIgnoringASCIICase(firstFamily, "-apple-system")
+ || equalIgnoringASCIICase(firstFamily, "-apple-menu")
+ || equalIgnoringASCIICase(firstFamily, "-apple-status-bar");
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6011322branchSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #import <AppKit/AppKit.h>
</span><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><ins>+#import <wtf/Optional.h>
</ins><span class="cx"> #import <wtf/StdLibExtras.h>
</span><span class="cx"> #import <wtf/Threading.h>
</span><span class="cx"> #import <wtf/text/AtomicStringHash.h>
</span><span class="lines">@@ -207,7 +208,7 @@
</span><span class="cx"> static CGFloat toNSFontWeight(FontWeight fontWeight)
</span><span class="cx"> {
</span><span class="cx"> static CGFloat nsFontWeights[] = {
</span><del>- NSFontWeightUltraLight, // Values between ultra-light and thin are swapped.
</del><ins>+ NSFontWeightUltraLight,
</ins><span class="cx"> NSFontWeightThin,
</span><span class="cx"> NSFontWeightLight,
</span><span class="cx"> NSFontWeightRegular,
</span><span class="lines">@@ -217,17 +218,16 @@
</span><span class="cx"> NSFontWeightHeavy,
</span><span class="cx"> NSFontWeightBlack
</span><span class="cx"> };
</span><ins>+ ASSERT(fontWeight >= 0 && fontWeight <= 8);
</ins><span class="cx"> return nsFontWeights[fontWeight];
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-// Family name is somewhat of a misnomer here. We first attempt to find an exact match
-// comparing the desiredFamily to the PostScript name of the installed fonts. If that fails
-// we then do a search based on the family names of the installed fonts.
-static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desiredTraits, FontWeight weight, float size)
</del><ins>+static Optional<NSFont*> fontWithFamilySpecialCase(const AtomicString& family, FontWeight weight, float size)
</ins><span class="cx"> {
</span><del>- if (equalIgnoringASCIICase(family.string(), String(@"-webkit-system-font")) || equalIgnoringASCIICase(family.string(), String(@"-apple-system")) || equalIgnoringASCIICase(family.string(), String(@"-apple-system-font"))) {
- // We ignore italic for system font.
</del><ins>+ if (equalIgnoringASCIICase(family.string(), "-webkit-system-font")
+ || equalIgnoringASCIICase(family.string(), "-apple-system")
+ || equalIgnoringASCIICase(family.string(), "-apple-system-font")) {
</ins><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
</span><span class="cx"> return [NSFont systemFontOfSize:size weight:toNSFontWeight(weight)];
</span><span class="cx"> #else
</span><span class="lines">@@ -235,7 +235,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (equalIgnoringASCIICase(family.string(), String(@"-apple-system-monospaced-numbers"))) {
</del><ins>+ if (equalIgnoringASCIICase(family.string(), "-apple-system-monospaced-numbers")) {
</ins><span class="cx"> NSArray *featureArray = @[ @{ NSFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
</span><span class="cx"> NSFontFeatureSelectorIdentifierKey : @(kMonospacedNumbersSelector) } ];
</span><span class="cx">
</span><span class="lines">@@ -244,6 +244,23 @@
</span><span class="cx"> return [NSFont fontWithDescriptor:desc size:size];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (equalIgnoringASCIICase(family.string(), "-apple-menu"))
+ return [NSFont menuFontOfSize:size];
+
+ if (equalIgnoringASCIICase(family.string(), "-apple-status-bar"))
+ return [NSFont labelFontOfSize:size];
+
+ return Optional<NSFont*>(Nullopt);
+}
+
+// Family name is somewhat of a misnomer here. We first attempt to find an exact match
+// comparing the desiredFamily to the PostScript name of the installed fonts. If that fails
+// we then do a search based on the family names of the installed fonts.
+static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desiredTraits, FontWeight weight, float size)
+{
+ if (const auto& specialCase = fontWithFamilySpecialCase(family, weight, size))
+ return specialCase.value();
+
</ins><span class="cx"> NSFontManager *fontManager = [NSFontManager sharedFontManager];
</span><span class="cx"> NSString *desiredFamily = family;
</span><span class="cx"> NSString *availableFamily;
</span><span class="lines">@@ -252,8 +269,6 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PLATFORM_FONT_LOOKUP)
</span><span class="cx">
</span><del>- if (family.length() > 0 && family.string().at(0) == '.')
- return [NSFont fontWithName:desiredFamily size:size];
</del><span class="cx"> const auto& whitelist = fontWhitelist();
</span><span class="cx"> if (whitelist.size() && !whitelist.contains(family.lower()))
</span><span class="cx"> return nil;
</span></span></pre></div>
<a id="branchessafari6011322branchSourceWebCoreplatformmacThemeMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/Source/WebCore/platform/mac/ThemeMac.mm (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/Source/WebCore/platform/mac/ThemeMac.mm        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/platform/mac/ThemeMac.mm        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -675,7 +675,7 @@
</span><span class="cx"> fontDescription.setIsAbsoluteSize(true);
</span><span class="cx">
</span><span class="cx"> NSFont* nsFont = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSizeForFont(font)]];
</span><del>- fontDescription.setOneFamily([nsFont webCoreFamilyName]);
</del><ins>+ fontDescription.setOneFamily(AtomicString("-apple-system", AtomicString::ConstructFromLiteral));
</ins><span class="cx"> fontDescription.setComputedSize([nsFont pointSize] * zoomFactor);
</span><span class="cx"> fontDescription.setSpecifiedSize([nsFont pointSize] * zoomFactor);
</span><span class="cx"> return fontDescription;
</span></span></pre></div>
<a id="branchessafari6011322branchSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.32.2-branch/Source/WebCore/rendering/RenderThemeMac.mm (184494 => 184495)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.32.2-branch/Source/WebCore/rendering/RenderThemeMac.mm        2015-05-18 17:00:45 UTC (rev 184494)
+++ branches/safari-601.1.32.2-branch/Source/WebCore/rendering/RenderThemeMac.mm        2015-05-18 17:01:03 UTC (rev 184495)
</span><span class="lines">@@ -347,15 +347,21 @@
</span><span class="cx"> void RenderThemeMac::updateCachedSystemFontDescription(CSSValueID cssValueId, FontDescription& fontDescription) const
</span><span class="cx"> {
</span><span class="cx"> NSFont* font;
</span><ins>+ // System-font-ness can't be encapsulated by simply a font name. Instead, we must use a token
+ // which FontCache will look for.
+ // Make sure we keep this list of possible tokens in sync with FontCascade::primaryFontIsSystemFont()
+ String fontName(ASCIILiteral("-apple-system"));
</ins><span class="cx"> switch (cssValueId) {
</span><span class="cx"> case CSSValueSmallCaption:
</span><span class="cx"> font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
</span><span class="cx"> break;
</span><span class="cx"> case CSSValueMenu:
</span><span class="cx"> font = [NSFont menuFontOfSize:[NSFont systemFontSize]];
</span><ins>+ fontName = String(ASCIILiteral("-apple-menu"));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueStatusBar:
</span><span class="cx"> font = [NSFont labelFontOfSize:[NSFont labelFontSize]];
</span><ins>+ fontName = String(ASCIILiteral("-apple-status-bar"));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitMiniControl:
</span><span class="cx"> font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]];
</span><span class="lines">@@ -375,7 +381,7 @@
</span><span class="cx">
</span><span class="cx"> NSFontManager *fontManager = [NSFontManager sharedFontManager];
</span><span class="cx"> fontDescription.setIsAbsoluteSize(true);
</span><del>- fontDescription.setOneFamily([font webCoreFamilyName]);
</del><ins>+ fontDescription.setOneFamily(fontName);
</ins><span class="cx"> fontDescription.setSpecifiedSize([font pointSize]);
</span><span class="cx"> fontDescription.setWeight(toFontWeight([fontManager weightOfFont:font]));
</span><span class="cx"> fontDescription.setIsItalic([fontManager traitsOfFont:font] & NSItalicFontMask);
</span><span class="lines">@@ -821,7 +827,7 @@
</span><span class="cx"> fontDescription.setIsAbsoluteSize(true);
</span><span class="cx">
</span><span class="cx"> NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSize]];
</span><del>- fontDescription.setOneFamily([font webCoreFamilyName]);
</del><ins>+ fontDescription.setOneFamily(AtomicString("-apple-system", AtomicString::ConstructFromLiteral));
</ins><span class="cx"> fontDescription.setComputedSize([font pointSize] * style.effectiveZoom());
</span><span class="cx"> fontDescription.setSpecifiedSize([font pointSize] * style.effectiveZoom());
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>