Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: cf5ac861157f59865809da65be40f10b33014cbe https://github.com/WebKit/WebKit/commit/cf5ac861157f59865809da65be40f10b33014cbe Author: Antoine Quint <grao...@webkit.org> Date: 2024-09-15 (Sun, 15 Sep 2024)
Changed paths: M Source/WebCore/Headers.cmake M Source/WebCore/Sources.txt M Source/WebCore/WebCore.xcodeproj/project.pbxproj A Source/WebCore/animation/CSSNumberishTime.cpp A Source/WebCore/animation/CSSNumberishTime.h M Source/WebCore/animation/ComputedEffectTiming.h M Source/WebCore/animation/ComputedEffectTiming.idl M Source/WebCore/animation/ScrollTimeline.cpp M Source/WebCore/animation/StyleOriginatedAnimation.cpp M Source/WebCore/animation/ViewTimeline.cpp M Source/WebCore/animation/WebAnimation.cpp M Source/WebCore/animation/WebAnimationTypes.h Log Message: ----------- [scroll-animations] update `ComputedEffectTiming` to use `CSSNumberish` https://bugs.webkit.org/show_bug.cgi?id=279727 rdar://136031059 Reviewed by Chris Dumez and Tim Nguyen. To accommodate progress-based timelines (such as `ScrollTimeline` and `ViewTimeline`), the following properties of `ComputedEffectTiming` have been updated to be `CSSNumberish` (aka `double or CSSNumericValue`) to return `%` values: `localTime`, `endTime` and `activeDuration`. Before we do the work to actually compute such values, we update the IDL files for these properties and back them with a new type called `CSSNumberishTime` which can automatically convert from and to `CSSNumberish`. The benefit of `CSSNumberishTime` are twofold. First, it removes the need to deal with `std::variant` switches and then the various units which `CSSNumericValue` can represent with either "time" or "percentage" semantics and methods to access such values. Second, it supports various math operators to directly add, subtract and compare the time or percentage values held by `CSSNumberishTime`. This will be critical when we adopt `CSSNumberish` through more of the Web Animations API, especially with the `Animation` APIs which are used throughout the Web Animations codebase currently as `Seconds`. This should make the move to `CSSNumberishTime` mostly transparent for most of our code. * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/animation/CSSNumberishTime.cpp: Added. (WebCore::CSSNumberishTime::CSSNumberishTime): (WebCore::CSSNumberishTime::time const): (WebCore::CSSNumberishTime::percentage const): (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 CSSNumberish const): * Source/WebCore/animation/CSSNumberishTime.h: Added. * Source/WebCore/animation/ComputedEffectTiming.h: * Source/WebCore/animation/ComputedEffectTiming.idl: * Source/WebCore/animation/ScrollTimeline.cpp: Fix missing header revealed by the addition of `CSSNumberishTime`. * Source/WebCore/animation/StyleOriginatedAnimation.cpp: (WebCore::StyleOriginatedAnimation::invalidateDOMEvents): * Source/WebCore/animation/ViewTimeline.cpp: Fix missing header revealed by the addition of `CSSNumberishTime`. * Source/WebCore/animation/WebAnimation.cpp: (WebCore::WebAnimation::validateCSSNumberishValue const): Remove code dealing with `CSSNumericValue` since all of it is performed by the `CSSNumberishTime` constructor. * Source/WebCore/animation/WebAnimationTypes.h: Add `CSSNumberishTime.h` so that the Web Animations code automatically gets access to `CSSNumberishTime.h` via this oft-included file. Canonical link: https://commits.webkit.org/283689@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes