Title: [233935] trunk
Revision
233935
Author
grao...@webkit.org
Date
2018-07-18 15:23:25 -0700 (Wed, 18 Jul 2018)

Log Message

[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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233934 => 233935)


--- trunk/LayoutTests/ChangeLog	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/ChangeLog	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1,3 +1,19 @@
+2018-07-18  Antoine Quint  <grao...@apple.com>
+
+        [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.
+
+        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:
+
 2018-07-18  Jer Noble  <jer.no...@apple.com>
 
         PiP from Element Fullscreen should match AVKit's behavior

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (233934 => 233935)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1,3 +1,14 @@
+2018-07-18  Antoine Quint  <grao...@apple.com>
+
+        [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.
+
+        Mark some WPT progressions.
+
+        * web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt:
+
 2018-07-17  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Interpolation between lengths with an "auto" value should be discrete

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt (233934 => 233935)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1,7 +1,7 @@
 
-FAIL Test animating discrete values assert_equals: Animation produces 'from' value just before the middle of the interval expected "normal" but got "oblique 9.75deg"
+PASS Test animating discrete values 
 PASS Test discrete animation is used when interpolation fails 
 PASS Test discrete animation is used only for pairs of values that cannot be interpolated 
-FAIL Test the 50% switch point for discrete animation is based on the effect easing assert_equals: Animation produces 'from' value at 94% of the iteration time expected "normal" but got "oblique 8.5deg"
-FAIL Test the 50% switch point for discrete animation is based on the keyframe easing assert_equals: Animation produces 'from' value at 94% of the iteration time expected "normal" but got "oblique 8.5deg"
+PASS Test the 50% switch point for discrete animation is based on the effect easing 
+PASS Test the 50% switch point for discrete animation is based on the keyframe easing 
 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -134,7 +134,7 @@
 FAIL font-stretch uses font-stretch behavior for composite type accumulate assert_equals: The value should be normal at 0ms expected "normal" but got "expanded"
 PASS font-style (type: discrete) has testAccumulation function 
 PASS font-style: "oblique" onto "italic" 
-FAIL font-style: "italic" onto "oblique" assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style: "italic" onto "oblique" 
 PASS font-variation-settings (type: fontVariationSettings) has testAccumulation function 
 FAIL font-variation-settings with composite type accumulate assert_equals: The value should be "wght" 2.2 at 250ms expected "\"wght\" 2.2" but got "\"wght\" 1.2"
 PASS font-variation-settings (type: discrete) has testAccumulation function 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -134,7 +134,7 @@
 FAIL font-stretch uses font-stretch behavior for composite type add assert_equals: The value should be normal at 0ms expected "normal" but got "expanded"
 PASS font-style (type: discrete) has testAddition function 
 PASS font-style: "oblique" onto "italic" 
-FAIL font-style: "italic" onto "oblique" assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style: "italic" onto "oblique" 
 PASS font-variation-settings (type: fontVariationSettings) has testAddition function 
 FAIL font-variation-settings with composite type add assert_equals: The value should be "wght" 2.2 at 250ms expected "\"wght\" 2.2" but got "\"wght\" 1.2"
 PASS font-variation-settings (type: discrete) has testAddition function 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -157,9 +157,9 @@
 FAIL font-stretch supports animating as a font-stretch (adjacent values) assert_equals: The value should be ultra-condensed at 499ms expected "ultra-condensed" but got "56%"
 PASS font-stretch supports animating as a font-stretch (between value) 
 PASS font-style (type: discrete) has testInterpolation function 
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with linear easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with effect easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with keyframe easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with linear easing 
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with effect easing 
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with keyframe easing 
 PASS font-variation-settings (type: fontVariationSettings) has testInterpolation function 
 PASS font-variation-settings supports animation as float 
 PASS font-variation-settings supports animation as float with multiple tags 

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -134,7 +134,7 @@
 FAIL font-stretch uses font-stretch behavior for composite type accumulate assert_equals: The value should be normal at 0ms expected "normal" but got "expanded"
 PASS font-style (type: discrete) has testAccumulation function 
 PASS font-style: "oblique" onto "italic" 
-FAIL font-style: "italic" onto "oblique" assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style: "italic" onto "oblique" 
 PASS font-variation-settings (type: fontVariationSettings) has testAccumulation function 
 FAIL font-variation-settings with composite type accumulate assert_equals: The value should be "wght" 2.2 at 250ms expected "\"wght\" 2.2" but got "\"wght\" 1.2"
 PASS font-variation-settings (type: discrete) has testAccumulation function 

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -134,7 +134,7 @@
 FAIL font-stretch uses font-stretch behavior for composite type add assert_equals: The value should be normal at 0ms expected "normal" but got "expanded"
 PASS font-style (type: discrete) has testAddition function 
 PASS font-style: "oblique" onto "italic" 
-FAIL font-style: "italic" onto "oblique" assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style: "italic" onto "oblique" 
 PASS font-variation-settings (type: fontVariationSettings) has testAddition function 
 FAIL font-variation-settings with composite type add assert_equals: The value should be "wght" 2.2 at 250ms expected "\"wght\" 2.2" but got "\"wght\" 1.2"
 PASS font-variation-settings (type: discrete) has testAddition function 

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -157,9 +157,9 @@
 FAIL font-stretch supports animating as a font-stretch (adjacent values) assert_equals: The value should be ultra-condensed at 499ms expected "ultra-condensed" but got "56%"
 PASS font-stretch supports animating as a font-stretch (between value) 
 PASS font-style (type: discrete) has testInterpolation function 
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with linear easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with effect easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with keyframe easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with linear easing 
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with effect easing 
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with keyframe easing 
 PASS font-variation-settings (type: fontVariationSettings) has testInterpolation function 
 PASS font-variation-settings supports animation as float 
 PASS font-variation-settings supports animation as float with multiple tags 

Modified: trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -134,7 +134,7 @@
 FAIL font-stretch uses font-stretch behavior for composite type accumulate assert_equals: The value should be normal at 0ms expected "normal" but got "expanded"
 PASS font-style (type: discrete) has testAccumulation function 
 PASS font-style: "oblique" onto "italic" 
-FAIL font-style: "italic" onto "oblique" assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style: "italic" onto "oblique" 
 PASS letter-spacing (type: length) has testAccumulation function 
 FAIL letter-spacing: length assert_equals: The value should be 20px at 0ms expected "20px" but got "10px"
 FAIL letter-spacing: length of rem assert_equals: The value should be 20px at 0ms expected "20px" but got "10px"

Modified: trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -134,7 +134,7 @@
 FAIL font-stretch uses font-stretch behavior for composite type add assert_equals: The value should be normal at 0ms expected "normal" but got "expanded"
 PASS font-style (type: discrete) has testAddition function 
 PASS font-style: "oblique" onto "italic" 
-FAIL font-style: "italic" onto "oblique" assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style: "italic" onto "oblique" 
 PASS letter-spacing (type: length) has testAddition function 
 FAIL letter-spacing: length assert_equals: The value should be 20px at 0ms expected "20px" but got "10px"
 FAIL letter-spacing: length of rem assert_equals: The value should be 20px at 0ms expected "20px" but got "10px"

Modified: trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt (233934 => 233935)


--- trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt	2018-07-18 22:23:25 UTC (rev 233935)
@@ -157,9 +157,9 @@
 FAIL font-stretch supports animating as a font-stretch (adjacent values) assert_equals: The value should be ultra-condensed at 499ms expected "ultra-condensed" but got "56%"
 PASS font-stretch supports animating as a font-stretch (between value) 
 PASS font-style (type: discrete) has testInterpolation function 
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with linear easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with effect easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
-FAIL font-style uses discrete animation when animating between "italic" and "oblique" with keyframe easing assert_equals: The value should be italic at 0ms expected "italic" but got "oblique"
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with linear easing 
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with effect easing 
+PASS font-style uses discrete animation when animating between "italic" and "oblique" with keyframe easing 
 PASS letter-spacing (type: length) has testInterpolation function 
 PASS letter-spacing supports animating as a length 
 PASS letter-spacing supports animating as a length of rem 

Modified: trunk/Source/WebCore/ChangeLog (233934 => 233935)


--- trunk/Source/WebCore/ChangeLog	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/ChangeLog	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1,3 +1,65 @@
+2018-07-18  Antoine Quint  <grao...@apple.com>
+
+        [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.
+
+        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):
+
 2018-07-18  Jer Noble  <jer.no...@apple.com>
 
         Unreviewed build fix after r233926; BOOL !== bool.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (233934 => 233935)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -3598,7 +3598,7 @@
 
     const RenderStyle& style = m_renderer->style();
     return style.fontDescription().weight() == normalWeightValue()
-        && style.fontDescription().italic() == normalItalicValue()
+        && !isItalic(style.fontDescription().italic())
         && style.textDecorationsInEffect().isEmpty();
 }
 

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (233934 => 233935)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -2036,11 +2036,11 @@
     return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueOblique), CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG));
 }
 
-Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(FontSelectionValue italic, FontStyleAxis fontStyleAxis)
+Ref<CSSFontStyleValue> ComputedStyleExtractor::fontStyleFromStyleValue(std::optional<FontSelectionValue> italic, FontStyleAxis fontStyleAxis)
 {
     if (auto keyword = fontStyleKeyword(italic, fontStyleAxis))
         return CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(keyword.value()));
-    return fontNonKeywordStyleFromStyleValue(italic);
+    return fontNonKeywordStyleFromStyleValue(italic.value());
 }
 
 static Ref<CSSFontStyleValue> fontStyleFromStyle(const RenderStyle& style)

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (233934 => 233935)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -73,7 +73,7 @@
     static Ref<CSSPrimitiveValue> fontNonKeywordStretchFromStyleValue(FontSelectionValue);
     static Ref<CSSPrimitiveValue> fontStretchFromStyleValue(FontSelectionValue);
     static Ref<CSSFontStyleValue> fontNonKeywordStyleFromStyleValue(FontSelectionValue);
-    static Ref<CSSFontStyleValue> fontStyleFromStyleValue(FontSelectionValue, FontStyleAxis);
+    static Ref<CSSFontStyleValue> fontStyleFromStyleValue(std::optional<FontSelectionValue>, FontStyleAxis);
 
 private:
     // The styled element is either the element passed into

Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (233934 => 233935)


--- trunk/Source/WebCore/css/CSSFontFace.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -202,7 +202,7 @@
 {
     if (value.isFontStyleValue()) {
         auto result = StyleBuilderConverter::convertFontStyleFromValue(value);
-        return { result, result };
+        return { result.value_or(normalItalicValue()), result.value_or(normalItalicValue()) };
     }
 
     ASSERT(value.isFontStyleRangeValue());

Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (233934 => 233935)


--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -312,9 +312,9 @@
     if (!styleValue)
         styleValue = CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
 
-    FontSelectionValue weightSelectionValue = StyleBuilderConverter::convertFontWeightFromValue(*weightValue);
-    FontSelectionValue stretchSelectionValue = StyleBuilderConverter::convertFontStretchFromValue(*stretchValue);
-    FontSelectionValue styleSelectionValue = StyleBuilderConverter::convertFontStyleFromValue(*styleValue);
+    auto weightSelectionValue = StyleBuilderConverter::convertFontWeightFromValue(*weightValue);
+    auto stretchSelectionValue = StyleBuilderConverter::convertFontStretchFromValue(*stretchValue);
+    auto styleSelectionValue = StyleBuilderConverter::convertFontStyleFromValue(*styleValue);
 
     return { weightSelectionValue, stretchSelectionValue, styleSelectionValue };
 }

