Andreas Kling
b98a2be96b
LibWeb: Ignore window-forwarded document.body.onfoo in detached DOM
...
Normally, assigning to e.g document.body.onload will forward to
window.onload. However, in a detached DOM tree, there is no associated
window, so we have nowhere to forward to, making this a no-op.
The bulk of this change is making Document::window() return a nullable
pointer, as documents created by DOMParser or DOMImplementation do not
have an associated window object, and so must be able to return null
from here.
2024-03-11 18:29:10 +01:00
Aliaksandr Kalenik
2129c5d8b0
LibWeb: Unregister AnimationTimeline from document in finalize()
...
...instead of destructor because by the time it is executed, document
could already be destroyed.
2024-03-11 16:44:05 +01:00
Matthew Olsson
e91f4dcd79
LibWeb: Use Performance for animation time instead of MonotonicTime
...
Performance handles the document origin time correctly, and prevents
these times from being unusually large. Also initialize the
DocumentTimeline time in the constructor, since these can be created
from JS.
2024-03-10 15:13:47 +01:00
Matthew Olsson
d76c2d45c4
LibWeb: Remove scopes for execution contexts in Animation finish steps
2024-03-09 15:34:27 +01:00
Matthew Olsson
fc6a6d29ec
LibWeb: Ensure m_is_finished is false after cancelling Animation
2024-03-09 15:34:27 +01:00
Matthew Olsson
e11b9658ed
LibWeb: Disassociate animations from Animatables when setting effects
2024-03-09 15:34:27 +01:00
Matthew Olsson
90290eb985
LibWeb: Store Animations in Animatable instead of AnimationEffects
...
This is closer to what the spec instructs us to do, and matches how
associations are maintained in the timelines. Also note that the removed
destructor logic is not necessary since we visit the associated
animations anyways.
2024-03-09 15:34:27 +01:00
Matthew Olsson
f386c01ae1
LibWeb: Use the correct start time when pausing/playing animations
2024-03-09 15:34:27 +01:00
Matthew Olsson
24ec5838ba
LibWeb: Visit Animatable::m_associated_effects
2024-03-09 15:34:27 +01:00
Matthew Olsson
c1ab6ca6b4
LibWeb: Do not invalidate elements with animations in the CSS cascade
...
See the note added to Animation::cancel for more info
2024-03-02 19:58:12 +01:00
Matthew Olsson
0f54d797d2
LibWeb: Handle pre-existing animations when considering animation-name
...
If a DOM::Element has an animation-name property, then in addition to
remembering where it came from, it will also remember the
Animations::Animation object that was created for it. This allows
StyleComputer to cancel that animation if the animation-name property
changes as well as to apply any changes required (for example, if
animation-play-state changes from "running" to "paused", it needs to
call .pause() on the animation).
2024-02-25 21:12:42 +00:00
Matthew Olsson
2ee022dead
LibWeb: Set KeyframeEffect's pseudo-element if applicable
2024-02-25 21:12:42 +00:00
Matthew Olsson
921f6c1e78
LibWeb: Run play tasks before pause tasks
...
The logic of play() and pause() assumes this to be the case
2024-02-25 21:12:42 +00:00
Matthew Olsson
62f62a0e52
LibWeb: Correctly set timing function in AnimationEffect::update_timing
...
Also pulls out the parse_easing_string function out since it will be
needed elsewhere
2024-02-25 08:51:50 +01:00
Matthew Olsson
b33bb0997a
LibWeb: Move easing parsing code out into a dedicated function
...
This will be used outside of StyleComputer
2024-02-25 08:51:50 +01:00
Matthew Olsson
ee63c729e5
LibWeb: Expand shorthand properties in KeyframeEffect
2024-02-25 08:51:50 +01:00
Matthew Olsson
d2cfea5acc
LibWeb: Add Animation event handler attributes
2024-02-23 21:23:57 +01:00
Matthew Olsson
2dd5d0c310
LibWeb: Implement Animation.reverse()
2024-02-23 21:23:57 +01:00
Matthew Olsson
9ab73f2675
LibWeb: Implement Animation.updatePlaybackRate()
2024-02-23 21:23:57 +01:00
Matthew Olsson
d351389d72
LibWeb: Implement Animation.persist()
2024-02-23 21:23:57 +01:00
Matthew Olsson
3c055ff76d
LibWeb: Implement Animation.cancel()
2024-02-23 21:23:57 +01:00
Matthew Olsson
9abe472928
LibWeb: Implement Animation.finish()
2024-02-23 21:23:57 +01:00
Matthew Olsson
c0b9179d9a
LibWeb: Implement Animation.pause()
2024-02-23 21:23:57 +01:00
Matthew Olsson
ae3326a447
LibWeb: Transition StyleComputer to Web Animations
...
With this commit, we are finally running animations off of the web
animations spec! A lot of the work StyleComputer is doing is now done
elsewhere. For example, fill-forward animations are handled by
Animation::is_relevant() returning true in the after phase, meaning the
"active_state_if_fill_forward" map is no longer needed.
2024-02-23 20:52:37 +01:00
Matthew Olsson
ee4abacde6
LibWeb: Add AnimationEffect::target_properties()
2024-02-22 07:31:54 +01:00
Matthew Olsson
10fddb99fc
LibWeb: Implement Document::remove_replaced_animations()
2024-02-22 07:31:54 +01:00
Matthew Olsson
9bab1a95a5
LibWeb: Keep track of AnimationEffect's previous phase and iteration
...
This will be required for detecting transitions in StyleComputer
2024-02-22 07:31:54 +01:00
Matthew Olsson
35859c0467
LibWeb: Add helpers to convert between FillMode and Direction enums
2024-02-22 07:31:54 +01:00
Matthew Olsson
3ea26327c7
LibWeb: Implement Animatable::get_animations()
2024-02-21 19:52:35 +01:00
Matthew Olsson
145ae54718
LibWeb: Add a few Animation/AnimationEffect getters
2024-02-21 19:52:35 +01:00
Matthew Olsson
06a8674eec
LibWeb: Simplify Animation::update_finished_state a bit
...
This removes the two boolean hack in favor of using the existing
mechanism to remove queued tasks. It also exposes the element
invalidation behavior for call sites that don't necessarily want to
update the finished state, but still need to invalidate the associated
target.
2024-02-21 19:52:35 +01:00
Matthew Olsson
1e37ba5515
LibWeb: Expose Animation::is_finished()
...
This will be required to handle forward-fill state in StyleComputer
2024-02-21 19:52:35 +01:00
Matthew Olsson
5eea53f27a
LibWeb: Keep track of associated AnimationEffects in Animatable
2024-02-21 19:52:35 +01:00
Matthew Olsson
2ade834655
LibWeb: Add Animation::is_replaceable()
2024-02-21 19:52:35 +01:00
Matthew Olsson
4e6c74dcf6
LibWeb: Define the composite order between two animations
2024-02-21 19:52:35 +01:00
Matthew Olsson
ceb9d0f8dc
LibWeb: Record position of Animations in global animation list
...
"position of an Animation in the global animation list" is a fancy way
of saying "which animation object was created first"
2024-02-21 19:52:35 +01:00
Matthew Olsson
c3b689488e
LibWeb: Implement animation class-specific composite order
...
This is a part of determining the composite order of two animations
2024-02-21 19:52:35 +01:00
Matthew Olsson
cac11ac891
LibWeb: Use [ExplicitNull] in Animation.idl
2024-02-19 14:51:56 -05:00
Matthew Olsson
1d98f812af
LibWeb: Generate KeyframeSet in KeyframeEffect::set_keyframes
...
This is similar to the logic used in StyleComputer (except a bit closer
to the spec), and will eventually be shared between the two.
2024-02-19 12:21:48 +01:00
Matthew Olsson
1735f3d9aa
LibWeb: Add keyframe state to KeyframeEffect
...
This was taken from StyleComputer, and will eventually be removed from
StyleComputer once we transition to using Web animations.
2024-02-19 12:21:48 +01:00
Matthew Olsson
7d5e17eddd
LibWeb: Implement Animatable::animate()
2024-02-19 12:21:48 +01:00
Matthew Olsson
3a87c000c4
LibWeb: Add the CSSAnimation IDL object
2024-02-16 12:02:11 -07:00
Matthew Olsson
3721a1a81c
LibWeb: Run update_finished_state when setting AnimationEffect's timing
...
This will need to a necessary style invalidation
2024-02-16 12:02:11 -07:00
Matthew Olsson
6d25bf3aac
LibWeb: Invalidate element when setting AnimationEffect's animation
2024-02-16 12:02:11 -07:00
Matthew Olsson
ce99636cd0
LibWeb: Fix check for missing argument in Animation constructor
...
Receiving a null argument has a different result than not passing an
argument at all.
2024-02-16 12:02:11 -07:00
Matthew Olsson
727a9a6472
LibWeb: Run pending play tasks when the timeline time changes
...
Note that the timeline time changes every animation frame when the
Document sends out animation events
2024-02-15 12:34:19 +01:00
Matthew Olsson
daaaaec2d0
LibWeb: Add the Animatable IDL object
2024-02-15 12:34:19 +01:00
Matthew Olsson
4792dc294b
LibWeb: Implement Animation::play
2024-02-15 12:34:19 +01:00
Matthew Olsson
88518c29ca
LibWeb: Combine "pending" and "ASAP" animation task states
...
It seems that the difference between pending and ASAP in the spec is
only to allow the implementation to perform implementation-defined
operations between the two states. We don't need to distinguish the two
states, so lets just combine them for now.
2024-02-15 12:34:19 +01:00
Matthew Olsson
3c9c134d71
LibWeb: Implement KeyframeEffect::{get,set}_keyframes
2024-02-13 19:44:44 +01:00