Ignore:
Timestamp:
Sep 30, 2016, 2:59:15 PM (9 years ago)
Author:
[email protected]
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSValue.cpp

    r206603 r206679  
    4444#include "CSSFontFeatureValue.h"
    4545#include "CSSFontValue.h"
     46#include "CSSFontVariationValue.h"
    4647#include "CSSFunctionValue.h"
    4748#include "CSSGradientValue.h"
     
    177178        case FontFeatureClass:
    178179            return compareCSSValues<CSSFontFeatureValue>(*this, other);
     180        case FontVariationClass:
     181            return compareCSSValues<CSSFontVariationValue>(*this, other);
    179182        case FunctionClass:
    180183            return compareCSSValues<CSSFunctionValue>(*this, other);
     
    283286    case FontFeatureClass:
    284287        return downcast<CSSFontFeatureValue>(*this).customCSSText();
     288    case FontVariationClass:
     289        return downcast<CSSFontVariationValue>(*this).customCSSText();
    285290    case FunctionClass:
    286291        return downcast<CSSFunctionValue>(*this).customCSSText();
     
    397402        delete downcast<CSSFontFeatureValue>(this);
    398403        return;
     404    case FontVariationClass:
     405        delete downcast<CSSFontVariationValue>(this);
     406        return;
    399407    case FunctionClass:
    400408        delete downcast<CSSFunctionValue>(this);
Note: See TracChangeset for help on using the changeset viewer.