Modified: trunk/Source/WebCore/css/FontSelectionValueInlines.h (233934 => 233935)


--- trunk/Source/WebCore/css/FontSelectionValueInlines.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/css/FontSelectionValueInlines.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -121,26 +121,13 @@
     }
 }
 
-inline std::optional<CSSValueID> fontStyleKeyword(FontSelectionValue style, FontStyleAxis axis)
+inline std::optional<CSSValueID> fontStyleKeyword(std::optional<FontSelectionValue> style, FontStyleAxis axis)
 {
-    if (style == normalItalicValue())
+    if (!style || style.value() == normalItalicValue())
         return CSSValueNormal;
-    if (style == italicValue())
+    if (style.value() == italicValue())
         return axis == FontStyleAxis::ital ? CSSValueItalic : CSSValueOblique;
     return std::nullopt;
 }
 
-inline std::optional<FontSelectionValue> fontStyleValue(CSSValueID value)
-{
-    switch (value) {
-    case CSSValueNormal:
-        return normalItalicValue();
-    case CSSValueOblique:
-    case CSSValueItalic:
-        return italicValue();
-    default:
-        return std::nullopt;
-    }
 }
-
-}

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (233934 => 233935)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -118,7 +118,7 @@
     static FontFeatureSettings convertFontFeatureSettings(StyleResolver&, const CSSValue&);
     static FontSelectionValue convertFontWeightFromValue(const CSSValue&);
     static FontSelectionValue convertFontStretchFromValue(const CSSValue&);
-    static FontSelectionValue convertFontStyleFromValue(const CSSValue&);
+    static std::optional<FontSelectionValue> convertFontStyleFromValue(const CSSValue&);
     static FontSelectionValue convertFontWeight(StyleResolver&, const CSSValue&);
     static FontSelectionValue convertFontStretch(StyleResolver&, const CSSValue&);
     static FontSelectionValue convertFontStyle(StyleResolver&, const CSSValue&);
@@ -1202,7 +1202,8 @@
     return normalStretchValue();
 }
 
-inline FontSelectionValue StyleBuilderConverter::convertFontStyleFromValue(const CSSValue& value)
+// The input value needs to parsed and valid, this function returns std::nullopt if the input was "normal".
+inline std::optional<FontSelectionValue> StyleBuilderConverter::convertFontStyleFromValue(const CSSValue& value)
 {
     ASSERT(is<CSSFontStyleValue>(value));
     const auto& fontStyleValue = downcast<CSSFontStyleValue>(value);
@@ -1209,7 +1210,7 @@
 
     auto valueID = fontStyleValue.fontStyleValue->valueID();
     if (valueID == CSSValueNormal)
-        return normalItalicValue();
+        return std::nullopt;
     if (valueID == CSSValueItalic)
         return italicValue();
     ASSERT(valueID == CSSValueOblique);

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (233934 => 233935)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -42,6 +42,7 @@
 #include "CalculationValue.h"
 #include "ClipPathOperation.h"
 #include "FloatConversion.h"
+#include "FontCascade.h"
 #include "FontSelectionAlgorithm.h"
 #include "FontTaggedSettings.h"
 #include "GapLength.h"
@@ -414,6 +415,11 @@
     return FontSelectionValue(blendFunc(anim, static_cast<float>(from), static_cast<float>(to), progress));
 }
 
+static inline std::optional<FontSelectionValue> blendFunc(const CSSPropertyBlendingClient* anim, std::optional<FontSelectionValue> from, std::optional<FontSelectionValue> to, double progress)
+{
+    return FontSelectionValue(blendFunc(anim, static_cast<float>(from.value()), static_cast<float>(to.value()), progress));
+}
+
 class AnimationPropertyWrapperBase {
     WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
     WTF_MAKE_FAST_ALLOCATED;
@@ -1439,6 +1445,42 @@
     void (RenderStyle::*m_setter)(const Color&);
 };
 
