| Differences between
and this patch
- a/Source/WebCore/ChangeLog +14 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2021-03-26  Tim Nguyen  <ntim@apple.com>
2
3
        Make the object-position CSS property animatable.
4
        https://bugs.webkit.org/show_bug.cgi?id=223568
5
6
        Reviewed by Antoine Quint.
7
8
        Test: imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html
9
10
        * animation/CSSPropertyAnimation.cpp:
11
        (WebCore::blendFunc):
12
        (WebCore::canInterpolateLengthPoints):
13
        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
14
1
2021-03-25  Antoine Quint  <graouts@webkit.org>
15
2021-03-25  Antoine Quint  <graouts@webkit.org>
2
16
3
        Fix interpolation of the caret-color CSS property
17
        Fix interpolation of the caret-color CSS property
- a/Source/WebCore/animation/CSSPropertyAnimation.cpp +26 lines
Lines 48-53 a/Source/WebCore/animation/CSSPropertyAnimation.cpp_sec1
48
#include "FontTaggedSettings.h"
48
#include "FontTaggedSettings.h"
49
#include "GapLength.h"
49
#include "GapLength.h"
50
#include "IdentityTransformOperation.h"
50
#include "IdentityTransformOperation.h"
51
#include "LengthPoint.h"
51
#include "Logging.h"
52
#include "Logging.h"
52
#include "Matrix3DTransformOperation.h"
53
#include "Matrix3DTransformOperation.h"
53
#include "MatrixTransformOperation.h"
54
#include "MatrixTransformOperation.h"
Lines 113-118 static inline LengthSize blendFunc(const CSSPropertyBlendingClient* client, cons a/Source/WebCore/animation/CSSPropertyAnimation.cpp_sec2
113
             blendFunc(client, from.height, to.height, progress, ValueRangeNonNegative) };
114
             blendFunc(client, from.height, to.height, progress, ValueRangeNonNegative) };
