Title: [206666] trunk
Revision
206666
Author
[email protected]
Date
2016-09-30 14:17:47 -0700 (Fri, 30 Sep 2016)

Log Message

Fix fast/text/trak-optimizeLegibility.html
https://bugs.webkit.org/show_bug.cgi?id=162779

Reviewed by Simon Fraser.

Source/WebCore:

I accidentally created this test to allow an unnecessary delta
in the width comparison. This covered the fact that the fonts
were not being selected correctly in our testing code. Update the
font selection code to work with system fonts correctly and
update the test to not use a delta when performing width
comparisons.

Test: fast/text/trak-optimizeLegibility.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::isSystemFont):
(WebCore::platformFontLookupWithFamily):

LayoutTests:

* fast/text/trak-optimizeLegibility.html:
* platform/ios-simulator/fast/text/trak-optimizeLegibility-expected.txt:
* platform/mac-elcapitan/fast/text/trak-optimizeLegibility-expected.txt: Removed.
* platform/mac/fast/text/trak-optimizeLegibility-expected.txt:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206665 => 206666)


--- trunk/LayoutTests/ChangeLog	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/LayoutTests/ChangeLog	2016-09-30 21:17:47 UTC (rev 206666)
@@ -1,3 +1,15 @@
+2016-09-30  Myles C. Maxfield  <[email protected]>
+
+        Fix fast/text/trak-optimizeLegibility.html
+        https://bugs.webkit.org/show_bug.cgi?id=162779
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/trak-optimizeLegibility.html:
+        * platform/ios-simulator/fast/text/trak-optimizeLegibility-expected.txt:
+        * platform/mac-elcapitan/fast/text/trak-optimizeLegibility-expected.txt: Removed.
+        * platform/mac/fast/text/trak-optimizeLegibility-expected.txt:
+
 2016-09-30  Zalan Bujtas  <[email protected]>
 
         Unreviewed, rolling out r206611.

Modified: trunk/LayoutTests/fast/text/trak-optimizeLegibility.html (206665 => 206666)