+class PropertyWrapperFontStyle : public PropertyWrapper<std::optional<FontSelectionValue>> {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    PropertyWrapperFontStyle()
+        : PropertyWrapper<std::optional<FontSelectionValue>>(CSSPropertyFontStyle, &RenderStyle::fontItalic, &RenderStyle::setFontItalic)
+    {
+    }
+
+    bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const override
+    {
+        return from->fontItalic() && to->fontItalic() && from->fontDescription().fontStyleAxis() == FontStyleAxis::slnt && to->fontDescription().fontStyleAxis() == FontStyleAxis::slnt;
+    }
+
+    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* from, const RenderStyle* to, double progress) const override
+    {
+        auto discrete = !canInterpolate(from, to);
+
+        auto blendedStyleAxis = FontStyleAxis::slnt;
+        if (discrete)
+            blendedStyleAxis = (progress < 0.5 ? from : to)->fontDescription().fontStyleAxis();
+
+        auto fromFontItalic = from->fontItalic();
+        auto toFontItalic = to->fontItalic();
+        auto blendedFontItalic = progress < 0.5 ? fromFontItalic : toFontItalic;
+        if (!discrete)
+            blendedFontItalic = blendFunc(anim, fromFontItalic, toFontItalic, progress);
+
+        FontSelector* currentFontSelector = dst->fontCascade().fontSelector();
+        auto description = dst->fontDescription();
+        description.setItalic(blendedFontItalic);
+        description.setFontStyleAxis(blendedStyleAxis);
+        dst->setFontDescription(WTFMove(description));
+        dst->fontCascade().update(currentFontSelector);
+    }
+};
+
 class CSSPropertyAnimationWrapperMap {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -1642,7 +1684,7 @@
 #endif
         new PropertyWrapper<FontSelectionValue>(CSSPropertyFontWeight, &RenderStyle::fontWeight, &RenderStyle::setFontWeight),
         new PropertyWrapper<FontSelectionValue>(CSSPropertyFontStretch, &RenderStyle::fontStretch, &RenderStyle::setFontStretch),
-        new PropertyWrapper<FontSelectionValue>(CSSPropertyFontStyle, &RenderStyle::fontItalic, &RenderStyle::setFontItalic),
+        new PropertyWrapperFontStyle(),
     };
     const unsigned animatableLonghandPropertiesCount = WTF_ARRAY_LENGTH(animatableLonghandPropertyWrappers);
 

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -110,7 +110,7 @@
         hasher.add(m_size);
         hasher.add(m_fontSelectionRequest.weight);
         hasher.add(m_fontSelectionRequest.width);
-        hasher.add(m_fontSelectionRequest.slope);
+        hasher.add(m_fontSelectionRequest.slope.value_or(normalItalicValue()));
         hasher.add(m_locale.existingHash());
         for (unsigned flagItem : m_flags)
             hasher.add(flagItem);

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -152,7 +152,8 @@
     unsigned familyCount() const { return m_fontDescription.familyCount(); }
     const AtomicString& familyAt(unsigned i) const { return m_fontDescription.familyAt(i); }
 
-    FontSelectionValue italic() const { return m_fontDescription.italic(); }
+    // A std::nullopt return value indicates "font-style: normal".
+    std::optional<FontSelectionValue> italic() const { return m_fontDescription.italic(); }
     FontSelectionValue weight() const { return m_fontDescription.weight(); }
     FontWidthVariant widthVariant() const { return m_fontDescription.widthVariant(); }
 

Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/FontDescription.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -64,7 +64,7 @@
 
     float computedSize() const { return m_computedSize; }
     unsigned computedPixelSize() const { return unsigned(m_computedSize + 0.5f); }
-    FontSelectionValue italic() const { return m_fontSelectionRequest.slope; }
+    std::optional<FontSelectionValue> italic() const { return m_fontSelectionRequest.slope; }
     FontSelectionValue stretch() const { return m_fontSelectionRequest.width; }
     FontSelectionValue weight() const { return m_fontSelectionRequest.weight; }
     FontSelectionRequest fontSelectionRequest() const { return m_fontSelectionRequest; }