114
}
115
}
115
116
117
static inline LengthPoint blendFunc(const CSSPropertyBlendingClient*, const LengthPoint& from, const LengthPoint& to, double progress)
118
{
119
    return blend(from, to, progress);
120
}
121
116
static inline ShadowStyle blendFunc(const CSSPropertyBlendingClient* client, ShadowStyle from, ShadowStyle to, double progress)
122
static inline ShadowStyle blendFunc(const CSSPropertyBlendingClient* client, ShadowStyle from, ShadowStyle to, double progress)
117
{
123
{
118
    if (from == to)
124
    if (from == to)
Lines 759-764 static bool canInterpolateLengthVariants(const GapLength& from, const GapLength& a/Source/WebCore/animation/CSSPropertyAnimation.cpp_sec3
759
    return canInterpolateLengths(from.length(), to.length(), isLengthPercentage);
765
    return canInterpolateLengths(from.length(), to.length(), isLengthPercentage);
760
}
766
}
761
767
768
class LengthPointPropertyWrapper final : public PropertyWrapperGetter<LengthPoint> {
769
    WTF_MAKE_FAST_ALLOCATED;
770
public:
771
    LengthPointPropertyWrapper(CSSPropertyID property, LengthPoint (RenderStyle::*getter)() const, void (RenderStyle::*setter)(LengthPoint&&))
772
        : PropertyWrapperGetter<LengthPoint>(property, getter)
773
        , m_setter(setter)
774
    {
775
    }
776
777
private:
778
    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
779
    {
780
        (destination->*m_setter)(blendFunc(client, value(from), value(to), progress));
781
    }
782
783
    void (RenderStyle::*m_setter)(LengthPoint&&);
784
};
785
762
template <typename T>
786
template <typename T>
763
class LengthVariantPropertyWrapper final : public PropertyWrapperGetter<const T&> {
787
class LengthVariantPropertyWrapper final : public PropertyWrapperGetter<const T&> {
764
    WTF_MAKE_FAST_ALLOCATED;
788
    WTF_MAKE_FAST_ALLOCATED;
Lines 2104-2109 CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap() a/Source/WebCore/animation/CSSPropertyAnimation.cpp_sec4
2104
        new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
2128
        new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
2105
        new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
2129
        new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
2106
2130
2131
        new LengthPointPropertyWrapper(CSSPropertyObjectPosition, &RenderStyle::objectPosition, &RenderStyle::setObjectPosition),
2132
2107
        new PropertyWrapper<float>(CSSPropertyFontSize, &RenderStyle::computedFontSize, &RenderStyle::setFontSize),
2133
        new PropertyWrapper<float>(CSSPropertyFontSize, &RenderStyle::computedFontSize, &RenderStyle::setFontSize),
2108
        new PropertyWrapper<unsigned short>(CSSPropertyColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth),
2134
        new PropertyWrapper<unsigned short>(CSSPropertyColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth),
2109
        new LengthVariantPropertyWrapper<GapLength>(CSSPropertyColumnGap, &RenderStyle::columnGap, &RenderStyle::setColumnGap),
2135
        new LengthVariantPropertyWrapper<GapLength>(CSSPropertyColumnGap, &RenderStyle::columnGap, &RenderStyle::setColumnGap),
- a/LayoutTests/imported/w3c/ChangeLog +9 lines
Lines 1-3 a/LayoutTests/imported/w3c/ChangeLog_sec1
1
2021-03-26  Tim Nguyen  <ntim.bugs@gmail.com>
2
3
        Add interpolation for object-position CSS property
4
        https://bugs.webkit.org/show_bug.cgi?id=223568
5
6
        Reviewed by Antoine Quint.
7
8
        * web-platform-tests/css/css-images/object-position-interpolation.html: Added.
9
1
2021-03-25  Antoine Quint  <graouts@webkit.org>
10
2021-03-25  Antoine Quint  <graouts@webkit.org>
2
11
3
        Fix interpolation of the caret-color CSS property
12
        Fix interpolation of the caret-color CSS property
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation-expected.txt +114 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation-expected.txt_sec1
1
2
PASS CSS Transitions: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
3
PASS CSS Transitions: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
4
PASS CSS Transitions: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
5
PASS CSS Transitions: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
6
PASS CSS Transitions: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
7
PASS CSS Transitions: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
8
PASS CSS Transitions: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
9
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
10
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
11
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
12
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
13
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
14
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
15
PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
16
PASS CSS Animations: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
17
PASS CSS Animations: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
18
PASS CSS Animations: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
19
PASS CSS Animations: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
20
PASS CSS Animations: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
21
PASS CSS Animations: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
22
PASS CSS Animations: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
23
PASS Web Animations: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
24
PASS Web Animations: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
25
PASS Web Animations: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
26
PASS Web Animations: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
27
PASS Web Animations: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
28
PASS Web Animations: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
29
PASS Web Animations: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
30
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
31
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
32
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
33
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
34
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
35
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
36
PASS CSS Transitions: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
37
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
38
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
39
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
40
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
41
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
42
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
43
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
44
PASS CSS Animations: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
45
PASS CSS Animations: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
46
PASS CSS Animations: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
47
PASS CSS Animations: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
48
PASS CSS Animations: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
49
PASS CSS Animations: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
50
PASS CSS Animations: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
51
PASS Web Animations: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
52
PASS Web Animations: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
53
PASS Web Animations: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
54
PASS Web Animations: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
55
PASS Web Animations: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
56
PASS Web Animations: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
57
PASS Web Animations: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
58
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
59
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
60
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
61
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
62
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
63
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
64
PASS CSS Transitions: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
65
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
66
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
67
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
68
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
69
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
70
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
71
PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
72
PASS CSS Animations: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
73
PASS CSS Animations: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
74
PASS CSS Animations: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
75
PASS CSS Animations: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
76
PASS CSS Animations: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
77
PASS CSS Animations: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
78
PASS CSS Animations: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
79
PASS Web Animations: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
80
PASS Web Animations: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
81
PASS Web Animations: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
82
PASS Web Animations: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
83
PASS Web Animations: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
84
PASS Web Animations: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
85
PASS Web Animations: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
86
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
87
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
88
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
89
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
90
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
91
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
92
PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
93
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
94
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
95
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
96
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
97
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
98
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
99
PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
100
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
101
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
102
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
103
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
104
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
105
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
106
PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
107
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
108
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
109
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
110
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
111
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
112
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
113
PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
114
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html +72 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html_sec1
1
<!DOCTYPE html>
2
<meta charset="UTF-8">
3
<link rel="help" href="https://drafts.csswg.org/css-images-3/#the-object-position">
4
<meta name="test" content="object-position supports animation">
5
6
<script src="/resources/testharness.js"></script>
7
<script src="/resources/testharnessreport.js"></script>
8
<script src="/css/support/interpolation-testcommon.js"></script>
9
10
<body></body>
11
12
<script>
13
  // Default object-position value is 50% 50%
14
  test_interpolation({
15
    property: 'object-position',
16
    from: neutralKeyframe,
17
    to: 'left top',
18
  }, [
19
    { at: -0.25, expect: '62.5% 62.5%' },
20
    { at: 0, expect: '50% 50%' },
21
    { at: 0.25, expect: '37.5% 37.5%' },
22
    { at: 0.5, expect: '25% 25%' },
23
    { at: 0.75, expect: '12.5% 12.5%' },
24
    { at: 1, expect: '0% 0%' },
25
    { at: 1.25, expect: '-12.5% -12.5%' },
26
  ]);
27
28
  // Animate x axis
29
  test_interpolation({
30
    property: 'object-position',
31
    from: 'initial',
32
    to: 'center top',
33
  }, [
34
    { at: -0.25, expect: '50% 62.5%' },
35
    { at: 0, expect: '50% 50%' },
36
    { at: 0.25, expect: '50% 37.5%' },
37
    { at: 0.5, expect: '50% 25%' },
38
    { at: 0.75, expect: '50% 12.5%' },
39
    { at: 1, expect: '50% 0%' },
40
    { at: 1.25, expect: '50% -12.5%' },
41
  ]);
42
43
  // Animate y axis
44
  test_interpolation({
45
    property: 'object-position',
46
    from: 'initial',
47
    to: 'left center',
48
  }, [
49
    { at: -0.25, expect: '62.5% 50%' },
50
    { at: 0, expect: '50% 50%' },
51
    { at: 0.25, expect: '37.5% 50%' },
52
    { at: 0.5, expect: '25% 50%' },
53
    { at: 0.75, expect: '12.5% 50%' },
54
    { at: 1, expect: '0% 50%' },
55
    { at: 1.25, expect: '-12.5% 50%' },
56
  ]);
57
58
  // Pixel values
59
  test_interpolation({
60
    property: 'object-position',
61
    from: '20px 20px',
62
    to: '100px 100px',
63
  }, [
64
    { at: -0.25, expect: '0px 0px' },
65
    { at: 0, expect: '20px 20px' },
66
    { at: 0.25, expect: '40px 40px' },
67
    { at: 0.5, expect: '60px 60px' },
68
    { at: 0.75, expect: '80px 80px' },
69
    { at: 1, expect: '100px 100px' },
70
    { at: 1.25, expect: '120px 120px' },
71
  ]);
72
</script>

Return to Bug 223568