font-style needs a new CSSValue to make CSSRule.cssText work correctly
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Mar 2017 18:23:48 +0000 (18:23 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Mar 2017 18:23:48 +0000 (18:23 +0000)
commit82c2b2f06f7c7abe36050b54e1ebb32fc0934d13
tree857904699191100262bb16b99279414296aa1d56
parentf405c40bc6e708969f5eeac16addfd1f7bfcbcc8
font-style needs a new CSSValue to make CSSRule.cssText work correctly
https://bugs.webkit.org/show_bug.cgi?id=169258

Reviewed by David Hyatt.

Source/WebCore:

With variation fonts, font-style's value can't be captured in a CSSPrimitiveValue (nor any other subclass
off CSSValue) any more. Instead, we need to create two new CSSValues which represent the grammar that font-
style and it's associated @font-face descriptor accept.

The grammar of the font-style property is "normal | italic | oblique [ <<angle>> ]?"
The grammar of the font-style descriptor is "normal | italic | oblique [ <<angle>> | <<angle>> <<angle>> ]?"

We currently still support numbers in place of the <<angle>> value (contrary to the spec). We will remove
this support in https://bugs.webkit.org/show_bug.cgi?id=169357.

Tests: fast/text/font-selection-font-face-parse.html:
       fast/text/font-style-parse.html:

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSAllInOne.cpp:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::fontStyleFromStyle):
(WebCore::fontShorthandValueForSelectionProperties):
* css/CSSFontFace.cpp:
(WebCore::calculateWeightRange):
(WebCore::calculateStretchRange):
(WebCore::calculateItalicRange):
* css/CSSFontFaceSet.cpp:
(WebCore::computeFontSelectionRequest):
(WebCore::CSSFontFaceSet::matchingFaces):
(WebCore::calculateWeightValue): Deleted.
(WebCore::calculateStretchValue): Deleted.
(WebCore::calculateStyleValue): Deleted.
* css/CSSFontFaceSet.h:
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/CSSFontStyleRangeValue.cpp: Added.
(WebCore::CSSFontStyleRangeValue::customCSSText):
(WebCore::CSSFontStyleRangeValue::equals):
* css/CSSFontStyleRangeValue.h: Added.
* css/CSSFontStyleValue.cpp: Added.
(WebCore::CSSFontStyleValue::customCSSText):
(WebCore::CSSFontStyleValue::equals):
* css/CSSFontStyleValue.h: Added.
* css/CSSFontValue.cpp:
(WebCore::CSSFontValue::customCSSText):
* css/CSSFontValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::equals):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isFontStyleValue):
(WebCore::CSSValue::isFontStyleRangeValue):
* css/FontFace.cpp:
(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontWeightFromValue):
(WebCore::StyleBuilderConverter::convertFontStretchFromValue):
(WebCore::StyleBuilderConverter::convertFontStyleFromValue):
(WebCore::StyleBuilderConverter::convertFontWeight):
(WebCore::StyleBuilderConverter::convertFontStretch):
(WebCore::StyleBuilderConverter::convertFontStyle):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontStyle):
(WebCore::consumeFontStyleRange):
(WebCore::CSSPropertyParser::consumeSystemFont):
(WebCore::CSSPropertyParser::consumeFont):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::parseAttribute):

LayoutTests:

Update tests' expected results.

* fast/text/font-selection-font-face-parse-expected.txt:
* fast/text/font-selection-font-face-parse.html:
* fast/text/font-style-parse-expected.txt:
* fast/text/font-style-parse.html:
* platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/font-selection-font-face-parse-expected.txt
LayoutTests/fast/text/font-selection-font-face-parse.html
LayoutTests/fast/text/font-style-parse-expected.txt
LayoutTests/fast/text/font-style-parse.html
LayoutTests/platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
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/CSSFontFace.cpp
Source/WebCore/css/CSSFontFaceSet.cpp
Source/WebCore/css/CSSFontFaceSet.h
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSFontStyleRangeValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSFontStyleRangeValue.h [new file with mode: 0644]
Source/WebCore/css/CSSFontStyleValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSFontStyleValue.h [new file with mode: 0644]
Source/WebCore/css/CSSFontValue.cpp
Source/WebCore/css/CSSFontValue.h
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/FontFace.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/parser/CSSPropertyParser.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/svg/SVGFontFaceElement.cpp