@@ -117,9 +117,9 @@
     AllowUserInstalledFonts shouldAllowUserInstalledFonts() const { return static_cast<AllowUserInstalledFonts>(m_shouldAllowUserInstalledFonts); }
 
     void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
-    void setItalic(FontSelectionValue italic) { m_fontSelectionRequest.slope = italic; }
+    void setItalic(std::optional<FontSelectionValue> italic) { m_fontSelectionRequest.slope = italic; }
     void setStretch(FontSelectionValue stretch) { m_fontSelectionRequest.width = stretch; }
-    void setIsItalic(bool i) { setItalic(i ? italicValue() : normalItalicValue()); }
+    void setIsItalic(bool isItalic) { setItalic(isItalic ? std::optional<FontSelectionValue> { italicValue() } : std::optional<FontSelectionValue> { }); }
     void setWeight(FontSelectionValue weight) { m_fontSelectionRequest.weight = weight; }
     void setRenderingMode(FontRenderingMode mode) { m_renderingMode = static_cast<unsigned>(mode); }
     void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = static_cast<unsigned>(rendering); }
@@ -298,7 +298,7 @@
 #endif
 
     // Initial values for font properties.
-    static FontSelectionValue initialItalic() { return normalItalicValue(); }
+    static std::optional<FontSelectionValue> initialItalic() { return std::nullopt; }
     static FontStyleAxis initialFontStyleAxis() { return FontStyleAxis::slnt; }
     static FontSelectionValue initialWeight() { return normalWeightValue(); }
     static FontSelectionValue initialStretch() { return normalStretchValue(); }

