Parse font-variation-settings
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2016 21:59:15 +0000 (21:59 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2016 21:59:15 +0000 (21:59 +0000)
commit0ced262e31d4f1e369b60445ff085b706ac6a994
tree53d20fcfc86b934d2975fda1e9f0f555524604f5
parent419f28c6407f132328c7db1c7e6e9e73917aa530
Parse font-variation-settings
https://bugs.webkit.org/show_bug.cgi?id=162781

Reviewed by Simon Fraser.

Source/WebCore:

CSS Fonts level 4 [1] details the font-variation-settings property which allows variations
to be applied to fonts which accept it. The property accepts a list of key/value
pairs where the keys are four-character Ascii codes and the values are floating
point values. The implementation uses font-feature-settings as a model, but with one
big difference: font-variation-settings can be animated. The set of variation points
are animated individually.

This font variations work is being done behind a run-time switch, which is settable from
the Safari Develop menu.

Now that FontDescription is growing, I'd like to do an investigation into the possibility of
moving some of the rare pieces of it into their own class to reduce memory. However, upon
advice, this investigation will be fairly involved and should be done in its own bug.

Test: fast/text/variations/getComputedStyle.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSAllInOne.cpp:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSFontVariationValue.cpp: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp.
(WebCore::CSSFontVariationValue::CSSFontVariationValue):
(WebCore::CSSFontVariationValue::customCSSText):
(WebCore::CSSFontVariationValue::equals):
* css/CSSFontVariationValue.h: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp.
* css/CSSPropertyNames.in:
* css/CSSValue.cpp:
(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isFontVariationValue):
(WebCore::CSSValue::isFontFeatureValue): Deleted.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontVariationSettings):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialFontVariationSettings):
(WebCore::StyleBuilderCustom::applyInheritFontVariationSettings):
(WebCore::StyleBuilderCustom::applyInheritFontFeatureSettings): Deleted.
* css/parser/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFontFeatureSettings):
(WebCore::CSSParser::parseFontVariationTag):
(WebCore::CSSParser::parseFontVariationSettings):
* css/parser/CSSParser.h:
* css/parser/CSSParserMode.h:
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::FontDescriptionKey):
(WebCore::FontDescriptionKey::operator==):
(WebCore::FontDescriptionKey::computeHash):
* platform/graphics/FontDescription.cpp:
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::variationSettings):
(WebCore::FontDescription::setVariationSettings):
(WebCore::FontDescription::operator==):
(WebCore::FontDescription::featureSettings): Deleted.
(WebCore::FontDescription::setFeatureSettings): Deleted.
* platform/graphics/FontTaggedSettings.cpp:
(WebCore::FontVariationSettings::hash):
(WebCore::operator<<):
* platform/graphics/FontTaggedSettings.h:

LayoutTests:

* fast/text/variations/getComputedStyle-expected.txt: Added.
* fast/text/variations/getComputedStyle.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/variations/getComputedStyle-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/variations/getComputedStyle.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSAllInOne.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSFontVariationValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSFontVariationValue.h [new file with mode: 0644]
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/parser/CSSParser.cpp
Source/WebCore/css/parser/CSSParser.h
Source/WebCore/css/parser/CSSParserMode.h
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/FontTaggedSettings.cpp
Source/WebCore/platform/graphics/FontTaggedSettings.h