Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Implement font-synthesis longhand properties
https://bugs.webkit.org/show_bug.cgi?id=232009 rdar://84706153 Reviewed by Tim Nguyen. Adding support for font-synthesis longhand properties: - font-synthesis-weight - font-synthesis-style - font-synthesis-small-caps Refactoring font-synthesis shorthand so it is implemented by using its longhands. * LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt: * LayoutTests/fast/css/getComputedStyle/computed-style-font-family-expected.txt: * LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * LayoutTests/fast/css/getComputedStyle/resources/property-names.js: * LayoutTests/fast/css3-text/font-synthesis-parse-expected.txt: * LayoutTests/fast/css3-text/font-synthesis-parse.html: * LayoutTests/imported/w3c/resources/import-expectations.json: * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-computed.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-invalid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-invalid.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-small-caps-invalid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-small-caps-invalid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-small-caps-valid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-small-caps-valid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-style-invalid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-style-invalid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-style-valid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-style-valid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-weight-invalid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-weight-invalid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-weight-valid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-synthesis-weight-valid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-in-animation-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt: * LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: * LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt: * LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt: * LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt: * LayoutTests/svg/css/getComputedStyle-basic-expected.txt: * Source/WebCore/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * Source/WebCore/css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator FontSynthesisLonghandValue const): * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/CSSSegmentedFontFace.cpp: (WebCore::CSSSegmentedFontFace::fontRanges): * Source/WebCore/css/ComputedStyleExtractor.cpp: (WebCore::fontSynthesisFromStyle): (WebCore::fontSynthesisLonghandToCSSValue): (WebCore::fontSynthesisWeightFromStyle): (WebCore::fontSynthesisStyleFromStyle): (WebCore::fontSynthesisSmallCapsFromStyle): (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * Source/WebCore/css/StyleProperties.cpp: (WebCore::isCSSWideValueIDKeyword): (WebCore::StyleProperties::getPropertyValue const): (WebCore::StyleProperties::fontSynthesisValue const): * Source/WebCore/css/StyleProperties.h: * Source/WebCore/css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::consumeFontSynthesis): (WebCore::consumeFontSynthesisLonghand): (WebCore::CSSPropertyParser::parseSingleValue): (WebCore::CSSPropertyParser::parseShorthand): (WebCore::consumeFontSynthesis): Deleted. * Source/WebCore/css/parser/CSSPropertyParser.h: * Source/WebCore/platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::collectComplexTextRuns): * Source/WebCore/platform/graphics/FontCascadeCache.h: (WebCore::FontDescriptionKey::makeFlagsKey): * Source/WebCore/platform/graphics/FontCascadeDescription.h: (WebCore::FontCascadeDescription::initialFontSynthesisWeight): (WebCore::FontCascadeDescription::initialFontSynthesisStyle): (WebCore::FontCascadeDescription::initialFontSynthesisSmallCaps): (WebCore::FontCascadeDescription::initialFontSynthesis): Deleted. * Source/WebCore/platform/graphics/FontDescription.cpp: * Source/WebCore/platform/graphics/FontDescription.h: (WebCore::FontDescription::fontSynthesisWeight const): (WebCore::FontDescription::fontSynthesisStyle const): (WebCore::FontDescription::fontSynthesisSmallCaps const): (WebCore::FontDescription::hasAutoFontSynthesisWeight const): (WebCore::FontDescription::hasAutoFontSynthesisStyle const): (WebCore::FontDescription::hasAutoFontSynthesisSmallCaps const): (WebCore::FontDescription::setFontSynthesisWeight): (WebCore::FontDescription::setFontSynthesisStyle): (WebCore::FontDescription::setFontSynthesisSmallCaps): (WebCore::FontDescription::operator== const): (WebCore::FontDescription::encode const): (WebCore::FontDescription::decode): (WebCore::FontDescription::fontSynthesis const): Deleted. (WebCore::FontDescription::setFontSynthesis): Deleted. * Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::computeNecessarySynthesis): * Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::getFontPropertiesFromPattern): * Source/WebCore/platform/text/TextFlags.h: (): Deleted. * Source/WebCore/style/PropertyAllowlist.cpp: (WebCore::Style::isValidMarkerStyleProperty): * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertFontSynthesis): Deleted. * Source/WebInspectorUI/UserInterface/External/CSSDocumentation/CSSDocumentation-overrides.json: * Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js: Canonical link: https://commits.webkit.org/255171@main
- Loading branch information
1 parent
8b7eb55
commit b483b294a91df986fc660018ab160ed799be28ab
Showing
59 changed files
with
523 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
|
||
PASS e.style['font-synthesis'] = "auto" should not set the property value | ||
PASS e.style['font-synthesis'] = "none weight" should not set the property value | ||
PASS e.style['font-synthesis'] = "none style" should not set the property value | ||
PASS e.style['font-synthesis'] = "style none" should not set the property value | ||
PASS e.style['font-synthesis'] = "none small-caps" should not set the property value | ||
PASS e.style['font-synthesis'] = "small-caps none" should not set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS e.style['font-synthesis-small-caps'] = "normal" should not set the property value | ||
PASS e.style['font-synthesis-small-caps'] = "auto none" should not set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Fonts Module Level 4: parsing font-synthesis-small-caps with invalid values</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-small-caps"> | ||
<meta name="assert" content="font-synthesis-small-caps supports only the grammar 'auto | none'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_invalid_value('font-synthesis-small-caps', 'normal'); | ||
test_invalid_value('font-synthesis-small-caps', 'auto none'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS e.style['font-synthesis-small-caps'] = "auto" should set the property value | ||
PASS e.style['font-synthesis-small-caps'] = "none" should set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Fonts Module Level 4: parsing font-synthesis-small-caps with valid values</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-small-caps"> | ||
<meta name="assert" content="font-synthesis-small-caps supports the full grammar 'auto | none'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_valid_value('font-synthesis-small-caps', 'auto'); | ||
test_valid_value('font-synthesis-small-caps', 'none'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS e.style['font-synthesis-style'] = "normal" should not set the property value | ||
PASS e.style['font-synthesis-style'] = "auto none" should not set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Fonts Module Level 4: parsing font-synthesis-style with invalid values</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-style"> | ||
<meta name="assert" content="font-synthesis-style supports only the grammar 'auto | none'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_invalid_value('font-synthesis-style', 'normal'); | ||
test_invalid_value('font-synthesis-style', 'auto none'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS e.style['font-synthesis-style'] = "auto" should set the property value | ||
PASS e.style['font-synthesis-style'] = "none" should set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Fonts Module Level 4: parsing font-synthesis-style with valid values</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-style"> | ||
<meta name="assert" content="font-synthesis-style supports the full grammar 'auto | none'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_valid_value('font-synthesis-style', 'auto'); | ||
test_valid_value('font-synthesis-style', 'none'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS e.style['font-synthesis-weight'] = "normal" should not set the property value | ||
PASS e.style['font-synthesis-weight'] = "auto none" should not set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Fonts Module Level 4: parsing font-synthesis-weight with invalid values</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-weight"> | ||
<meta name="assert" content="font-synthesis-weight supports only the grammar 'auto | none'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_invalid_value('font-synthesis-weight', 'normal'); | ||
test_invalid_value('font-synthesis-weight', 'auto none'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS e.style['font-synthesis-weight'] = "auto" should set the property value | ||
PASS e.style['font-synthesis-weight'] = "none" should set the property value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Fonts Module Level 4: parsing font-synthesis-weight with valid values</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-weight"> | ||
<meta name="assert" content="font-synthesis-weight supports the full grammar 'auto | none'."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/parsing-testcommon.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test_valid_value('font-synthesis-weight', 'auto'); | ||
test_valid_value('font-synthesis-weight', 'none'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.