Log Message
LayoutTests/imported/w3c: Add interpolation for object-position CSS property https://bugs.webkit.org/show_bug.cgi?id=223568
Patch by Tim Nguyen <[email protected]> on 2021-03-26 Reviewed by Antoine Quint. * web-platform-tests/css/css-images/object-position-interpolation.html: Added. Source/WebCore: Make the object-position CSS property animatable. https://bugs.webkit.org/show_bug.cgi?id=223568 Patch by Tim Nguyen <[email protected]> on 2021-03-26 Reviewed by Antoine Quint. Test: imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html * animation/CSSPropertyAnimation.cpp: (WebCore::blendFunc): (WebCore::canInterpolateLengthPoints): (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
Modified Paths
- trunk/LayoutTests/imported/w3c/ChangeLog
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (275103 => 275104)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-03-26 17:08:07 UTC (rev 275103)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-03-26 17:58:32 UTC (rev 275104)
@@ -1,3 +1,12 @@
+2021-03-26 Tim Nguyen <[email protected]>
+
+ Add interpolation for object-position CSS property
+ https://bugs.webkit.org/show_bug.cgi?id=223568
+
+ Reviewed by Antoine Quint.
+
+ * web-platform-tests/css/css-images/object-position-interpolation.html: Added.
+
2021-03-26 Imanol Fernandez <[email protected]>
Implement cachedPropertyValue for WebXR [SameObject] attributes
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation-expected.txt (0 => 275104)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation-expected.txt 2021-03-26 17:58:32 UTC (rev 275104)
@@ -0,0 +1,114 @@
+
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
+PASS CSS Transitions: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
+PASS CSS Transitions with transition: all: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
+PASS CSS Animations: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (-0.25) should be [62.5% 62.5%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (0) should be [50% 50%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (0.25) should be [37.5% 37.5%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (0.5) should be [25% 25%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (0.75) should be [12.5% 12.5%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (1) should be [0% 0%]
+PASS Web Animations: property <object-position> from neutral to [left top] at (1.25) should be [-12.5% -12.5%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
+PASS CSS Transitions: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
+PASS CSS Animations: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (-0.25) should be [50% 62.5%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (0) should be [50% 50%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (0.25) should be [50% 37.5%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (0.5) should be [50% 25%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (0.75) should be [50% 12.5%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (1) should be [50% 0%]
+PASS Web Animations: property <object-position> from [initial] to [center top] at (1.25) should be [50% -12.5%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
+PASS CSS Transitions: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
+PASS CSS Transitions with transition: all: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
+PASS CSS Animations: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (-0.25) should be [62.5% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (0) should be [50% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (0.25) should be [37.5% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (0.5) should be [25% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (0.75) should be [12.5% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (1) should be [0% 50%]
+PASS Web Animations: property <object-position> from [initial] to [left center] at (1.25) should be [-12.5% 50%]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
+PASS CSS Transitions: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
+PASS CSS Transitions with transition: all: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
+PASS CSS Animations: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (-0.25) should be [0px 0px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0) should be [20px 20px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.25) should be [40px 40px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.5) should be [60px 60px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (0.75) should be [80px 80px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (1) should be [100px 100px]
+PASS Web Animations: property <object-position> from [20px 20px] to [100px 100px] at (1.25) should be [120px 120px]
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html (0 => 275104)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html 2021-03-26 17:58:32 UTC (rev 275104)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<link rel="help" href=""
+<meta name="test" content="object-position supports animation">
+
+<script src=""
+<script src=""
+<script src=""
+
+<body></body>
+
+<script>
+ // Default object-position value is 50% 50%
+ test_interpolation({
+ property: 'object-position',
+ from: neutralKeyframe,
+ to: 'left top',
+ }, [
+ { at: -0.25, expect: '62.5% 62.5%' },
+ { at: 0, expect: '50% 50%' },
+ { at: 0.25, expect: '37.5% 37.5%' },
+ { at: 0.5, expect: '25% 25%' },
+ { at: 0.75, expect: '12.5% 12.5%' },
+ { at: 1, expect: '0% 0%' },
+ { at: 1.25, expect: '-12.5% -12.5%' },
+ ]);
+
+ // Animate x axis
+ test_interpolation({
+ property: 'object-position',
+ from: 'initial',
+ to: 'center top',
+ }, [
+ { at: -0.25, expect: '50% 62.5%' },
+ { at: 0, expect: '50% 50%' },
+ { at: 0.25, expect: '50% 37.5%' },
+ { at: 0.5, expect: '50% 25%' },
+ { at: 0.75, expect: '50% 12.5%' },
+ { at: 1, expect: '50% 0%' },
+ { at: 1.25, expect: '50% -12.5%' },
+ ]);
+
+ // Animate y axis
+ test_interpolation({
+ property: 'object-position',
+ from: 'initial',
+ to: 'left center',
+ }, [
+ { at: -0.25, expect: '62.5% 50%' },
+ { at: 0, expect: '50% 50%' },
+ { at: 0.25, expect: '37.5% 50%' },
+ { at: 0.5, expect: '25% 50%' },
+ { at: 0.75, expect: '12.5% 50%' },
+ { at: 1, expect: '0% 50%' },
+ { at: 1.25, expect: '-12.5% 50%' },
+ ]);
+
+ // Pixel values
+ test_interpolation({
+ property: 'object-position',
+ from: '20px 20px',
+ to: '100px 100px',
+ }, [
+ { at: -0.25, expect: '0px 0px' },
+ { at: 0, expect: '20px 20px' },
+ { at: 0.25, expect: '40px 40px' },
+ { at: 0.5, expect: '60px 60px' },
+ { at: 0.75, expect: '80px 80px' },
+ { at: 1, expect: '100px 100px' },
+ { at: 1.25, expect: '120px 120px' },
+ ]);
+</script>
Modified: trunk/Source/WebCore/ChangeLog (275103 => 275104)
--- trunk/Source/WebCore/ChangeLog 2021-03-26 17:08:07 UTC (rev 275103)
+++ trunk/Source/WebCore/ChangeLog 2021-03-26 17:58:32 UTC (rev 275104)
@@ -1,3 +1,17 @@
+2021-03-26 Tim Nguyen <[email protected]>
+
+ Make the object-position CSS property animatable.
+ https://bugs.webkit.org/show_bug.cgi?id=223568
+
+ Reviewed by Antoine Quint.
+
+ Test: imported/w3c/web-platform-tests/css/css-images/object-position-interpolation.html
+
+ * animation/CSSPropertyAnimation.cpp:
+ (WebCore::blendFunc):
+ (WebCore::canInterpolateLengthPoints):
+ (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
2021-03-26 Said Abou-Hallawa <[email protected]>
Allow logging minimal info about uploading media files in the system diagnose
Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (275103 => 275104)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-03-26 17:08:07 UTC (rev 275103)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-03-26 17:58:32 UTC (rev 275104)
@@ -48,6 +48,7 @@
#include "FontTaggedSettings.h"
#include "GapLength.h"
#include "IdentityTransformOperation.h"
+#include "LengthPoint.h"
#include "Logging.h"
#include "Matrix3DTransformOperation.h"
#include "MatrixTransformOperation.h"
@@ -113,6 +114,11 @@
blendFunc(client, from.height, to.height, progress, ValueRangeNonNegative) };
}
+static inline LengthPoint blendFunc(const CSSPropertyBlendingClient*, const LengthPoint& from, const LengthPoint& to, double progress)
+{
+ return blend(from, to, progress);
+}
+
static inline ShadowStyle blendFunc(const CSSPropertyBlendingClient* client, ShadowStyle from, ShadowStyle to, double progress)
{
if (from == to)
@@ -759,6 +765,24 @@
return canInterpolateLengths(from.length(), to.length(), isLengthPercentage);
}
+class LengthPointPropertyWrapper final : public PropertyWrapperGetter<LengthPoint> {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ LengthPointPropertyWrapper(CSSPropertyID property, LengthPoint (RenderStyle::*getter)() const, void (RenderStyle::*setter)(LengthPoint&&))
+ : PropertyWrapperGetter<LengthPoint>(property, getter)
+ , m_setter(setter)
+ {
+ }
+
+private:
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
+ {
+ (destination->*m_setter)(blendFunc(client, value(from), value(to), progress));
+ }
+
+ void (RenderStyle::*m_setter)(LengthPoint&&);
+};
+
template <typename T>
class LengthVariantPropertyWrapper final : public PropertyWrapperGetter<const T&> {
WTF_MAKE_FAST_ALLOCATED;
@@ -2104,6 +2128,8 @@
new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
+ new LengthPointPropertyWrapper(CSSPropertyObjectPosition, &RenderStyle::objectPosition, &RenderStyle::setObjectPosition),
+
new PropertyWrapper<float>(CSSPropertyFontSize, &RenderStyle::computedFontSize, &RenderStyle::setFontSize),
new PropertyWrapper<unsigned short>(CSSPropertyColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth),
new LengthVariantPropertyWrapper<GapLength>(CSSPropertyColumnGap, &RenderStyle::columnGap, &RenderStyle::setColumnGap),
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