Modified: trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -66,42 +66,43 @@
 auto FontSelectionAlgorithm::styleDistance(Capabilities capabilities) const -> DistanceResult
 {
     auto slope = capabilities.slope;
+    auto requestSlope = m_request.slope.value_or(normalItalicValue());
     ASSERT(slope.isValid());
-    if (slope.includes(m_request.slope))
-        return { FontSelectionValue(), m_request.slope };
+    if (slope.includes(requestSlope))
+        return { FontSelectionValue(), requestSlope };
 
-    if (m_request.slope >= italicThreshold()) {
-        if (slope.minimum > m_request.slope)
-            return { slope.minimum - m_request.slope, slope.minimum };
-        ASSERT(m_request.slope > slope.maximum);
-        auto threshold = std::max(m_request.slope, m_capabilitiesBounds.slope.maximum);
+    if (requestSlope >= italicThreshold()) {
+        if (slope.minimum > requestSlope)
+            return { slope.minimum - requestSlope, slope.minimum };
+        ASSERT(requestSlope > slope.maximum);
+        auto threshold = std::max(requestSlope, m_capabilitiesBounds.slope.maximum);
         return { threshold - slope.maximum, slope.maximum };
     }
 
-    if (m_request.slope >= FontSelectionValue()) {
-        if (slope.maximum >= FontSelectionValue() && slope.maximum < m_request.slope)
-            return { m_request.slope - slope.maximum, slope.maximum };
-        if (slope.minimum > m_request.slope)
+    if (requestSlope >= FontSelectionValue()) {
+        if (slope.maximum >= FontSelectionValue() && slope.maximum < requestSlope)
+            return { requestSlope - slope.maximum, slope.maximum };
+        if (slope.minimum > requestSlope)
             return { slope.minimum, slope.minimum };
         ASSERT(slope.maximum < FontSelectionValue());
-        auto threshold = std::max(m_request.slope, m_capabilitiesBounds.slope.maximum);
+        auto threshold = std::max(requestSlope, m_capabilitiesBounds.slope.maximum);
         return { threshold - slope.maximum, slope.maximum };
     }
 
-    if (m_request.slope > -italicThreshold()) {
-        if (slope.minimum > m_request.slope && slope.minimum <= FontSelectionValue())
-            return { slope.minimum - m_request.slope, slope.minimum };
-        if (slope.maximum < m_request.slope)
+    if (requestSlope > -italicThreshold()) {
+        if (slope.minimum > requestSlope && slope.minimum <= FontSelectionValue())
+            return { slope.minimum - requestSlope, slope.minimum };
+        if (slope.maximum < requestSlope)
             return { -slope.maximum, slope.maximum };
         ASSERT(slope.minimum > FontSelectionValue());
-        auto threshold = std::min(m_request.slope, m_capabilitiesBounds.slope.minimum);
+        auto threshold = std::min(requestSlope, m_capabilitiesBounds.slope.minimum);
         return { slope.minimum - threshold, slope.minimum };
     }
 
-    if (slope.maximum < m_request.slope)
-        return { m_request.slope - slope.maximum, slope.maximum };
-    ASSERT(slope.minimum > m_request.slope);
-    auto threshold = std::min(m_request.slope, m_capabilitiesBounds.slope.minimum);
+    if (slope.maximum < requestSlope)
+        return { requestSlope - slope.maximum, slope.maximum };
+    ASSERT(slope.minimum > requestSlope);
+    auto threshold = std::min(requestSlope, m_capabilitiesBounds.slope.minimum);
     return { slope.minimum - threshold, slope.minimum };
 }
 

Modified: trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -30,6 +30,7 @@
 #include <tuple>
 #include <wtf/Hasher.h>
 #include <wtf/Optional.h>
+#include <wtf/text/TextStream.h>
 
 namespace WebCore {
 
@@ -170,9 +171,9 @@
     return FontSelectionValue { 20 };
 }
 
-constexpr bool isItalic(FontSelectionValue fontWeight)
+constexpr bool isItalic(std::optional<FontSelectionValue> fontWeight)
 {
-    return fontWeight >= italicThreshold();
+    return fontWeight && fontWeight.value() >= italicThreshold();
 }
 
 constexpr FontSelectionValue normalItalicValue()
@@ -330,20 +331,38 @@
 
     Value weight;
     Value width;
-    Value slope;
+    // FIXME: We are using an optional here to be able to distinguish between an explicit
+    // or implicit slope (for "italic" and "oblique") and the "normal" value which has no
+    // slope. The "italic" and "oblique" values can be distinguished by looking at the
+    // "fontStyleAxis" on the FontDescription. We should come up with a tri-state member
+    // so that it's a lot clearer whether we're dealing with a "normal", "italic" or explicit
+    // "oblique" font style. See webkit.org/b/187774.
+    std::optional<Value> slope;
 
-    constexpr std::tuple<Value, Value, Value> tied() const
+    std::tuple<Value, Value, std::optional<Value>> tied() const
     {
         return WTF::tie(weight, width, slope);
     }
 };
 
-constexpr bool operator==(const FontSelectionRequest& a, const FontSelectionRequest& b)
+inline TextStream& operator<<(TextStream& ts, const FontSelectionValue& fontSelectionValue)
 {
+    ts << TextStream::FormatNumberRespectingIntegers(fontSelectionValue.rawValue());
+    return ts;
+}
+
+inline TextStream& operator<<(TextStream& ts, const std::optional<FontSelectionValue>& optionalFontSelectionValue)
+{
+    ts << optionalFontSelectionValue.value_or(normalItalicValue());
+    return ts;
+}
+
+inline bool operator==(const FontSelectionRequest& a, const FontSelectionRequest& b)
+{
     return a.tied() == b.tied();
 }
 
-constexpr bool operator!=(const FontSelectionRequest& a, const FontSelectionRequest& b)
+inline bool operator!=(const FontSelectionRequest& a, const FontSelectionRequest& b)
 {
     return !(a == b);
 }

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -597,7 +597,7 @@
     if (applyWeightWidthSlopeVariations && !fontIsSystemFont(originalFont)) {
         float weight = fontSelectionRequest.weight;
         float width = fontSelectionRequest.width;
-        float slope = fontSelectionRequest.slope;
+        float slope = fontSelectionRequest.slope.value_or(normalItalicValue());
         if (auto weightValue = fontFaceCapabilities.weight)
             weight = std::max(std::min(weight, static_cast<float>(weightValue->maximum)), static_cast<float>(weightValue->minimum));
         if (auto widthValue = fontFaceCapabilities.width)

Modified: trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (233934 => 233935)


--- trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -623,7 +623,7 @@
     // FIXME: We will eventually want subpixel precision for GDI mode, but the scaled rendering doesn't
     // look as nice. That may be solvable though.
     LONG weight = adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), family);
-    auto hfont = createGDIFont(family, weight, fontDescription.italic(),
+    auto hfont = createGDIFont(family, weight, isItalic(fontDescription.italic()),
         fontDescription.computedPixelSize() * (useGDI ? 1 : 32), useGDI);
 
     if (!hfont)
@@ -636,7 +636,7 @@
     GetObject(hfont.get(), sizeof(LOGFONT), &logFont);
 
     bool synthesizeBold = isGDIFontWeightBold(weight) && !isGDIFontWeightBold(logFont.lfWeight);
-    bool synthesizeItalic = fontDescription.italic() && !logFont.lfItalic;
+    bool synthesizeItalic = isItalic(fontDescription.italic()) && !logFont.lfItalic;
 
     auto result = std::make_unique<FontPlatformData>(WTFMove(hfont), fontDescription.computedPixelSize(), synthesizeBold, synthesizeItalic, useGDI);
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (233934 => 233935)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1678,7 +1678,7 @@
     fontCascade().update(currentFontSelector);
 }
 
-void RenderStyle::setFontItalic(FontSelectionValue value)
+void RenderStyle::setFontItalic(std::optional<FontSelectionValue> value)
 {
     FontSelector* currentFontSelector = fontCascade().fontSelector();
     auto description = fontDescription();

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (233934 => 233935)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-07-18 22:23:25 UTC (rev 233935)
@@ -361,7 +361,7 @@
 #endif
     FontSelectionValue fontWeight() const { return fontDescription().weight(); }
     FontSelectionValue fontStretch() const { return fontDescription().stretch(); }
-    FontSelectionValue fontItalic() const { return fontDescription().italic(); }
+    std::optional<FontSelectionValue> fontItalic() const { return fontDescription().italic(); }
 
     const Length& textIndent() const { return m_rareInheritedData->indent; }
     TextAlignMode textAlign() const { return static_cast<TextAlignMode>(m_inheritedFlags.textAlign); }
@@ -910,7 +910,7 @@
 #endif
     void setFontWeight(FontSelectionValue);
     void setFontStretch(FontSelectionValue);
-    void setFontItalic(FontSelectionValue);
+    void setFontItalic(std::optional<FontSelectionValue>);
 
     void setColor(const Color&);
     void setTextIndent(Length&& length) { SET_VAR(m_rareInheritedData, indent, WTFMove(length)); }

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (233934 => 233935)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1,3 +1,15 @@
+2018-07-18  Antoine Quint  <grao...@apple.com>
+
+        [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.
+
+        Use isItalic() since that function knows how to handle an std::optional<FontSelectionValue>.
+
+        * DOMCoreClasses.cpp:
+        (DOMElement::font):
+
 2018-07-10  Ryosuke Niwa  <rn...@webkit.org>
 
         Disable cross-origin-window-policy by default

Modified: trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp (233934 => 233935)


--- trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp	2018-07-18 22:19:46 UTC (rev 233934)
+++ trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp	2018-07-18 22:23:25 UTC (rev 233935)
@@ -1295,7 +1295,7 @@
     webFontDescription->familyLength = family.length();
     webFontDescription->size = fontDescription.computedSize();
     webFontDescription->bold = isFontWeightBold(fontDescription.weight());
-    webFontDescription->italic = fontDescription.italic();
+    webFontDescription->italic = isItalic(fontDescription.italic());
 
     return S_OK;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to