Unify font-variant-* with font-variant shorthand
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Dec 2015 04:08:41 +0000 (04:08 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Dec 2015 04:08:41 +0000 (04:08 +0000)
commit576dc068bafeb3e665d11c37caaf7e5830761a46
tree8c14c177c34b4a6542440601b8ea409cf74092bf
parentd247eb01e37c86a603d7b1225f30e9436f148d48
Unify font-variant-* with font-variant shorthand
https://bugs.webkit.org/show_bug.cgi?id=149773

Reviewed by Darin Adler.

Source/WebCore:

This patch makes font-variant a shorthand for the following properties:
font-variant-ligatures
font-variant-position
font-variant-caps
font-variant-numeric
font-variant-alternates
font-variant-east-asian

This is consistent with the CSS Fonts Level 3 spec.

This patch also migrates the "font" longhand to use the font-variant-caps
property.

Test: fast/text/font-variant-shorthand.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::fontVariantEastAsianPropertyValue): Rename FontVariantEastAsian values.
(WebCore::fontVariantFromStyle): We must consult with the longhand properties to determine
font-variant computed style.
(WebCore::ComputedStyleExtractor::propertyValue): Don't put any-old font-variant-caps inside
the font shorthand.
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule): Guard against incorrect downcasts (due to inherit
of the new shorthand property).
* css/CSSParser.cpp: Parse font-variant as a shorthand. Also implement its "normal" and "none" values.
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFont):
(WebCore::CSSParser::parseSystemFont):
(WebCore::CSSParser::parseFontVariantLigatures):
(WebCore::CSSParser::parseFontVariantNumeric):
(WebCore::CSSParser::parseFontVariantEastAsian):
(WebCore::CSSParser::parseFontVariant):
(WebCore::isValidKeywordPropertyAndValue): Deleted.
(WebCore::isKeywordPropertyID): Deleted.
* css/CSSParser.h:
* css/CSSPropertyNames.in: Turn font-variant into a shorthand property.
* css/FontVariantBuilder.h: Guard against incorrect downcasts. Also update for renamed
FontVariantEastAsian type.
(WebCore::applyValueFontVariantLigatures):
(WebCore::applyValueFontVariantNumeric):
(WebCore::applyValueFontVariantEastAsian):
* css/StyleProperties.cpp: Update to use the more specific property.
(WebCore::StyleProperties::appendFontLonghandValueIfExplicit):
(WebCore::StyleProperties::fontValue):
(WebCore::StyleProperties::asText):
* css/StyleResolver.cpp: Ditto.
(WebCore::StyleResolver::isValidCueStyleProperty):
* editing/EditingStyle.cpp: Ditto.
* editing/cocoa/HTMLConverter.mm: Ditto.
(HTMLConverterCaches::propertyValueForNode):
(HTMLConverter::computedAttributesForElement):
* editing/ios/EditorIOS.mm: Ditto.
(WebCore::Editor::removeUnchangeableStyles):
* html/canvas/CanvasRenderingContext2D.cpp: Ditto.
(WebCore::CanvasRenderingContext2D::font):
(WebCore::CanvasRenderingContext2D::setFont):
* platform/graphics/FontCache.h: Removing duplicate cache key value.
(WebCore::FontDescriptionKey::makeFlagsKey):
* platform/graphics/FontCascade.cpp: Migrate to the new font-variant-caps from the old member variable.
(WebCore::FontCascade::glyphDataForCharacter):
* platform/graphics/FontCascade.h: Ditto.
(WebCore::FontCascade::isSmallCaps):
* platform/graphics/FontDescription.cpp: Ditto.
(WebCore::FontDescription::FontDescription):
* platform/graphics/FontDescription.h: Ditto.
(WebCore::FontCascadeDescription::equalForTextAutoSizing):
(WebCore::FontDescription::smallCaps): Deleted.
(WebCore::FontDescription::setSmallCaps): Deleted.
(WebCore::FontDescription::setIsSmallCaps): Deleted.
(WebCore::FontDescription::operator==): Deleted.
* platform/graphics/cocoa/FontCacheCoreText.cpp: Rename FontVariantEastAsianWidth.
(WebCore::computeFeatureSettingsFromVariants):
* platform/text/TextFlags.h: Ditto.
(WebCore::FontVariantSettings::operator==):
* rendering/RenderText.cpp: Migrage to the new font-variant-caps from the old member variable.
(WebCore::RenderText::widthFromCache):

LayoutTests:

Update tests. Also temporarily skip existing font-features tests until
https://bugs.webkit.org/show_bug.cgi?id=149774 is fixed.

* css3/font-variant-parsing-expected.txt:
* css3/font-variant-parsing.html:
* fast/css/font-property-priority-expected.txt:
* fast/css/font-shorthand-expected.txt:
* fast/css/parsing-font-variant-ligatures-expected.txt:
* fast/css/parsing-font-variant-ligatures.html:
* fast/inspector-support/style-expected.txt:
* fast/text/font-variant-shorthand-expected.txt: Added.
* fast/text/font-variant-shorthand.html: Added.
* platform/mac/TestExpectations:
* platform/mac/fast/writing-mode/broken-ideograph-small-caps-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/font-variant-parsing-expected.txt
LayoutTests/css3/font-variant-parsing.html
LayoutTests/fast/css/font-property-priority-expected.txt
LayoutTests/fast/css/font-shorthand-expected.txt
LayoutTests/fast/css/parsing-font-variant-ligatures-expected.txt
LayoutTests/fast/css/parsing-font-variant-ligatures.html
LayoutTests/fast/inspector-support/style-expected.txt
LayoutTests/fast/text/font-variant-shorthand-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/font-variant-shorthand.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/fast/writing-mode/broken-ideograph-small-caps-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/FontVariantBuilder.h
Source/WebCore/css/StyleProperties.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/text/TextFlags.h
Source/WebCore/rendering/RenderText.cpp