Diff
Modified: trunk/LayoutTests/ChangeLog (203763 => 203764)
--- trunk/LayoutTests/ChangeLog 2016-07-27 05:31:37 UTC (rev 203763)
+++ trunk/LayoutTests/ChangeLog 2016-07-27 06:20:47 UTC (rev 203764)
@@ -1,3 +1,18 @@
+2016-07-26 Myles C. Maxfield <mmaxfi...@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-26 Ryan Haddad <ryanhad...@apple.com>
Skip failing JSC test regress/script-tests/bigswitch-indirect-symbol.js
Added: trunk/LayoutTests/fast/text/system-font-weight-expected.txt (0 => 203764)
--- trunk/LayoutTests/fast/text/system-font-weight-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/system-font-weight-expected.txt 2016-07-27 06:20:47 UTC (rev 203764)
@@ -0,0 +1,10 @@
+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
Added: trunk/LayoutTests/fast/text/system-font-weight-italic-expected.txt (0 => 203764)
--- trunk/LayoutTests/fast/text/system-font-weight-italic-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/system-font-weight-italic-expected.txt 2016-07-27 06:20:47 UTC (rev 203764)
@@ -0,0 +1,10 @@
+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
Added: trunk/LayoutTests/fast/text/system-font-weight-italic.html (0 => 203764)
--- trunk/LayoutTests/fast/text/system-font-weight-italic.html (rev 0)
+++ trunk/LayoutTests/fast/text/system-font-weight-italic.html 2016-07-27 06:20:47 UTC (rev 203764)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</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=""
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/text/system-font-weight.html (0 => 203764)
--- trunk/LayoutTests/fast/text/system-font-weight.html (rev 0)
+++ trunk/LayoutTests/fast/text/system-font-weight.html 2016-07-27 06:20:47 UTC (rev 203764)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</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=""
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (203763 => 203764)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-07-27 05:31:37 UTC (rev 203763)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-07-27 06:20:47 UTC (rev 203764)
@@ -3007,3 +3007,6 @@
# This test is iPad only
platform/ios-simulator/media/video-interruption-suspendunderlock.html [ Skip ]
+
+# System font on iOS 9 cannot be bold and italic.
+fast/text/system-font-weight-italic.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (203763 => 203764)
--- trunk/Source/WebCore/ChangeLog 2016-07-27 05:31:37 UTC (rev 203763)
+++ trunk/Source/WebCore/ChangeLog 2016-07-27 06:20:47 UTC (rev 203764)
@@ -1,3 +1,24 @@
+2016-07-26 Myles C. Maxfield <mmaxfi...@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-26 Fujii Hironori <hironori.fu...@sony.com>
[GTK] ASSERTION FAILED: !m_adoptionIsRequired when Inspector Server is connected
Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (203763 => 203764)
--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2016-07-27 05:31:37 UTC (rev 203763)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm 2016-07-27 06:20:47 UTC (rev 203764)
@@ -134,6 +134,52 @@
return result;
}
+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
+}
+
RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontWeight weight, CTFontSymbolicTraits traits, float size)
{
if (family.startsWith("UICTFontTextStyle")) {
@@ -147,22 +193,7 @@
}
if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font")) {
- 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));
+ return adoptCF(CTFontCreateWithFontDescriptor(systemFontDescriptor(weight, traits & kCTFontTraitBold, traits & kCTFontTraitItalic, size).get(), size, nullptr));
}
if (equalLettersIgnoringASCIICase(family, "-apple-system-monospaced-numbers")) {
Modified: trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h (203763 => 203764)
--- trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h 2016-07-27 05:31:37 UTC (rev 203763)
+++ trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h 2016-07-27 06:20:47 UTC (rev 203764)
@@ -87,6 +87,7 @@
CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);
extern const CFStringRef kCTFontDescriptorTextStyleAttribute;
+extern const CFStringRef kCTFontUIFontDesignTrait;
#endif
#endif