[Web Animations] Interpolation between font-styles with a keyword value should be...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2018 22:23:25 +0000 (22:23 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2018 22:23:25 +0000 (22:23 +0000)
commitd23be0a78f5d25014a08f1a42ed9ec34b87bf415
treec412c6d501ce50516d3ce9be39edd6cc32aa4378
parent2d3ace8563bc12ab843edfe572fdaa5e838d7561
[Web Animations] Interpolation between font-styles with a keyword value should be discrete
https://bugs.webkit.org/show_bug.cgi?id=187722

Reviewed by Myles Maxfield.

LayoutTests/imported/w3c:

Mark some WPT progressions.

* web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt:

Source/WebCore:

Animating between "font-style: normal" or "font-style: oblique" and any another value should yield a discrete
interpolation where the from-value is used from 0 and up to (but excluding) 0.5, and the to-value from 0.5 to 1.

In order to be able to detect the "normal" value, we make the "slope" of a FontSelectionRequest an optional type
where the std::nullopt value indicates "normal" and other values an "oblique" value. Since we also need to
distinguish the "italic" value from an "oblique" value, we implement a custom PropertyWrapper for the "font-style"
property where we ensure the fontStyleAxis property of the font description matches the value we're blending to.
Indeed, in the case where we may animate from "normal" to "italic", the fontStyleAxis on the blended style would
remain "slnt" since it is the base value for "normal".

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::hasPlainText const):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
* css/CSSComputedStyleDeclaration.h:
* css/CSSFontFace.cpp:
(WebCore::calculateItalicRange):
* css/CSSFontFaceSet.cpp:
(WebCore::computeFontSelectionRequest):
* css/FontSelectionValueInlines.h:
(WebCore::fontStyleKeyword):
(WebCore::fontStyleValue): Deleted.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontStyleFromValue):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore::PropertyWrapperFontStyle::PropertyWrapperFontStyle):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::computeHash const):
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::italic const):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::italic const):
(WebCore::FontDescription::setItalic):
(WebCore::FontDescription::setIsItalic):
(WebCore::FontCascadeDescription::initialItalic):
* platform/graphics/FontSelectionAlgorithm.cpp:
(WebCore::FontSelectionAlgorithm::styleDistance const):
* platform/graphics/FontSelectionAlgorithm.h:
(WebCore::isItalic):
(WebCore::FontSelectionRequest::tied const):
(WebCore::operator<<): Implement the required stream operator.
(WebCore::operator==): Mark this function as inline instead of constexpr since tied() is no longer constexpr
due to taking an std::optional<>.
(WebCore::operator!=):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::createFontPlatformData):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setFontItalic):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::fontItalic const):

Source/WebKitLegacy/win:

Use isItalic() since that function knows how to handle an std::optional<FontSelectionValue>.

* DOMCoreClasses.cpp:
(DOMElement::font):

LayoutTests:

Mark some WPT progressions.

* platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt:
* platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt:
* platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt:
* platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt
LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt
LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt
LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt
LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt
LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt
LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt
LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt
LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt
LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.h
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontFaceSet.cpp
Source/WebCore/css/FontSelectionValueInlines.h
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp
Source/WebCore/platform/graphics/FontSelectionAlgorithm.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/DOMCoreClasses.cpp