Title: [244817] trunk
Revision
244817
Author
[email protected]
Date
2019-04-30 18:14:37 -0700 (Tue, 30 Apr 2019)

Log Message

font-weight: 1000 is not parsed successfully
https://bugs.webkit.org/show_bug.cgi?id=197427

Reviewed by Dean Jackson.

Source/WebCore:

The spec says:
"Only values greater than or equal to 1, and less than or equal to 1000, are valid"

This change brings us in-line with all the other browsers.

Test: fast/text/font-weight-1-1000.html

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):

LayoutTests:

* platform/win/TestExpectations: Windows disables variation fonts, so requires values to be divisible by 100
* fast/text/font-weight-1-1000-expected.txt: Added.
* fast/text/font-weight-1-1000.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244816 => 244817)


--- trunk/LayoutTests/ChangeLog	2019-05-01 00:32:15 UTC (rev 244816)
+++ trunk/LayoutTests/ChangeLog	2019-05-01 01:14:37 UTC (rev 244817)
@@ -1,3 +1,14 @@
+2019-04-30  Myles C. Maxfield  <[email protected]>
+
+        font-weight: 1000 is not parsed successfully
+        https://bugs.webkit.org/show_bug.cgi?id=197427
+
+        Reviewed by Dean Jackson.
+
+        * platform/win/TestExpectations: Windows disables variation fonts, so requires values to be divisible by 100
+        * fast/text/font-weight-1-1000-expected.txt: Added.
+        * fast/text/font-weight-1-1000.html: Added.
+
 2019-04-30  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r244806.

Added: trunk/LayoutTests/fast/text/font-weight-1-1000-expected.txt (0 => 244817)


--- trunk/LayoutTests/fast/text/font-weight-1-1000-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-weight-1-1000-expected.txt	2019-05-01 01:14:37 UTC (rev 244817)
@@ -0,0 +1,17 @@
+This test makes sure that font-weight's range of values are parsed correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-weight') is "1"
+PASS window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-weight') is "999"
+PASS window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-weight') is "999.5"
+PASS window.getComputedStyle(document.getElementById('test6')).getPropertyValue('font-weight') is "1000"
+PASS window.getComputedStyle(document.getElementById('test7')).getPropertyValue('font-weight') is "normal"
+PASS window.getComputedStyle(document.getElementById('test8')).getPropertyValue('font-weight') is "normal"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/text/font-weight-1-1000.html (0 => 244817)


--- trunk/LayoutTests/fast/text/font-weight-1-1000.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-weight-1-1000.html	2019-05-01 01:14:37 UTC (rev 244817)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="reference"></div>
+<div id="test1" style="font-weight: 0;"></div>
+<div id="test2" style="font-weight: 0.5;"></div>
+<div id="test3" style="font-weight: 1;"></div>
+<div id="test4" style="font-weight: 999;"></div>
+<div id="test5" style="font-weight: 999.5;"></div>
+<div id="test6" style="font-weight: 1000;"></div>
+<div id="test7" style="font-weight: 1000.5;"></div>
+<div id="test8" style="font-weight: 1001;"></div>
+<script>
+description("This test makes sure that font-weight's range of values are parsed correctly.");
+const reference = window.getComputedStyle(document.getElementById("reference")).getPropertyValue("font-weight");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-weight')", reference);
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-weight')", reference);
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-weight')", "1");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-weight')", "999");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-weight')", "999.5");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).getPropertyValue('font-weight')", "1000");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).getPropertyValue('font-weight')", reference);
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).getPropertyValue('font-weight')", reference);
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/win/TestExpectations (244816 => 244817)


--- trunk/LayoutTests/platform/win/TestExpectations	2019-05-01 00:32:15 UTC (rev 244816)
+++ trunk/LayoutTests/platform/win/TestExpectations	2019-05-01 01:14:37 UTC (rev 244817)
@@ -3597,6 +3597,7 @@
 tables/mozilla/bugs/bug4427.html [ Failure ]
 transitions/clip-path-path-transitions.html [ Failure ]
 legacy-animation-engine/transitions/clip-path-path-transitions.html [ Failure ]
+fast/text/font-weight-1-1000.html [ Failure ]
 # Unexpected image-only failures tracked in webkit.org/b/172437.
 editing/selection/update-selection-by-style-change.html [ ImageOnlyFailure ]
 fast/borders/border-painting-correctness-dashed.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (244816 => 244817)


--- trunk/Source/WebCore/ChangeLog	2019-05-01 00:32:15 UTC (rev 244816)
+++ trunk/Source/WebCore/ChangeLog	2019-05-01 01:14:37 UTC (rev 244817)
@@ -1,3 +1,20 @@
+2019-04-30  Myles C. Maxfield  <[email protected]>
+
+        font-weight: 1000 is not parsed successfully
+        https://bugs.webkit.org/show_bug.cgi?id=197427
+
+        Reviewed by Dean Jackson.
+
+        The spec says:
+        "Only values greater than or equal to 1, and less than or equal to 1000, are valid"
+
+        This change brings us in-line with all the other browsers.
+
+        Test: fast/text/font-weight-1-1000.html
+
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
+
 2019-04-30  Youenn Fablet  <[email protected]>
 
         Make Document audio producers use WeakPtr

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (244816 => 244817)


--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2019-05-01 00:32:15 UTC (rev 244816)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2019-05-01 01:14:37 UTC (rev 244817)
@@ -230,7 +230,7 @@
 {
     // Values less than or equal to 0 or greater than or equal to 1000 are parse errors.
     auto& token = range.peek();
-    if (token.type() == NumberToken && token.numericValue() > 0 && token.numericValue() < 1000
+    if (token.type() == NumberToken && token.numericValue() >= 1 && token.numericValue() <= 1000
 #if !ENABLE(VARIATION_FONTS)
         && token.numericValueType() == IntegerValueType && divisibleBy100(token.numericValue())
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to