[webkit-changes] [WebKit/WebKit] 5a5dc4: [scroll-animations] update `Animation` to use `CSS...

Antoine Quint noreply at github.com
Tue Sep 24 08:48:50 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a5dc44dab988042b54b60d53a007d67a355912b
      https://github.com/WebKit/WebKit/commit/5a5dc44dab988042b54b60d53a007d67a355912b
  Author: Antoine Quint <graouts at webkit.org>
  Date:   2024-09-24 (Tue, 24 Sep 2024)

  Changed paths:
    M Source/WebCore/animation/AnimationEffect.cpp
    M Source/WebCore/animation/AnimationEffect.h
    M Source/WebCore/animation/CSSAnimation.cpp
    M Source/WebCore/animation/CSSAnimation.h
    M Source/WebCore/animation/CSSNumberishTime.cpp
    M Source/WebCore/animation/CSSNumberishTime.h
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/animation/StyleOriginatedAnimation.cpp
    M Source/WebCore/animation/StyleOriginatedAnimation.h
    M Source/WebCore/animation/WebAnimation.cpp
    M Source/WebCore/animation/WebAnimation.h
    M Source/WebCore/platform/animation/AcceleratedEffect.cpp

  Log Message:
  -----------
  [scroll-animations] update `Animation` to use `CSSNumberish`
https://bugs.webkit.org/show_bug.cgi?id=279729
rdar://136031116

Reviewed by Tim Nguyen.

The `Animation` interface uses `CSSNumberish?` for the `startTime` and `currentTime` properties.
Up to now, we would validate the values provided through the bindings and store time values as
`std::optional<Seconds>`.

In order to support Scroll-driven Animations, we now store such values as `std::optional<CSSNumberishTime>`
so that we can represent both time values, but also percentages. This requires refactoring a number
of methods throughout the animation code to no longer use `Seconds`, but also adding functionality
to `CSSNumberishTime` such that it can:

- automatically convert to and from `Seconds`,
- perform simple arithmetic operations and comparisons with `Seconds`,
- automatically convert to and from `double` (with values being milliseconds, as in the Web Animations API).

Since our animation code still relies on time-based values through and through, `CSSNumberishTime::isValid()`
still requires time values, but as we implement more of the Scroll-driven Animations functionality, we will
add the relevant specific code to determine whether times are valid based on the associated timeline type.

* Source/WebCore/animation/AnimationEffect.cpp:
(WebCore::AnimationEffect::localTime const):
(WebCore::AnimationEffect::getBasicTiming const):
(WebCore::AnimationEffect::getComputedTiming const):
* Source/WebCore/animation/AnimationEffect.h:
* Source/WebCore/animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::setBindingsStartTime):
* Source/WebCore/animation/CSSAnimation.h:
* Source/WebCore/animation/CSSNumberishTime.cpp:
(WebCore::CSSNumberishTime::CSSNumberishTime):
(WebCore::CSSNumberishTime::isValid const):
(WebCore::CSSNumberishTime::operator+ const):
(WebCore::CSSNumberishTime::operator- const):
(WebCore::CSSNumberishTime::operator< const):
(WebCore::CSSNumberishTime::operator<= const):
(WebCore::CSSNumberishTime::operator> const):
(WebCore::CSSNumberishTime::operator>= const):
(WebCore::CSSNumberishTime::operator== const):
(WebCore::CSSNumberishTime::operator* const):
(WebCore::CSSNumberishTime::operator/ const):
(WebCore::CSSNumberishTime::operator double const):
(WebCore::CSSNumberishTime::operator Seconds const):
(WebCore::CSSNumberishTime::dump const):
(WebCore::operator<<):
* Source/WebCore/animation/CSSNumberishTime.h:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::applyPendingAcceleratedActions):
* Source/WebCore/animation/StyleOriginatedAnimation.cpp:
(WebCore::StyleOriginatedAnimation::bindingsStartTime const):
(WebCore::StyleOriginatedAnimation::bindingsCurrentTime const):
* Source/WebCore/animation/StyleOriginatedAnimation.h:
* Source/WebCore/animation/WebAnimation.cpp:
(WebCore::WebAnimation::bindingsStartTime const):
(WebCore::WebAnimation::setBindingsStartTime):
(WebCore::WebAnimation::setStartTime):
(WebCore::WebAnimation::bindingsCurrentTime const):
(WebCore::WebAnimation::setBindingsCurrentTime):
(WebCore::WebAnimation::currentTime const):
(WebCore::WebAnimation::silentlySetCurrentTime):
(WebCore::WebAnimation::setCurrentTime):
(WebCore::WebAnimation::updateFinishedState):
(WebCore::WebAnimation::play):
(WebCore::WebAnimation::validateCSSNumberishValue const): Deleted.
* Source/WebCore/animation/WebAnimation.h:
(WebCore::WebAnimation::startTime const):
(WebCore::WebAnimation::holdTime const):
* Source/WebCore/platform/animation/AcceleratedEffect.cpp:
(WebCore::AcceleratedEffect::AcceleratedEffect):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list