Diff
Modified: trunk/LayoutTests/ChangeLog (214432 => 214433)
--- trunk/LayoutTests/ChangeLog 2017-03-27 21:49:09 UTC (rev 214432)
+++ trunk/LayoutTests/ChangeLog 2017-03-27 22:09:14 UTC (rev 214433)
@@ -1,3 +1,13 @@
+2017-03-27 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Test variation font ranges in the CSS Font Loading API
+ https://bugs.webkit.org/show_bug.cgi?id=170022
+
+ Reviewed by Dean Jackson.
+
+ * fast/text/variations/font-loading-api-parse-ranges-expected.txt: Added.
+ * fast/text/variations/font-loading-api-parse-ranges.html: Added.
+
2017-03-27 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r214411.
Added: trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges-expected.txt (0 => 214433)
--- trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges-expected.txt 2017-03-27 22:09:14 UTC (rev 214433)
@@ -0,0 +1,47 @@
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200' })).weight is "100 200"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: 'a100 200' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100a 200' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200' })).weight is "100 200"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 a 200' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 a200' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200a' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '50 150' })).weight is "50 150"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '2 3' })).weight is "2 3"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '-3 -2' })).weight is "-3 -2"
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '5 4' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200 3' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '100 200 a' })).weight threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { weight: '-3' })).weight is "-3"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: 'semi-expanded expanded' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%' })).stretch is "100% 200%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: 'a100% 200%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100%a 200%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%' })).stretch is "100% 200%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% a 200%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% a200%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%a' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '50% 60%' })).stretch is "50% 60%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '2% 3%' })).stretch is "2% 3%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '-3% -2%' })).stretch is "-3% -2%"
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '5% 4%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% 3%' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% a' })).stretch threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { stretch: '-3%' })).stretch is "-3%"
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg' })).style is "oblique 10deg 20deg"
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique a10deg 20deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10dega 20deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg' })).style is "oblique 10deg 20deg"
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg a 20deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg a20deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20dega' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 50deg 60deg' })).style is "oblique 50deg 60deg"
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 2deg 3deg' })).style is "oblique 2deg 3deg"
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique -3deg -2deg' })).style is "oblique -3deg -2deg"
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 5deg 4deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg 3deg' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg a' })).style threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS (new FontFace('asdf', 'url(notreal)', { style: 'oblique -3deg' })).style is "oblique -3deg"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges.html (0 => 214433)
--- trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges.html (rev 0)
+++ trunk/LayoutTests/fast/text/variations/font-loading-api-parse-ranges.html 2017-03-27 22:09:14 UTC (rev 214433)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '100 200' })).weight", "100 200");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: 'a100 200' })).weight");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100a 200' })).weight");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '100 200' })).weight", "100 200");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 a 200' })).weight");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 a200' })).weight");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 200a' })).weight");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '50 150' })).weight", "50 150");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '2 3' })).weight", "2 3");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '-3 -2' })).weight", "-3 -2");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '5 4' })).weight");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 200 3' })).weight");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { weight: '100 200 a' })).weight");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { weight: '-3' })).weight", "-3");
+
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: 'semi-expanded expanded' })).stretch");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%' })).stretch", "100% 200%");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: 'a100% 200%' })).stretch");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100%a 200%' })).stretch");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%' })).stretch", "100% 200%");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% a 200%' })).stretch");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% a200%' })).stretch");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200%a' })).stretch");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '50% 60%' })).stretch", "50% 60%");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '2% 3%' })).stretch", "2% 3%");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '-3% -2%' })).stretch", "-3% -2%");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '5% 4%' })).stretch");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% 3%' })).stretch");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { stretch: '100% 200% a' })).stretch");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { stretch: '-3%' })).stretch", "-3%");
+
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg' })).style", "oblique 10deg 20deg");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique a10deg 20deg' })).style");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10dega 20deg' })).style");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg' })).style", "oblique 10deg 20deg");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg a 20deg' })).style");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg a20deg' })).style");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20dega' })).style");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 50deg 60deg' })).style", "oblique 50deg 60deg");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 2deg 3deg' })).style", "oblique 2deg 3deg");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique -3deg -2deg' })).style", "oblique -3deg -2deg");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 5deg 4deg' })).style");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg 3deg' })).style");
+shouldThrow("(new FontFace('asdf', 'url(notreal)', { style: 'oblique 10deg 20deg a' })).style");
+shouldBeEqualToString("(new FontFace('asdf', 'url(notreal)', { style: 'oblique -3deg' })).style", "oblique -3deg");
+</script>
+<script src=""
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (214432 => 214433)
--- trunk/Source/WebCore/ChangeLog 2017-03-27 21:49:09 UTC (rev 214432)
+++ trunk/Source/WebCore/ChangeLog 2017-03-27 22:09:14 UTC (rev 214433)
@@ -1,3 +1,27 @@
+2017-03-27 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Test variation font ranges in the CSS Font Loading API
+ https://bugs.webkit.org/show_bug.cgi?id=170022
+
+ Reviewed by Dean Jackson.
+
+ Test: fast/text/variations/font-loading-api-parse-ranges.html
+
+ Don't use keywords when reporting font variation range values.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
+ (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
+ (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
+ (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
+ (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
+ (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
+ * css/CSSComputedStyleDeclaration.h:
+ * css/FontFace.cpp:
+ (WebCore::FontFace::style):
+ (WebCore::FontFace::weight):
+ (WebCore::FontFace::stretch):
+
2017-03-27 Anders Carlsson <ander...@apple.com>
Propagate shipping contact update errors
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (214432 => 214433)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2017-03-27 21:49:09 UTC (rev 214432)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2017-03-27 22:09:14 UTC (rev 214433)
@@ -1917,11 +1917,16 @@
return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style);
}
+Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(FontSelectionValue weight)
+{
+ return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
+}
+
Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontWeightFromStyleValue(FontSelectionValue weight)
{
if (auto value = fontWeightKeyword(weight))
return CSSValuePool::singleton().createIdentifierValue(value.value());
- return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
+ return fontNonKeywordWeightFromStyleValue(weight);
}
static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
@@ -1929,11 +1934,16 @@
return ComputedStyleExtractor::fontWeightFromStyleValue(style.fontDescription().weight());
}
+Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(FontSelectionValue stretch)
+{
+ return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
+}
+
Ref<CSSPrimitiveValue> ComputedStyleExtractor::fontStretchFromStyleValue(FontSelectionValue stretch)
{
if (auto keyword = fontStretchKeyword(stretch))
return CSSValuePool::singleton().createIdentifierValue(keyword.value());
- return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
+ return fontNonKeywordStretchFromStyleValue(stretch);
}
static Ref<CSSPrimitiveValue> fontStretchFromStyle(const RenderStyle& style)
@@ -1941,11 +1951,16 @@
return ComputedStyleExtractor::fontStretchFromStyleValue(style.fontDescription().stretch());
}
+Ref<CSSFontStyleValue> ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(FontSelectionValue italic)
+{
+ return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
+}
+
Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(FontSelectionValue italic)
{
if (auto keyword = fontStyleKeyword(italic))
return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(keyword.value()));
- return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
+ return fontNonKeywordStyleFromStyleValue(italic);
}
static Ref<CSSFontStyleValue> fontStyleFromStyle(const RenderStyle& style)
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (214432 => 214433)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h 2017-03-27 21:49:09 UTC (rev 214432)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h 2017-03-27 22:09:14 UTC (rev 214433)
@@ -66,8 +66,11 @@
static Ref<CSSValue> valueForFilter(const RenderStyle&, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
+ static Ref<CSSPrimitiveValue> fontNonKeywordWeightFromStyleValue(FontSelectionValue);
static Ref<CSSPrimitiveValue> fontWeightFromStyleValue(FontSelectionValue);
+ static Ref<CSSPrimitiveValue> fontNonKeywordStretchFromStyleValue(FontSelectionValue);
static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue);
+ static Ref<CSSFontStyleValue> fontNonKeywordStyleFromStyleValue(FontSelectionValue);
static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue);
private:
Modified: trunk/Source/WebCore/css/FontFace.cpp (214432 => 214433)
--- trunk/Source/WebCore/css/FontFace.cpp 2017-03-27 21:49:09 UTC (rev 214432)
+++ trunk/Source/WebCore/css/FontFace.cpp 2017-03-27 22:09:14 UTC (rev 214433)
@@ -294,17 +294,21 @@
if (minimum.get().equals(maximum.get()))
return minimum->cssText();
- ASSERT(minimum->fontStyleValue->valueID() == CSSValueOblique);
- ASSERT(maximum->fontStyleValue->valueID() == CSSValueOblique);
+ auto minimumNonKeyword = ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(style.minimum);
+ auto maximumNonKeyword = ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue(style.maximum);
+ ASSERT(minimumNonKeyword->fontStyleValue->valueID() == CSSValueOblique);
+ ASSERT(maximumNonKeyword->fontStyleValue->valueID() == CSSValueOblique);
+
StringBuilder builder;
- builder.append(minimum->fontStyleValue->cssText());
+ builder.append(minimumNonKeyword->fontStyleValue->cssText());
builder.append(' ');
if (minimum->obliqueValue.get() == maximum->obliqueValue.get())
- builder.append(minimum->obliqueValue->cssText());
+ builder.append(minimumNonKeyword->obliqueValue->cssText());
else {
- builder.append(minimum->obliqueValue->cssText());
- builder.append(maximum->obliqueValue->cssText());
+ builder.append(minimumNonKeyword->obliqueValue->cssText());
+ builder.append(' ');
+ builder.append(maximumNonKeyword->obliqueValue->cssText());
}
return builder.toString();
}
@@ -320,10 +324,13 @@
if (minimum.get().equals(maximum.get()))
return minimum->cssText();
+ auto minimumNonKeyword = ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(weight.minimum);
+ auto maximumNonKeyword = ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue(weight.maximum);
+
StringBuilder builder;
- builder.append(minimum->cssText());
+ builder.append(minimumNonKeyword->cssText());
builder.append(' ');
- builder.append(maximum->cssText());
+ builder.append(maximumNonKeyword->cssText());
return builder.toString();
}
@@ -338,10 +345,13 @@
if (minimum.get().equals(maximum.get()))
return minimum->cssText();
+ auto minimumNonKeyword = ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(stretch.minimum);
+ auto maximumNonKeyword = ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue(stretch.maximum);
+
StringBuilder builder;
- builder.append(minimum->cssText());
+ builder.append(minimumNonKeyword->cssText());
builder.append(' ');
- builder.append(maximum->cssText());
+ builder.append(maximumNonKeyword->cssText());
return builder.toString();
}