<!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>[203887] branches/safari-602-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/203887">203887</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-07-29 00:12:46 -0700 (Fri, 29 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/203764">r203764</a>. rdar://problem/27434423</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsChangeLog">branches/safari-602-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari602branchLayoutTestsplatformiossimulatorTestExpectations">branches/safari-602-branch/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#branchessafari602branchSourceWebCoreChangeLog">branches/safari-602-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformgraphicsiosFontCacheIOSmm">branches/safari-602-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformspicocoaCoreTextSPIh">branches/safari-602-branch/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsfasttextsystemfontweightexpectedtxt">branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-expected.txt</a></li>
<li><a href="#branchessafari602branchLayoutTestsfasttextsystemfontweightitalicexpectedtxt">branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic-expected.txt</a></li>
<li><a href="#branchessafari602branchLayoutTestsfasttextsystemfontweightitalichtml">branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic.html</a></li>
<li><a href="#branchessafari602branchLayoutTestsfasttextsystemfontweighthtml">branches/safari-602-branch/LayoutTests/fast/text/system-font-weight.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/ChangeLog (203886 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/ChangeLog        2016-07-29 07:12:42 UTC (rev 203886)
+++ branches/safari-602-branch/LayoutTests/ChangeLog        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2016-07-28 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r203764. rdar://problem/27434423
+
+ 2016-07-26 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [iOS] SF-Heavy is inaccessible by web content
+ https://bugs.webkit.org/show_bug.cgi?id=160186
+ <rdar://problem/27434423>
+
+ Reviewed by Dean Jackson.
+
+ * platform/ios-simulator/TestExpectations: system-font-weight-italic.html
+ is expected to fail on iOS 9.
+ * fast/text/system-font-weight-italic-expected.txt: Added.
+ * fast/text/system-font-weight-italic.html: Added.
+ * fast/text/system-font-weight-expected.txt: Added.
+ * fast/text/system-font-weight.html: Added.
+
+2016-07-28 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r203743. rdar://problem/23325160
</span><span class="cx">
</span><span class="cx"> 2016-07-26 David Kilzer <ddkilzer@apple.com>
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestsfasttextsystemfontweightexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-expected.txt (0 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-expected.txt         (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-expected.txt        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This test makes sure that extra-heavy weights of the system font can be achieved.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS six.offsetWidth is not nine.offsetWidth
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Hello, WorldHello, World
</ins></span></pre></div>
<a id="branchessafari602branchLayoutTestsfasttextsystemfontweightitalicexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic-expected.txt (0 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic-expected.txt         (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic-expected.txt        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This test makes sure that extra-heavy weights of the system font can be achieved.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS six.offsetWidth is not nine.offsetWidth
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Hello, WorldHello, World
</ins></span></pre></div>
<a id="branchessafari602branchLayoutTestsfasttextsystemfontweightitalichtml"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic.html (0 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic.html         (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/text/system-font-weight-italic.html        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<div style="font: 19px -apple-system">
+<div style="font-style: italic;"><span id="six" style="font-weight: 600;">Hello, World</span><span id="nine" style="font-weight: 900;">Hello, World</span></div>
+</div>
+<script>
+description("This test makes sure that extra-heavy weights of the system font can be achieved.");
+var six = document.getElementById("six");
+var nine = document.getElementById("nine");
+shouldNotBe("six.offsetWidth", "nine.offsetWidth");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestsfasttextsystemfontweighthtml"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/fast/text/system-font-weight.html (0 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/fast/text/system-font-weight.html         (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/text/system-font-weight.html        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<div style="font: 19px -apple-system">
+<span id="six" style="font-weight: 600;">Hello, World</span><span id="nine" style="font-weight: 900;">Hello, World</span>
+</div>
+<script>
+description("This test makes sure that extra-heavy weights of the system font can be achieved.");
+var six = document.getElementById("six");
+var nine = document.getElementById("nine");
+shouldNotBe("six.offsetWidth", "nine.offsetWidth");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/platform/ios-simulator/TestExpectations (203886 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/platform/ios-simulator/TestExpectations        2016-07-29 07:12:42 UTC (rev 203886)
+++ branches/safari-602-branch/LayoutTests/platform/ios-simulator/TestExpectations        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -3020,3 +3020,6 @@
</span><span class="cx">
</span><span class="cx"> # This test is iPad only
</span><span class="cx"> platform/ios-simulator/media/video-interruption-suspendunderlock.html [ Skip ]
</span><ins>+
+# System font on iOS 9 cannot be bold and italic.
+fast/text/system-font-weight-italic.html [ Failure ]
</ins></span></pre></div>
<a id="branchessafari602branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (203886 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/ChangeLog        2016-07-29 07:12:42 UTC (rev 203886)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -1,5 +1,30 @@
</span><span class="cx"> 2016-07-28 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r203764. rdar://problem/27434423
+
+ 2016-07-26 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [iOS] SF-Heavy is inaccessible by web content
+ https://bugs.webkit.org/show_bug.cgi?id=160186
+ <rdar://problem/27434423>
+
+ Reviewed by Dean Jackson.
+
+ Once we create the system font, we need to modify it with the appropriate weight.
+ This is because the CoreText API we use to get the system font on iOS does not
+ let us choose the exact weight we want.
+
+ Test: fast/text/system-font-weight.html
+
+ * platform/graphics/ios/FontCacheIOS.mm:
+ (WebCore::baseSystemFontDescriptor):
+ (WebCore::systemFontModificationAttributes):
+ (WebCore::systemFontDescriptor):
+ (WebCore::platformFontWithFamilySpecialCase):
+ * platform/spi/cocoa/CoreTextSPI.h:
+
+2016-07-28 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r203775. rdar://problem/23325160
</span><span class="cx">
</span><span class="cx"> 2016-07-27 Carlos Garcia Campos <cgarcia@igalia.com>
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformgraphicsiosFontCacheIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (203886 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm        2016-07-29 07:12:42 UTC (rev 203886)
+++ branches/safari-602-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -134,6 +134,52 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static RetainPtr<CTFontDescriptorRef> baseSystemFontDescriptor(FontWeight weight, bool bold, float size)
+{
+ CTFontUIFontType fontType = kCTFontUIFontSystem;
+ if (weight > FontWeight300) {
+ if (bold)
+ fontType = kCTFontUIFontEmphasizedSystem;
+ } else if (weight > FontWeight200)
+ fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemLight);
+ else if (weight > FontWeight100)
+ fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemThin);
+ else
+ fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemUltraLight);
+ return adoptCF(CTFontDescriptorCreateForUIType(fontType, size, nullptr));
+}
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+static RetainPtr<NSDictionary> systemFontModificationAttributes(FontWeight weight, bool italic)
+{
+ RetainPtr<NSMutableDictionary> traitsDictionary = adoptNS([[NSMutableDictionary alloc] init]);
+
+ ASSERT(weight >= FontWeight100 && weight <= FontWeight900);
+ float ctWeights[] = { -0.7, -0.5, -0.23, 0, 0.2, 0.3, 0.4, 0.6, 0.8 };
+ [traitsDictionary setObject:[NSNumber numberWithFloat:ctWeights[weight]] forKey:static_cast<NSString *>(kCTFontWeightTrait)];
+
+ [traitsDictionary setObject:@YES forKey:static_cast<NSString *>(kCTFontUIFontDesignTrait)];
+
+ if (italic)
+ [traitsDictionary setObject:[NSNumber numberWithInt:kCTFontItalicTrait] forKey:static_cast<NSString *>(kCTFontSymbolicTrait)];
+
+ return @{ static_cast<NSString *>(kCTFontTraitsAttribute) : traitsDictionary.get() };
+}
+#endif
+
+static RetainPtr<CTFontDescriptorRef> systemFontDescriptor(FontWeight weight, bool bold, bool italic, float size)
+{
+ RetainPtr<CTFontDescriptorRef> fontDescriptor = baseSystemFontDescriptor(weight, bold, size);
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
+ RetainPtr<NSDictionary> attributes = systemFontModificationAttributes(weight, italic);
+ return adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(), static_cast<CFDictionaryRef>(attributes.get())));
+#else
+ if (italic)
+ return adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(fontDescriptor.get(), kCTFontItalicTrait, kCTFontItalicTrait));
+ return fontDescriptor;
+#endif
+}
+
</ins><span class="cx"> RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontWeight weight, CTFontSymbolicTraits traits, float size)
</span><span class="cx"> {
</span><span class="cx"> if (family.startsWith("UICTFontTextStyle")) {
</span><span class="lines">@@ -147,22 +193,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font")) {
</span><del>- CTFontUIFontType fontType = kCTFontUIFontSystem;
- if (weight > FontWeight300) {
- // The code below has been copied from CoreText/UIFoundation. However, in WebKit we synthesize the oblique,
- // so we should investigate the result <rdar://problem/14449340>:
- if (traits & kCTFontTraitBold)
- fontType = kCTFontUIFontEmphasizedSystem;
- } else if (weight > FontWeight200)
- fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemLight);
- else if (weight > FontWeight100)
- fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemThin);
- else
- fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemUltraLight);
- RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(fontType, size, nullptr));
- if (traits & kCTFontTraitItalic)
- fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(fontDescriptor.get(), kCTFontItalicTrait, kCTFontItalicTrait));
- return adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr));
</del><ins>+ return adoptCF(CTFontCreateWithFontDescriptor(systemFontDescriptor(weight, traits & kCTFontTraitBold, traits & kCTFontTraitItalic, size).get(), size, nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (equalLettersIgnoringASCIICase(family, "-apple-system-monospaced-numbers")) {
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformspicocoaCoreTextSPIh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h (203886 => 203887)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h        2016-07-29 07:12:42 UTC (rev 203886)
+++ branches/safari-602-branch/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h        2016-07-29 07:12:46 UTC (rev 203887)
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);
</span><span class="cx">
</span><span class="cx"> extern const CFStringRef kCTFontDescriptorTextStyleAttribute;
</span><ins>+extern const CFStringRef kCTFontUIFontDesignTrait;
</ins><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>