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

[threaded-animation-resolution] add support for blending opacity values #23854

Conversation

graouts
Copy link
Contributor

@graouts graouts commented Feb 5, 2024

c31a035

[threaded-animation-resolution] add support for blending `opacity` values
https://bugs.webkit.org/show_bug.cgi?id=268738
rdar://122304627

Reviewed by Simon Fraser.

In order to add support for blending `opacity` values we make `AcceleratedEffect`
adopt the `KeyframeInterpolation::interpolateKeyframes()` method and its various
callbacks to deal with `AcceleratedEffect::Keyframe` values. We wrap this into
the new `AcceleratedEffect::apply()` method which is called from `RemoteAcceleratedEffectStack`
in the `computeValues()` method.

We compute the blended values in three different places in `RemoteAcceleratedEffectStack`.

When we resolve effects on the main thread (macOS) we have an `initEffectsFromScrollingThread()`
method to initialize the `CAPresentationModifier` objects which will apply the blended
values, and then on subsequent display updates we call `applyEffectsFromScrollingThread()`.

When we resolve effects on the scrolling thread (iOS) there is no initialization step
required and the single `applyEffectsFromScrollingThread()` method suffices.

Future patches will add support for the other transform-related and filter-related
accelerated properties.

* Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h:
* Source/WebCore/platform/animation/AcceleratedEffect.cpp:
(WebCore::blend):
(WebCore::AcceleratedEffect::apply):
* Source/WebCore/platform/animation/AcceleratedEffect.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteAcceleratedEffectStack.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteAcceleratedEffectStack.mm:
(WebKit::RemoteAcceleratedEffectStack::initEffectsFromScrollingThread):
(WebKit::RemoteAcceleratedEffectStack::applyEffectsFromScrollingThread const):
(WebKit::RemoteAcceleratedEffectStack::applyEffectsFromMainThread const):
(WebKit::RemoteAcceleratedEffectStack::computeValues const):
(WebKit::RemoteAcceleratedEffectStack::clear):

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

c01c3b4

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

@graouts graouts requested a review from cdumez as a code owner February 5, 2024 13:51
@graouts graouts self-assigned this Feb 5, 2024
@graouts graouts added the Animations Bugs related to CSS + SVG animations and transitions label Feb 5, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 5, 2024
@graouts graouts force-pushed the threaded-animation-resolution-initial-blending-support-with-only-opacity branch from 1f79be0 to c01c3b4 Compare February 5, 2024 14:14
@graouts graouts removed the merging-blocked Applied to prevent a change from being merged label Feb 5, 2024
@graouts graouts requested a review from smfr February 5, 2024 15:36
@graouts graouts added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Feb 5, 2024
…lues

https://bugs.webkit.org/show_bug.cgi?id=268738
rdar://122304627

Reviewed by Simon Fraser.

In order to add support for blending `opacity` values we make `AcceleratedEffect`
adopt the `KeyframeInterpolation::interpolateKeyframes()` method and its various
callbacks to deal with `AcceleratedEffect::Keyframe` values. We wrap this into
the new `AcceleratedEffect::apply()` method which is called from `RemoteAcceleratedEffectStack`
in the `computeValues()` method.

We compute the blended values in three different places in `RemoteAcceleratedEffectStack`.

When we resolve effects on the main thread (macOS) we have an `initEffectsFromScrollingThread()`
method to initialize the `CAPresentationModifier` objects which will apply the blended
values, and then on subsequent display updates we call `applyEffectsFromScrollingThread()`.

When we resolve effects on the scrolling thread (iOS) there is no initialization step
required and the single `applyEffectsFromScrollingThread()` method suffices.

Future patches will add support for the other transform-related and filter-related
accelerated properties.

* Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h:
* Source/WebCore/platform/animation/AcceleratedEffect.cpp:
(WebCore::blend):
(WebCore::AcceleratedEffect::apply):
* Source/WebCore/platform/animation/AcceleratedEffect.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteAcceleratedEffectStack.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteAcceleratedEffectStack.mm:
(WebKit::RemoteAcceleratedEffectStack::initEffectsFromScrollingThread):
(WebKit::RemoteAcceleratedEffectStack::applyEffectsFromScrollingThread const):
(WebKit::RemoteAcceleratedEffectStack::applyEffectsFromMainThread const):
(WebKit::RemoteAcceleratedEffectStack::computeValues const):
(WebKit::RemoteAcceleratedEffectStack::clear):

Canonical link: https://commits.webkit.org/274102@main
@webkit-commit-queue webkit-commit-queue force-pushed the threaded-animation-resolution-initial-blending-support-with-only-opacity branch from c01c3b4 to c31a035 Compare February 5, 2024 18:01
@webkit-commit-queue
Copy link
Collaborator

Committed 274102@main (c31a035): https://commits.webkit.org/274102@main

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

@webkit-commit-queue webkit-commit-queue merged commit c31a035 into WebKit:main Feb 5, 2024
@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 Feb 5, 2024
@graouts graouts deleted the threaded-animation-resolution-initial-blending-support-with-only-opacity branch February 5, 2024 18:15
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
5 participants