Title: [216517] trunk
Revision
216517
Author
mmaxfi...@apple.com
Date
2017-05-09 11:02:12 -0700 (Tue, 09 May 2017)

Log Message

font-stretch: normal selects expanded fonts instead of condensed fonts
https://bugs.webkit.org/show_bug.cgi?id=171838
<rdar://problem/31005481>

Reviewed by Jon Lee.

Source/WebCore:

CSS Fonts level 3 says: "If the value of ‘font-stretch’ is ‘normal’ or one of the condensed
values, narrower width values are checked first, then wider values."

CSS Fonts level 4 erroneously was incompatible with this, but was updated in
https://github.com/w3c/csswg-drafts/commit/4559389d183bbaaf3321af5ba1c924caa7c488bb
to be consistent with this.

Now, CSS Fonts level 4 states: "If the desired stretch value is less than or equal to100,
stretch values below the desired stretch value are checked in descending order followed by
stretch values above the desired stretch value in ascending order"

Test: fast/text/font-width-100.html

* platform/graphics/FontSelectionAlgorithm.cpp:

LayoutTests:

* fast/text/font-width-100-expected.html: Added.
* fast/text/font-width-100.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216516 => 216517)


--- trunk/LayoutTests/ChangeLog	2017-05-09 17:56:29 UTC (rev 216516)
+++ trunk/LayoutTests/ChangeLog	2017-05-09 18:02:12 UTC (rev 216517)
@@ -1,3 +1,14 @@
+2017-05-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        font-stretch: normal selects expanded fonts instead of condensed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=171838
+        <rdar://problem/31005481>
+
+        Reviewed by Jon Lee.
+
+        * fast/text/font-width-100-expected.html: Added.
+        * fast/text/font-width-100.html: Added.
+
 2017-05-09  Matt Lewis  <jlew...@apple.com>
 
         Mark storage/indexeddb/modern/idbtransaction-objectstore-failures.html as flaky.

Added: trunk/LayoutTests/fast/text/font-width-100-expected.html (0 => 216517)


--- trunk/LayoutTests/fast/text/font-width-100-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-width-100-expected.html	2017-05-09 18:02:12 UTC (rev 216517)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that "font-stretch: 100%" selects fonts which are condensed
+rather than expanded. The test passes if the text below is in Times.
+<div style="font-family: 'Times'; font-size: 100px;">Hello</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/font-width-100.html (0 => 216517)


--- trunk/LayoutTests/fast/text/font-width-100.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-width-100.html	2017-05-09 18:02:12 UTC (rev 216517)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "MyFont";
+    src: local("Helvetica");
+    font-stretch: 120%;
+}
+@font-face {
+    font-family: "MyFont";
+    src: local("Times");
+    font-stretch: 80%;
+}
+</style>
+</head>
+<body>
+This test makes sure that "font-stretch: 100%" selects fonts which are condensed
+rather than expanded. The test passes if the text below is in Times.
+<div style="font-family: 'MyFont'; font-size: 100px; font-stretch: 100%">Hello</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (216516 => 216517)


--- trunk/Source/WebCore/ChangeLog	2017-05-09 17:56:29 UTC (rev 216516)
+++ trunk/Source/WebCore/ChangeLog	2017-05-09 18:02:12 UTC (rev 216517)
@@ -1,3 +1,26 @@
+2017-05-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        font-stretch: normal selects expanded fonts instead of condensed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=171838
+        <rdar://problem/31005481>
+
+        Reviewed by Jon Lee.
+
+        CSS Fonts level 3 says: "If the value of ‘font-stretch’ is ‘normal’ or one of the condensed
+        values, narrower width values are checked first, then wider values."
+
+        CSS Fonts level 4 erroneously was incompatible with this, but was updated in
+        https://github.com/w3c/csswg-drafts/commit/4559389d183bbaaf3321af5ba1c924caa7c488bb
+        to be consistent with this.
+
+        Now, CSS Fonts level 4 states: "If the desired stretch value is less than or equal to100,
+        stretch values below the desired stretch value are checked in descending order followed by
+        stretch values above the desired stretch value in ascending order"
+
+        Test: fast/text/font-width-100.html
+
+        * platform/graphics/FontSelectionAlgorithm.cpp:
+
 2017-05-09  Romain Bellessort  <romain.belless...@crf.canon.fr>
 
         [Readable Streams API] Enable creation of ReadableStreamBYOBReader

Modified: trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp (216516 => 216517)


--- trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp	2017-05-09 17:56:29 UTC (rev 216516)
+++ trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp	2017-05-09 18:02:12 UTC (rev 216517)
@@ -35,7 +35,7 @@
     if (width.includes(m_request.width))
         return { FontSelectionValue(), m_request.width };
 
-    if (m_request.width >= normalStretchValue()) {
+    if (m_request.width > normalStretchValue()) {
         if (width.minimum > m_request.width)
             return { width.minimum - m_request.width, width.minimum };
         ASSERT(width.maximum < m_request.width);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to