--- trunk/LayoutTests/fast/text/trak-optimizeLegibility.html	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/LayoutTests/fast/text/trak-optimizeLegibility.html	2016-09-30 21:17:47 UTC (rev 206666)
@@ -6,15 +6,15 @@
 <body>
 This test makes sure that you can opt-in to honoring the 'trak' table by specifying text-rendering: optimizeLegibility.
 The first and third lines below should have the same width. The middle one can (but doesn't have to) have a different width.
-<p><span id="first" style="font: 50px '-apple-system'; font-weight: 300;">hamburgefonstiv</span></p>
-<p><span id="second" style="font: 50px '.AppleSystemUIFontLight' '.SFNSText-Light' '.SFUIDisplay-Light';">hamburgefonstiv</span></p>
-<p><span id="third" style="font: 50px '.AppleSystemUIFontLight' '.SFNSText-Light' '.SFUIDisplay-Light'; text-rendering: optimizeLegibility;">hamburgefonstiv</span></p>
+<p><span id="first" style="font: 100px '-apple-system'; font-weight: 300;">hamburgefonstiv</span></p>
+<p><span id="second" style="font: 100px '.AppleSystemUIFontLight' '.SFNSText-Light' '.SFUIDisplay-Light';">hamburgefonstiv</span></p>
+<p><span id="third" style="font: 100px '.AppleSystemUIFontLight' '.SFNSText-Light' '.SFUIDisplay-Light'; text-rendering: optimizeLegibility;">hamburgefonstiv</span></p>
 <script>
 var first = document.getElementById("first");
 var third = document.getElementById("third");
 shouldBe("first.getClientRects().length", "1");
 shouldBe("third.getClientRects().length", "1");
-shouldBeCloseTo("first.getClientRects()[0].right", third.getClientRects()[0].right, 4);
+shouldBe("first.getClientRects()[0].right", "third.getClientRects()[0].right");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/platform/ios-simulator/fast/text/trak-optimizeLegibility-expected.txt (206665 => 206666)


--- trunk/LayoutTests/platform/ios-simulator/fast/text/trak-optimizeLegibility-expected.txt	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/LayoutTests/platform/ios-simulator/fast/text/trak-optimizeLegibility-expected.txt	2016-09-30 21:17:47 UTC (rev 206666)
@@ -1,6 +1,6 @@
 PASS first.getClientRects().length is 1
 PASS third.getClientRects().length is 1
-PASS first.getClientRects()[0].right is within 4 of 369
+PASS first.getClientRects()[0].right is third.getClientRects()[0].right
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/mac/fast/text/trak-optimizeLegibility-expected.txt (206665 => 206666)


--- trunk/LayoutTests/platform/mac/fast/text/trak-optimizeLegibility-expected.txt	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/LayoutTests/platform/mac/fast/text/trak-optimizeLegibility-expected.txt	2016-09-30 21:17:47 UTC (rev 206666)
@@ -1,6 +1,6 @@
 PASS first.getClientRects().length is 1
 PASS third.getClientRects().length is 1
-FAIL first.getClientRects()[0].right should be within 4 of 346. Was 369.
+PASS first.getClientRects()[0].right is third.getClientRects()[0].right
 PASS successfullyParsed is true
 
 TEST COMPLETE

Deleted: trunk/LayoutTests/platform/mac-elcapitan/fast/text/trak-optimizeLegibility-expected.txt (206665 => 206666)


--- trunk/LayoutTests/platform/mac-elcapitan/fast/text/trak-optimizeLegibility-expected.txt	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/LayoutTests/platform/mac-elcapitan/fast/text/trak-optimizeLegibility-expected.txt	2016-09-30 21:17:47 UTC (rev 206666)
@@ -1,12 +0,0 @@
-PASS first.getClientRects().length is 1
-PASS third.getClientRects().length is 1
-FAIL first.getClientRects()[0].right should be within 4 of 346. Was 364.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-This test makes sure that you can opt-in to honoring the 'trak' table by specifying text-rendering: optimizeLegibility. The first and third lines below should have the same width. The middle one can (but doesn't have to) have a different width.
-hamburgefonstiv
-
-hamburgefonstiv
-
-hamburgefonstiv

Modified: trunk/Source/WebCore/ChangeLog (206665 => 206666)


--- trunk/Source/WebCore/ChangeLog	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/Source/WebCore/ChangeLog	2016-09-30 21:17:47 UTC (rev 206666)
@@ -1,5 +1,25 @@
 2016-09-30  Myles C. Maxfield  <[email protected]>
 
+        Fix fast/text/trak-optimizeLegibility.html
+        https://bugs.webkit.org/show_bug.cgi?id=162779
+
+        Reviewed by Simon Fraser.
+
+        I accidentally created this test to allow an unnecessary delta
+        in the width comparison. This covered the fact that the fonts
+        were not being selected correctly in our testing code. Update the
+        font selection code to work with system fonts correctly and
+        update the test to not use a delta when performing width
+        comparisons.
+
+        Test: fast/text/trak-optimizeLegibility.html
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::isSystemFont):
+        (WebCore::platformFontLookupWithFamily):
+
+2016-09-30  Myles C. Maxfield  <[email protected]>
+
         Create runtime flag for variation font work
         https://bugs.webkit.org/show_bug.cgi?id=162780
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (206665 => 206666)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2016-09-30 21:16:07 UTC (rev 206665)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2016-09-30 21:17:47 UTC (rev 206666)
@@ -661,10 +661,15 @@
 }
 
 #if ENABLE(PLATFORM_FONT_LOOKUP)
+static bool isSystemFont(const AtomicString& family)
+{
+    return family.length() >= 1 && family[0] == '.';
+}
+
 static RetainPtr<CTFontRef> platformFontLookupWithFamily(const AtomicString& family, CTFontSymbolicTraits requestedTraits, FontWeight weight, float size)
 {
     const auto& whitelist = fontWhitelist();
-    if (whitelist.size() && !whitelist.contains(family))
+    if (!isSystemFont(family) && whitelist.size() && !whitelist.contains(family))
         return nullptr;
 
     return adoptCF(CTFontCreateForCSS(family.string().createCFString().get(), toCoreTextFontWeight(weight), requestedTraits, size));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to