Commit graph

72443 commits

Author SHA1 Message Date
Zaggy1024
5456072d48 LibWeb: Implement audio media data processing through PlaybackManager 2025-10-27 17:28:49 -07:00
Zaggy1024
dfe59b8a4f LibMedia+LibWeb: Prefer MatroskaDemuxer for media playback
MatroskaDemuxer supports multiple streams already, and gives us a bit
more control over seeking.
2025-10-27 17:28:49 -07:00
Zaggy1024
0ff330c906 LibMedia: Play audio through PlaybackManager using Providers/Sinks
This commit implements the functionality to play back audio through
PlaybackManager.

To decode the audio data, AudioDataProviders are created for each track
in the provided media data. These providers will fill their audio block
queue, then sit idle until their corresponding tracks are enabled.

In order to output the audio, one AudioMixingSink is created which
manages a PlaybackStream which requests audio blocks from multiple
AudioDataProviders and mixes them into one buffer with sample-perfect
precision.
2025-10-27 17:28:49 -07:00
Zaggy1024
dd052832c1 LibMedia: Support the MP3 and AAC codecs in our demuxer 2025-10-27 17:28:49 -07:00
Zaggy1024
6b34003c2c LibMedia: Support coded audio frames in our demuxers
This adds a new variant of the metadata storage in CodedFrame for audio
frames, called CodedAudioFrameData.
2025-10-27 17:28:49 -07:00
Zaggy1024
6caa2f99aa LibMedia+LibWeb: Rewrite PlaybackManager using the provider/sink model
With this commit, all PlaybackManager can do is autoplay a file from
start to finish, with no pausing or seeking functionality.

All audio playback functionality has been removed from HTMLMediaElement
and HTMLAudioElement in anticipation of PlaybackManager taking that
over, for both audio-only and audio/video.
2025-10-27 17:28:49 -07:00
Zaggy1024
0f9fa47352 LibWeb: Update media elements' page mute state via a for_each method 2025-10-27 17:28:49 -07:00
Zaggy1024
5e645929a7 LibWeb: Stop moving a GC::Ref in media elements' create_layout_node()s
The type is trivial, so this was causing a warning.
2025-10-27 17:28:49 -07:00
Zaggy1024
31b72c4799 LibMedia: Make Track::type() const 2025-10-27 17:28:49 -07:00
Zaggy1024
7e238cd724 LibMedia: Add separate classes managing decoding and displaying video
These are unused in this commit, but will later be used to output video
via PlaybackManager, or to decode video directly to some consumer.
2025-10-27 17:28:49 -07:00
Zaggy1024
dfbad09315 LibMedia: Set the time base in FFmpegVideoDecoder
Very minor change, which doesn't actually affect our output, since we
were already inputting and outputting microseconds, but it can't hurt
to give FFmpeg's decoder this information as well.
2025-10-27 17:28:49 -07:00
Zaggy1024
523e7e2ffa LibMedia: Make Demuxer atomically ref-counted
We'll need to share the demuxer between multiple decoder providers, and
those will hold references to the demuxer from their own decoder
threads.
2025-10-27 17:28:49 -07:00
Zaggy1024
27742ef26d LibMedia+LibWeb: Never return errors when getting PlaybackStream time
We should be fine to just fall back to zero or the last returned value
if we encounter an error in PlaybackStream::total_time_played(), and
this also simplifies the using code.
2025-10-27 17:28:49 -07:00
Tim Ledbetter
9da723b5c6 LibWeb: Ensure layout is up to date before resolving canvas colors 2025-10-27 16:56:01 -07:00
Jelle Raaijmakers
4dbae64dce LibWeb: Unify objectBoundingBox and userSpaceOnUse coord transformations
There's a fairly complicated interaction between an SVG gradient's paint
transformation and the gradient coordinate transformation required to
correctly draw gradient fills. This was especially noticeable when
scaling down an SVG, resulting in broken gradient coordinates and
graphical glitches.

This changes the objectBoundingBox units to immediately map to the
bounding box's coordinate system, so we can unify the gradient paint
transformation logic and make it a lot simpler. We only need to undo the
bounding box offset and apply the paint transformation to fix a lot of
gradient fill bugs.
2025-10-27 16:42:27 -07:00
Jelle Raaijmakers
beb1d60714 LibWeb: Simplify calculation of the SVG viewbox transform
We don't need to construct a new AffineTransform and multiply that by
yet another AffineTransform; we can simply translate and scale the
transform that's already in place. No functional changes.
2025-10-27 16:42:27 -07:00
Jelle Raaijmakers
6f50c35d68 LibWeb: Misc. cleanup of code
Some things I came across while working on a bugfix. No functional
changes.
2025-10-27 16:42:27 -07:00
Jelle Raaijmakers
e4de6c0d05 LibWeb: Return early if scroll offset is zero
No need to calculate scroll offsets and translate update list commands
if the cumulative offset was zero to begin with.
2025-10-27 16:42:27 -07:00
Jelle Raaijmakers
c0d08b68af LibWeb: Dump path_bounding_rect for FillPath
This makes it easier to differentiate between FillPath commands in the
display list output.
2025-10-27 16:42:27 -07:00
Tim Ledbetter
e1ff1e2095 LibWeb: Implement CanvasPattern.setTransform()
This method applies the given transformation matrix to a pattern.
2025-10-27 16:41:02 -07:00
Andreas Kling
9312a9f86f LibJS: Move InstantiateOrdinaryFunctionExpression into interpreter
This is execution time stuff and doesn't belong in the AST.
2025-10-27 21:14:33 +01:00
Andreas Kling
44fa9566a8 LibJS: Generate bytecode for the BlockDeclarationInstantiation AO
This necessitated adding some new instructions for creating mutable and
immutable bindings.
2025-10-27 21:14:33 +01:00
Andreas Kling
892c7d980e LibJS: Let JS::Script remember whether its code is strict mode
We don't want to rely on having the AST node just to answer the question
"is this script strict mode?"
2025-10-27 21:14:33 +01:00
Andreas Kling
b712caf855 LibJS: Move bytecode executable cache to SharedFunctionInstanceData
This shrinks every Statement and ECMAScriptFunctionObject by one
pointer, and puts the bytecode cache in the only place that actually
makes use of it anyway: functions.
2025-10-27 21:14:33 +01:00
Andreas Kling
3a38040c82 LibJS: Make SharedFunctionInstanceData GC-allocated 2025-10-27 21:14:33 +01:00
Tete17
b77f658c83 LibWeb: Add a bunch of new passing WPT tests 2025-10-27 16:14:20 +00:00
Tete17
c591f8c14f LibWeb: Amend DomParser to make it compatible with TrustedTypes 2025-10-27 16:14:20 +00:00
Tete17
33285467a8 LibWeb: Amend ShadowRoot to make it compatible with TrustedTypes 2025-10-27 16:14:20 +00:00
Tete17
db41ea8117 LibWeb: Amend Element interface to make it compatible with TrustedTypes 2025-10-27 16:14:20 +00:00
Tete17
1368744d33 LibWeb: Amend Document interface to make it compatible with TrustedTypes 2025-10-27 16:14:20 +00:00
Tete17
2fa84f1683 LibWeb: Properly propagate errors for Node set_text_content
This function was supposed to throw errors even before the TrustedTypes
spec thanks to the CharacterData replaceData call but had a MUST.

This changes this to ensure this function can throw an error
2025-10-27 16:14:20 +00:00
Tete17
887537b061 LibWeb: Implement TrustedTypes spec for set_value on Attribute 2025-10-27 16:14:20 +00:00
Tete17
e2adce84e7 LibWeb: Implement TrustedTypes spec for the concept of set_attribute_ns 2025-10-27 16:14:20 +00:00
Tete17
4b00a61479 LibWeb: Implement TrustedTypes spec for the concept of set_attribute 2025-10-27 16:14:20 +00:00
Tete17
df543cf31a LibWeb: Implement TrustedTypes spec for set_attribute on Element
This part of the spec is still under a PR in GitHub, but it should be
safe to implement like it is.
2025-10-27 16:14:20 +00:00
Callum Law
5381146e85 LibWeb: Include PropertyID.h in fewer header files
This reduces the size of the recompile when PropertyID.h is modified
from ~1500 to ~125
2025-10-27 14:50:54 +00:00
Callum Law
59a1184469 LibWeb: Remove custom hash function for PropertyID
The default hash function for enums does the same thing
2025-10-27 14:50:54 +00:00
Callum Law
12716dccf0 LibWeb: Avoid including ComputedProperties.h in Element.h
This reduces the size of the recompile when ComputedProperties.h is
modified from ~1200 to ~70
2025-10-27 14:50:54 +00:00
Callum Law
64f438857b LibWeb: Factor out some class template methods into implementation files
Reduces the rebuild required for changes to the .cpp parts (or their
includes)
2025-10-27 14:50:54 +00:00
Timothy Flynn
2a68087dfc LibWeb: Do not assume hovered URLs are valid
Let's just not display any tooltip for invalid URLs. This matches how
Firefox behaves.
2025-10-27 14:15:03 +00:00
Rocco Corsi
73b01a975a CI: Add All_Debug CI job 2025-10-27 08:46:02 -04:00
Callum Law
76dadd45d6 LibWeb: Favour !important property values over animated values 2025-10-27 09:51:50 +00:00
Callum Law
c8f345356e LibWeb: Maintain property importance into ComputedProperties
Previously we wouldn't propagate this from CascadedProperties to
ComputedProperties
2025-10-27 09:51:50 +00:00
Callum Law
823dd11b67 LibWeb: Add ComputedProperties::set_property_without_modifying_flags
There are a few places in style computation where we want to update the
value of a property without modifying the inherited or important flags.

Previously we would look up these flags and pass them to the normal
`set_property` method but this is unnecessary and was easy to forget to
do.
2025-10-27 09:51:50 +00:00
Callum Law
84762021b8 LibWeb: Support triggering multiple animations per animation property
We also now use the computed (rather than cascaded) values when
triggering animations.
2025-10-27 09:48:25 +00:00
Callum Law
18477b0d84 LibWeb: Promote animation-composition values to enum
This brings us in line with the other `animation-*` enum properties
(`animation-play-state` and `animation-fill-mode`)
2025-10-27 09:48:25 +00:00
Tim Ledbetter
8854bb62c6 LibGfx: Use CSS sRGB serialization for canvas fill styles 2025-10-26 18:55:22 +01:00
Tim Ledbetter
ebd802f6fc LibWeb+LibGfx: Move CSS sRGB color serialization function to LibGfx 2025-10-26 18:55:22 +01:00
Rocco Corsi
633fc45e0f LibWeb: Make Worker.cpp compile again with WEB_WORKER_DEBUG enabled 2025-10-26 12:47:06 -04:00
Dave-London
5f963e1c52 Documentation: Remove de-listed VSCode extension reference
The "SerenityOS DSL Syntax Highlight" extension has been de-listed
from both the VS Code Marketplace and Open VSX. Remove the broken
section from the documentation to prevent confusion.
2025-10-26 12:44:44 -04:00