Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implement font-optical-sizing
https://bugs.webkit.org/show_bug.cgi?id=168895 Reviewed by Dean Jackson. Source/WebCore: Upon advice from Microsoft, the only input to optical sizing is just the font-size computed value. It is implemented by setting the 'opsz' font variation axis. Because the propery has such a simple grammar, the implementation is quite straightforward. Test: fast/text/variations/optical-sizing.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::propertyValue): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator FontOpticalSizing): * css/CSSProperties.json: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * platform/graphics/FontCache.h: (WebCore::FontDescriptionKey::makeFlagsKey): * platform/graphics/FontDescription.h: (WebCore::FontDescription::opticalSizing): (WebCore::FontDescription::setOpticalSizing): (WebCore::FontDescription::operator==): (WebCore::FontCascadeDescription::initialOpticalSizing): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::fontWithFamily): (WebCore::FontCache::createFontPlatformData): (WebCore::FontCache::systemFallbackForCharacters): * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): * platform/text/TextFlags.h: LayoutTests: * fast/text/variations/optical-sizing-expected.txt: Added. * fast/text/variations/optical-sizing.html: Added. Canonical link: https://commits.webkit.org/186989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
14 changed files
with
242 additions
and
60 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
23 changes: 23 additions & 0 deletions
23
LayoutTests/fast/text/variations/optical-sizing-expected.txt
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,23 @@ | ||
This test makes sure that font-optical-sizing works as expected. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-optical-sizing') is "auto" | ||
PASS window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-optical-sizing') is "auto" | ||
PASS window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-optical-sizing') is "auto" | ||
PASS window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-optical-sizing') is "none" | ||
PASS window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-optical-sizing') is "none" | ||
PASS document.getElementById('test1').style.fontOpticalSizing is "" | ||
PASS document.getElementById('test2').style.fontOpticalSizing is "initial" | ||
PASS document.getElementById('test3').style.fontOpticalSizing is "auto" | ||
PASS document.getElementById('test4').style.fontOpticalSizing is "none" | ||
PASS document.getElementById('test5').style.fontOpticalSizing is "inherit" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Hello | ||
Hello | ||
Hello | ||
Hello | ||
Hello |
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,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../../resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<div id="test1">Hello</div> | ||
<div id="test2" style="font-optical-sizing: initial;">Hello</div> | ||
<div id="test3" style="font-optical-sizing: auto;">Hello</div> | ||
<div id="test4" style="font-optical-sizing: none;">Hello</div> | ||
<div style="font-optical-sizing: none;"><div id="test5" style="font-optical-sizing: inherit;">Hello</div></div> | ||
|
||
<script> | ||
description("This test makes sure that font-optical-sizing works as expected."); | ||
|
||
shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).getPropertyValue('font-optical-sizing')", "auto"); | ||
shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).getPropertyValue('font-optical-sizing')", "auto"); | ||
shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).getPropertyValue('font-optical-sizing')", "auto"); | ||
shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).getPropertyValue('font-optical-sizing')", "none"); | ||
shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).getPropertyValue('font-optical-sizing')", "none"); | ||
|
||
shouldBeEqualToString("document.getElementById('test1').style.fontOpticalSizing", ""); | ||
shouldBeEqualToString("document.getElementById('test2').style.fontOpticalSizing", "initial"); | ||
shouldBeEqualToString("document.getElementById('test3').style.fontOpticalSizing", "auto"); | ||
shouldBeEqualToString("document.getElementById('test4').style.fontOpticalSizing", "none"); | ||
shouldBeEqualToString("document.getElementById('test5').style.fontOpticalSizing", "inherit"); | ||
</script> | ||
|
||
<script src="../../../resources/js-test-post.js"></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
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
Oops, something went wrong.