Title: [204107] trunk
Revision
204107
Author
mmaxfi...@apple.com
Date
2016-08-03 16:50:19 -0700 (Wed, 03 Aug 2016)

Log Message

[iOS] SF-Heavy is not accessible from web content
https://bugs.webkit.org/show_bug.cgi?id=160522
<rdar://problem/27685273>

Reviewed by Simon Fraser.

Source/WebCore:

The mappings we were using from CSS font-weight to CoreText font weight were inaccurate.
Instead, these new mappings should be used.

Test: fast/text/system-font-weight.html

* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::systemFontModificationAttributes):

LayoutTests:

* platform/ios-simulator/fast/text/system-font-weight-expected.txt: iOS 9 is not
expected to pass this test, but there is no way to specify that currently using
TestExpectations. Instead, we can create an iOS 9 specific result.
* fast/text/system-font-weight-expected.txt:
* fast/text/system-font-weight.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204106 => 204107)


--- trunk/LayoutTests/ChangeLog	2016-08-03 23:41:00 UTC (rev 204106)
+++ trunk/LayoutTests/ChangeLog	2016-08-03 23:50:19 UTC (rev 204107)
@@ -1,3 +1,17 @@
+2016-08-03  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [iOS] SF-Heavy is not accessible from web content
+        https://bugs.webkit.org/show_bug.cgi?id=160522
+        <rdar://problem/27685273>
+
+        Reviewed by Simon Fraser.
+
+        * platform/ios-simulator/fast/text/system-font-weight-expected.txt: iOS 9 is not
+        expected to pass this test, but there is no way to specify that currently using
+        TestExpectations. Instead, we can create an iOS 9 specific result.
+        * fast/text/system-font-weight-expected.txt:
+        * fast/text/system-font-weight.html:
+
 2016-08-03  Ryan Haddad  <ryanhad...@apple.com>
 
         Rebaseline tests for ios-simulator after r204090.

Modified: trunk/LayoutTests/fast/text/system-font-weight-expected.txt (204106 => 204107)


--- trunk/LayoutTests/fast/text/system-font-weight-expected.txt	2016-08-03 23:41:00 UTC (rev 204106)
+++ trunk/LayoutTests/fast/text/system-font-weight-expected.txt	2016-08-03 23:50:19 UTC (rev 204107)
@@ -3,8 +3,19 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS six.offsetWidth is not nine.offsetWidth
+PASS four.offsetWidth is not three.offsetWidth
+PASS five.offsetWidth is not four.offsetWidth
+PASS six.offsetWidth is not five.offsetWidth
+PASS eight.offsetWidth is not seven.offsetWidth
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Hello, WorldHello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World

Modified: trunk/LayoutTests/fast/text/system-font-weight.html (204106 => 204107)


--- trunk/LayoutTests/fast/text/system-font-weight.html	2016-08-03 23:41:00 UTC (rev 204106)
+++ trunk/LayoutTests/fast/text/system-font-weight.html	2016-08-03 23:50:19 UTC (rev 204107)
@@ -5,13 +5,31 @@
 </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><span id="one" style="font-weight: 100;">Hello, World</span></div>
+<div><span id="two" style="font-weight: 200;">Hello, World</span></div>
+<div><span id="three" style="font-weight: 300;">Hello, World</span></div>
+<div><span id="four" style="font-weight: 400;">Hello, World</span></div>
+<div><span id="five" style="font-weight: 500;">Hello, World</span></div>
+<div><span id="six" style="font-weight: 600;">Hello, World</span></div>
+<div><span id="seven" style="font-weight: 700;">Hello, World</span></div>
+<div><span id="eight" style="font-weight: 800;">Hello, World</span></div>
+<div><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 _one_ = document.getElementById("one");
+var two = document.getElementById("two");
+var three = document.getElementById("three");
+var four = document.getElementById("four");
+var five = document.getElementById("five");
 var six = document.getElementById("six");
+var seven = document.getElementById("seven");
+var eight = document.getElementById("eight");
 var nine = document.getElementById("nine");
-shouldNotBe("six.offsetWidth", "nine.offsetWidth");
+shouldNotBe("four.offsetWidth", "three.offsetWidth");
+shouldNotBe("five.offsetWidth", "four.offsetWidth");
+shouldNotBe("six.offsetWidth", "five.offsetWidth");
+shouldNotBe("eight.offsetWidth", "seven.offsetWidth");
 </script>
 <script src=""
 </body>

Added: trunk/LayoutTests/platform/ios-simulator/fast/text/system-font-weight-expected.txt (0 => 204107)


--- trunk/LayoutTests/platform/ios-simulator/fast/text/system-font-weight-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/text/system-font-weight-expected.txt	2016-08-03 23:50:19 UTC (rev 204107)
@@ -0,0 +1,21 @@
+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 four.offsetWidth is not three.offsetWidth
+FAIL five.offsetWidth should not be 104.
+PASS six.offsetWidth is not five.offsetWidth
+FAIL eight.offsetWidth should not be 108.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World
+Hello, World

Modified: trunk/Source/WebCore/ChangeLog (204106 => 204107)


--- trunk/Source/WebCore/ChangeLog	2016-08-03 23:41:00 UTC (rev 204106)
+++ trunk/Source/WebCore/ChangeLog	2016-08-03 23:50:19 UTC (rev 204107)
@@ -1,3 +1,19 @@
+2016-08-03  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [iOS] SF-Heavy is not accessible from web content
+        https://bugs.webkit.org/show_bug.cgi?id=160522
+        <rdar://problem/27685273>
+
+        Reviewed by Simon Fraser.
+
+        The mappings we were using from CSS font-weight to CoreText font weight were inaccurate.
+        Instead, these new mappings should be used.
+
+        Test: fast/text/system-font-weight.html
+
+        * platform/graphics/ios/FontCacheIOS.mm:
+        (WebCore::systemFontModificationAttributes):
+
 2016-08-03  Anders Carlsson  <ander...@apple.com>
 
         Remove the Objective-C bindings generator

Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (204106 => 204107)


--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2016-08-03 23:41:00 UTC (rev 204106)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2016-08-03 23:50:19 UTC (rev 204107)
@@ -155,7 +155,17 @@
     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 };
+    float ctWeights[] = {
+        static_cast<float>(kCTFontWeightUltraLight),
+        static_cast<float>(kCTFontWeightThin),
+        static_cast<float>(kCTFontWeightLight),
+        static_cast<float>(kCTFontWeightRegular),
+        static_cast<float>(kCTFontWeightMedium),
+        static_cast<float>(kCTFontWeightSemibold),
+        static_cast<float>(kCTFontWeightBold),
+        static_cast<float>(kCTFontWeightHeavy),
+        static_cast<float>(kCTFontWeightBlack)
+    };
     [traitsDictionary setObject:[NSNumber numberWithFloat:ctWeights[weight]] forKey:static_cast<NSString *>(kCTFontWeightTrait)];
 
     [traitsDictionary setObject:@YES forKey:static_cast<NSString *>(kCTFontUIFontDesignTrait)];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to