Diff
Modified: trunk/LayoutTests/ChangeLog (265676 => 265677)
--- trunk/LayoutTests/ChangeLog 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/LayoutTests/ChangeLog 2020-08-14 17:34:41 UTC (rev 265677)
@@ -1,3 +1,16 @@
+2020-08-14 Takeshi Kurosawa <[email protected]>
+
+ @font-face font-weight descriptor should reject bolder and lighter
+ https://bugs.webkit.org/show_bug.cgi?id=215359
+
+ Reviewed by Darin Adler.
+
+ Both bolder and lighter are not allowed in font-weight descriptor. This patch splits
+ font-weight descriptor parsers from font-weight property parsers.
+
+ * fast/text/font-face-_javascript_-expected.txt:
+ * fast/text/font-face-_javascript_.html:
+
2020-08-14 Hector Lopez <[email protected]>
[ macOS ] imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-onerror.html is a flaky failure
Modified: trunk/LayoutTests/fast/text/font-face-_javascript_-expected.txt (265676 => 265677)
--- trunk/LayoutTests/fast/text/font-face-_javascript_-expected.txt 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/LayoutTests/fast/text/font-face-_javascript_-expected.txt 2020-08-14 17:34:41 UTC (rev 265677)
@@ -12,8 +12,8 @@
PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'normal'}).weight is "normal"
PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': '200'}).weight is "200"
PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'bold'}).weight is "bold"
-PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'bolder'}).weight is "bold"
-PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'lighter'}).weight is "200"
+PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'bolder'}).status is "error"
+PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'lighter'}).status is "error"
PASS new FontFace('family_name', 'url(\'asdf\')', {'weight': 'inherit'}).status is "error"
PASS new FontFace('family_name', 'url(\'asdf\')', {'stretch': 'ultra-expanded'}).stretch is "ultra-expanded"
PASS new FontFace('family_name', 'url(\'asdf\')', {'unicodeRange': 'U+26'}).unicodeRange is "U+26"
Modified: trunk/LayoutTests/fast/text/font-face-_javascript_.html (265676 => 265677)
--- trunk/LayoutTests/fast/text/font-face-_javascript_.html 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/LayoutTests/fast/text/font-face-_javascript_.html 2020-08-14 17:34:41 UTC (rev 265677)
@@ -20,8 +20,8 @@
shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'normal'}).weight", "normal");
shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': '200'}).weight", "200");
shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'bold'}).weight", "bold");
-shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'bolder'}).weight", "bold");
-shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'lighter'}).weight", "200");
+shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'bolder'}).status", "error");
+shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'lighter'}).status", "error");
shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'weight': 'inherit'}).status", "error");
shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'stretch': 'ultra-expanded'}).stretch", "ultra-expanded");
shouldBeEqualToString("new FontFace('family_name', 'url(\\'asdf\\')', {'unicodeRange': 'U+26'}).unicodeRange", "U+26");
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265676 => 265677)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-14 17:34:41 UTC (rev 265677)
@@ -1,3 +1,15 @@
+2020-08-14 Takeshi Kurosawa <[email protected]>
+
+ @font-face font-weight descriptor should reject bolder and lighter
+ https://bugs.webkit.org/show_bug.cgi?id=215359
+
+ Reviewed by Darin Adler.
+
+ Both bolder and lighter are not allowed in font-weight descriptor. This patch splits
+ font-weight descriptor parsers from font-weight property parsers.
+
+ * web-platform-tests/css/css-fonts/variations/at-font-face-descriptors-expected.txt:
+
2020-08-14 Youenn Fablet <[email protected]>
WritableStreamDefaultWriterEnsureReadyPromiseRejected should create a new readPromise if the current readyPromise is not pending
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors-expected.txt (265676 => 265677)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors-expected.txt 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/variations/at-font-face-descriptors-expected.txt 2020-08-14 17:34:41 UTC (rev 265677)
@@ -2,8 +2,8 @@
PASS font-weight(valid): 'normal' keyword: normal
PASS font-weight(valid): 'bold' keyword: bold
-FAIL font-weight(invalid): 'lighter' keyword iside @font-face: lighter assert_equals: No properties should be set. expected "" but got "lighter"
-FAIL font-weight(invalid): 'lighter' keyword iside @font-face: bolder assert_equals: No properties should be set. expected "" but got "bolder"
+PASS font-weight(invalid): 'lighter' keyword iside @font-face: lighter
+PASS font-weight(invalid): 'lighter' keyword iside @font-face: bolder
PASS font-weight(invalid): Extra content after keyword: bold a
PASS font-weight(valid): Values that are not multiple of 100 should be parsed successfully: 401
PASS font-weight(valid): Non-integer values should be parsed successfully: 400.1
Modified: trunk/Source/WebCore/ChangeLog (265676 => 265677)
--- trunk/Source/WebCore/ChangeLog 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/Source/WebCore/ChangeLog 2020-08-14 17:34:41 UTC (rev 265677)
@@ -1,3 +1,22 @@
+2020-08-14 Takeshi Kurosawa <[email protected]>
+
+ @font-face font-weight descriptor should reject bolder and lighter
+ https://bugs.webkit.org/show_bug.cgi?id=215359
+
+ Reviewed by Darin Adler.
+
+ Both bolder and lighter are not allowed in font-weight descriptor. This patch splits
+ font-weight descriptor parsers from font-weight property parsers.
+
+ Tested by existing (formerly failing) test: web-platform-tests/css/css-fonts/variations/at-font-face-descriptors.html:
+
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeFontWeightAbsoluteKeywordValue):
+ (WebCore::consumeFontWeightAbsoluteRange):
+ (WebCore::consumeFontWeightAbsolute):
+ (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
+ (WebCore::consumeFontWeightRange): Deleted.
+
2020-08-14 Youenn Fablet <[email protected]>
WritableStreamDefaultWriterEnsureReadyPromiseRejected should create a new readPromise if the current readyPromise is not pending
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (265676 => 265677)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2020-08-14 17:26:11 UTC (rev 265676)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2020-08-14 17:34:41 UTC (rev 265677)
@@ -872,10 +872,15 @@
return consumeFontWeightNumber(range);
}
+static RefPtr<CSSPrimitiveValue> consumeFontWeightAbsoluteKeywordValue(CSSParserTokenRange& range)
+{
+ return consumeIdent<CSSValueNormal, CSSValueBold>(range);
+}
+
#if ENABLE(VARIATION_FONTS)
-static RefPtr<CSSValue> consumeFontWeightRange(CSSParserTokenRange& range)
+static RefPtr<CSSValue> consumeFontWeightAbsoluteRange(CSSParserTokenRange& range)
{
- if (auto result = consumeFontWeightKeywordValue(range))
+ if (auto result = consumeFontWeightAbsoluteKeywordValue(range))
return result;
auto firstNumber = consumeFontWeightNumber(range);
if (!firstNumber)
@@ -890,6 +895,13 @@
result->append(secondNumber.releaseNonNull());
return RefPtr<CSSValue>(WTFMove(result));
}
+#else
+static RefPtr<CSSPrimitiveValue> consumeFontWeightAbsolute(CSSParserTokenRange& range)
+{
+ if (auto result = consumeFontWeightAbsoluteKeywordValue(range))
+ return result;
+ return consumeFontWeightNumber(range);
+}
#endif
static RefPtr<CSSPrimitiveValue> consumeFontStretchKeywordValue(CSSParserTokenRange& range)
@@ -4437,9 +4449,9 @@
break;
case CSSPropertyFontWeight:
#if ENABLE(VARIATION_FONTS)
- parsedValue = consumeFontWeightRange(m_range);
+ parsedValue = consumeFontWeightAbsoluteRange(m_range);
#else
- parsedValue = consumeFontWeight(m_range);
+ parsedValue = consumeFontWeightAbsolute(m_range);
#endif
break;
case CSSPropertyFontStretch: