Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web-animations] custom properties should support interpolation with a single keyframe #7679

Conversation

graouts
Copy link
Contributor

@graouts graouts commented Dec 15, 2022

c3591d2

[web-animations] custom properties should support interpolation with a single keyframe
https://bugs.webkit.org/show_bug.cgi?id=249384

Reviewed by Antti Koivisto.

Custom properties can specify an initial value when registered. However, that value is not
available in RenderStyle if the custom property is not provided with an explicit value. This
means that when we added basic support for interpolating custom properties in bug 249312, we
would fail to gather the right values for interpolating as we'd have a null value if the keyframes
did not set explicit values.

We can get to the initial value of a custom property through the custom property registry held
by the document. So we add a new document() method to CSSPropertyBlendingClient such that we may
be able to read from this registry when interpolating from within CSSPropertyAnimation.

Then we add a static method customPropertyValuesForBlending that returns a pair of CSSCustomPropertyValue
pointers containing either the explicit value set for a custom property, or its initial value.

Now we are guaranteed to get the correct values when interpolating.

* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animation/custom-property-animation-length-expected.txt:
* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::blendCustomProperty):
* Source/WebCore/animation/CSSPropertyBlendingClient.h:
* Source/WebCore/animation/KeyframeEffect.h:

Canonical link: https://commits.webkit.org/257911@main

ea9ab02

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2   πŸ§ͺ api-mac   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios   πŸ§ͺ mac-wk1 ⏳ πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-wk2
βœ… πŸ›  tv-sim ⏳ πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch   πŸ§ͺ mac-wk2-stress
βœ… πŸ›  watch-sim
βœ… πŸ›  πŸ§ͺ unsafe-merge

@graouts graouts self-assigned this Dec 15, 2022
@graouts graouts added the Animations Bugs related to CSS + SVG animations and transitions label Dec 15, 2022
@graouts graouts requested a review from anttijk December 15, 2022 11:34
@graouts graouts force-pushed the custom-property-interpolation-step-3 branch from 1705f1a to ea9ab02 Compare December 15, 2022 11:36
@graouts graouts added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Dec 15, 2022
…a single keyframe

https://bugs.webkit.org/show_bug.cgi?id=249384

Reviewed by Antti Koivisto.

Custom properties can specify an initial value when registered. However, that value is not
available in RenderStyle if the custom property is not provided with an explicit value. This
means that when we added basic support for interpolating custom properties in bug 249312, we
would fail to gather the right values for interpolating as we'd have a null value if the keyframes
did not set explicit values.

We can get to the initial value of a custom property through the custom property registry held
by the document. So we add a new document() method to CSSPropertyBlendingClient such that we may
be able to read from this registry when interpolating from within CSSPropertyAnimation.

Then we add a static method customPropertyValuesForBlending that returns a pair of CSSCustomPropertyValue
pointers containing either the explicit value set for a custom property, or its initial value.

Now we are guaranteed to get the correct values when interpolating.

* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animation/custom-property-animation-length-expected.txt:
* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::blendCustomProperty):
* Source/WebCore/animation/CSSPropertyBlendingClient.h:
* Source/WebCore/animation/KeyframeEffect.h:

Canonical link: https://commits.webkit.org/257911@main
@webkit-commit-queue
Copy link
Collaborator

Committed 257911@main (c3591d2): https://commits.webkit.org/257911@main

Reviewed commits have been landed. Closing PR #7679 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit c3591d2 into WebKit:main Dec 15, 2022
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Dec 15, 2022
@graouts graouts deleted the custom-property-interpolation-step-3 branch December 15, 2022 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Animations Bugs related to CSS + SVG animations and transitions
Projects
None yet
4 participants