Commit graph

66442 commits

Author SHA1 Message Date
sideshowbarker
72a86f2df3 LibWeb: Fix selector matching for non-HTML mixed-case element names
This change fixes selector matching for non-HTML elements that have
mixed-case names — such as the SVG foreignObject element.

Otherwise, without this change, attempting to use a selector to match
such an element — e.g., document.querySelector("foreignObject") — fails.
2024-12-25 13:54:06 +00:00
Andreas Kling
f625ea27d0 LibWeb: Use the right StyleInvalidationReason for iframe geometry change 2024-12-25 13:26:51 +01:00
Andreas Kling
f45e24864b LibWeb: Skip unneeded style invalidation on custom element state change
If there are no :defined pseudo-class selectors anywhere in the
document, we don't have to invalidate style at all when an element's
custom element state changes.
2024-12-25 13:26:51 +01:00
Andrew Kaster
202bf901d7 LibWeb: List supported media types publicly for HTMLMediaElement 2024-12-25 12:02:39 +01:00
Saksham Goyal
8ebf2c3007 LibWeb: Add missing attributes in Event Handlers 2024-12-25 12:01:56 +01:00
Shannon Booth
5f2b75852f LibWeb: Add an 'enqueue' helper method on TransformStream 2024-12-25 12:00:54 +01:00
Shannon Booth
9ce0c5914b LibWeb: Add a 'get a reader' helper method on ReadableStream 2024-12-25 12:00:54 +01:00
Shannon Booth
da408cb09a LibWeb: Add a 'piped through' helper method on ReadableStream
This reads a bit nicer, and follows the streams spec pattern on
performing operations on a stream outside of the streams spec.
2024-12-25 12:00:54 +01:00
Timothy Flynn
79a2b96d1c Meta: Consolidate checking for the system audio backend
The goal here is to ensure we check for audio backends in a way that
makes sense. On macOS, let's just always use Audio Unit (and thus avoid
any checks for Pulse, to reduce needless/confusing build log noise). We
will also only use the Qt audio backend if no other backend was found,
rather than only checking for Pulse.
2024-12-25 12:00:43 +01:00
Timothy Flynn
33a1e38646 WebContent: Don't check for specific audio backends
Rather than conditionalizing creating an audio plugin, just let the
audio backend factory return an error on its own. If an audio plugin
is not found, we will get a similar error to what is removed here.
2024-12-25 12:00:43 +01:00
Timothy Flynn
c51cd34bfb LibMedia: Remove outdated FIXME regarding Audio tests
This FIXME does not apply to Ladybird outside Serenity.
2024-12-25 12:00:43 +01:00
Timothy Flynn
dfa727a4d4 LibMedia: Remove preprocessor chain when initializing audio streams
Instead of having to duplicate the audio stream backend conditions, just
define PlaybackStream::create in each audio backend implementation file.
We provide a weak definition in PlaybackStream.cpp as the fallback.
2024-12-25 12:00:43 +01:00
Timothy Flynn
4d866f22a4 Meta: Pin recently added vcpkg dependencies 2024-12-25 12:00:43 +01:00
sideshowbarker
f2ac591614 LibWeb: Compute default ARIA roles for SVG elements
This change adds support for computing default ARIA roles for (selected)
SVG elements, per the requirements in the SVG Accessibility API Mappings
spec at https://w3c.github.io/svg-aam/#mapping_role_table.

This only computes roles for the elements which are covered in the WPT
test at https://wpt.fyi/results/svg-aam/role/roles.html — that is, the
“a”, “g”, and “image” elements.
2024-12-25 10:58:48 +00:00
Shannon Booth
f3e92f2ae5 LibWeb/HTML: Implement the StorageEvent interface 2024-12-25 11:57:14 +01:00
Lucas CHOLLET
c5f9710492 LibWeb/CSS: Create a MediaQueryListEvent when calling MQLE::create()
Otherwise, if not implemented, `MediaQueryListEvent::create()` would
result in a call to `DOM::Event::create()`. This issue exists here:
673537b26b/Libraries/LibWeb/DOM/Document.cpp (L2865)
2024-12-25 11:56:37 +01:00
rmg-x
f5d13e32af LibWebSocket: Use Crypto::fill_with_secure_random instead of PRNG 2024-12-24 17:54:52 +01:00
rmg-x
ceb7f5f017 LibWeb: Use Crypto::fill_with_secure_random instead of PRNG 2024-12-24 17:54:52 +01:00
rmg-x
e222ccf028 LibTLS: Use Crypto::fill_with_secure_random instead of PRNG 2024-12-24 17:54:52 +01:00
rmg-x
f55f507e56 Meta+LibCrypto: Add SecureRandom and replace PRNG usage with it
This adds a thin wrapper to LibCrypto for generating cryptographically
secure random values and replaces current usages of PRNG within
LibCrypto as well.
2024-12-24 17:54:52 +01:00
Andreas Kling
b981e6f7bc LibWeb: Avoid many style invalidations on DOM attribute mutation
Many times, attribute mutation doesn't necessitate a full style
invalidation on the element. However, the conditions are pretty
elaborate, so this first version has a lot of false positives.

We only need to invalidate style when any of these things apply:

1. The change may affect the match state of a selector somewhere.
2. The change may affect presentational hints applied to the element.

For (1) in this first version, we have a fixed list of attribute names
that may affect selectors. We also collect all names referenced by
attribute selectors anywhere in the document.

For (2), we add a new Element::is_presentational_hint() virtual that
tells us whether a given attribute name is a presentational hint.

This drastically reduces style work on many websites. As an example,
https://cnn.com/ is once again browseable.
2024-12-24 17:17:09 +01:00
Andrew Kaster
b11bdd4022 LibWeb: Import WPT tests for WebAssembly.Global
There's one failing due to the constructor object not having the name
"Global" vs "WebAssembly.Global". This also doesn't include the
tentative test for the type property.
2024-12-24 15:20:28 +01:00
Andrew Kaster
67a6c9246c LibWeb: Throw when a setter is called with less than one argument
Some WPT tests expect that if you go out of your way to
Object.getOwnPropertyDescriptor on an interface object and extract
the setter out of it, that they throw when called with no arguments.
2024-12-24 15:20:28 +01:00
Andrew Kaster
44e3817219 LibWeb: Add WebAssembly.Global and exports support for global instances 2024-12-24 15:20:28 +01:00
Shannon Booth
910ff8b694 LibWeb/HTML: Consider <a> all-named elements instead of <link>
Leaving only the unimplemented legacy [[Call]] override funkiness
of HTMLAllCollection left not passing in the WPT tests.
2024-12-23 21:19:08 +01:00
Lucas CHOLLET
c70431672e Tests/LibWeb: Remove some support files from TestConfig.ini
Since 8e34efd4b5, these files are detected
by the runner and already skipped.
2024-12-23 10:59:47 -08:00
Andreas Kling
d5bbf8dcf8 LibWeb: Do lighter style invalidation for style attribute changes
When the `style` attribute changes, we only need to update style on the
element itself (unless there are [style] attribute selectors somewhere).

Descendants of the element don't need a full style update, a simple
inheritance propagation is enough.
2024-12-23 17:05:09 +01:00
Andreas Kling
6983c65c54 LibWeb: Collect interesting document-wide insights about CSS selectors
Starting out with these two things:
- Whether any :has() selectors are present
- The set of all names referenced by attribute selectors
2024-12-23 17:05:09 +01:00
Andreas Kling
dc8343cc23 LibWeb: Add mechanism to invalidate only inherited styles
We can now mark an element as needing an "inherited style update" rather
than a full "style update". This effectively means that the next style
update will visit the element and pull all of its inherited properties
from the relevant ancestor element.

This is now used for descendants of elements with animated style.
2024-12-23 17:05:09 +01:00
Andreas Kling
92ac702c0c LibWeb: Always note whether a CSS property was inherited
This will be relevant when we start recomputing inherited style only.
2024-12-23 17:05:09 +01:00
sideshowbarker
966c68ae0e LibWeb: Align accname alt-vs-title behavior w/ HTML-AAM spec & WPT tests
The https://wpt.fyi/results/accname/name/comp_tooltip.tentative.html
test was recently added by moving an existing subtest out from the test
at https://wpt.fyi/results/accname/name/comp_tooltip.html, and changing
the test expectations to match the HTML-AAM spec requirements at
https://w3c.github.io/html-aam/#img-element-accessible-name-computation.
See https://github.com/web-platform-tests/wpt/pull/49552.

So this code change updates Ladybird to match the updated WPT test
expectations — and to match the existing HTML-AAM spec requirements.
2024-12-23 14:01:37 +01:00
Ali Mohammad Pur
50733c564c LibRegex: Use the *actually* correct repeat start offset for Repeat
Fixes #2931 and various frequent crashes.
2024-12-23 13:13:52 +01:00
Tim Ledbetter
5c032583b4 Meta: Ensure rel attribute exists before querying its value
Previously, the WPT importer would fail to import files with link tags
that didn't have a `rel` attribute.
2024-12-23 11:53:37 +00:00
Andrew Kaster
673537b26b CMake: Rename our triplets to their canonical names
Becuase we're using dynamic libraries, our configuration is
classified as a "community triplet". To not confuse vcpkg
maintainers when developers create bug reports, name them
properly. This means that the default triplet detection is now
kind of useless, so we have to invent our own for these triplets.
2024-12-22 15:48:30 -07:00
devgianlu
89061dd3c4 LibCrypto: Replace all hashes implementation with OpenSSL
This required multiple changes:
- Make hashes non-copiable because they contain a heap allocated pointer
- Reference classes via `NonnullOwnPtr` only (they are non-copiable)
- Drop all existing hashes implementations
- Use the `OpenSSLHashFunction` base class to implement the same hashes

I was not able to come up with a way to divide this commit into multiple
without increasing the amount of changes.

Nothing breaks with this commit!
2024-12-22 18:53:45 +01:00
devgianlu
2d799727e8 LibCrypto: Introduce utility class for OpenSSL backed hashes
This abstract class allows implementing hashes backed by OpenSSL with
very few lines of code, see next commit.
2024-12-22 18:53:45 +01:00
devgianlu
002a93a33c LibCrypto: Link with OpenSSL
Add OpenSSL with vcpkg and link with LibCrypto using CMake.

Also added a placeholder GN setup.
2024-12-22 18:53:45 +01:00
Pavel Shliak
b6561f5e2b LibWeb: Make is_identifier always return false the simple way 2024-12-22 12:33:41 +01:00
Pavel Shliak
d6466da4db LibWeb: Correct interception state assertion logic
The previous VERIFY statement incorrectly asserted that the
interception state was not "committed" or "scrolled". Updated
the condition to ensure the interception state is either
"committed" or "scrolled" as intended.
2024-12-22 12:33:41 +01:00
Pavel Shliak
fa02d94d30 LibTLS: Remove unreachable buffer length check
Refer to the while condition
2024-12-22 12:33:41 +01:00
Pavel Shliak
811d5a5c3e LibRegex: Remove duplicated condition 2024-12-22 12:33:41 +01:00
Pavel Shliak
7dd7f77219 LibRegex: Remove duplicated assignments 2024-12-22 12:33:41 +01:00
Pavel Shliak
78595f05d8 Meta/LibWeb: Use correct shorthand range in is_inherited_property 2024-12-22 12:33:41 +01:00
Pavel Shliak
2be45c1ccf AK: Remove redundant condition from Quick Sort
if (size <= 1)
       return;
This means that size is at the very minimum 2,
and pivot_point at the very minimum equals 1 as size / 2;
The condition if (pivot_point) can never be false.
2024-12-22 12:33:41 +01:00
Sam Atkins
349caecc18 LibWeb/CSS: Use fetch for CSS import rules
This still has a few FIXMEs, but it's a ResourceLoader use gone! :^)
2024-12-22 12:30:09 +01:00
Sam Atkins
a4db7e9e23 LibWeb: Add method for "is CORS-same-origin" 2024-12-22 12:30:09 +01:00
Sam Atkins
ae943965dc LibWeb/CSS: Implement "fetch a style resource" algorithm 2024-12-22 12:30:09 +01:00
Sam Atkins
00948c4746 LibWeb/CSS: Expose CSSStyleSheet's origin clean flag 2024-12-22 12:30:09 +01:00
Lucas CHOLLET
868052a865 Meta: Update libjxl to version 0.11.1 2024-12-22 11:33:19 +01:00
Lucas CHOLLET
91edc06fad Meta: Update vcpkg to the December 2024 release 2024-12-22 11:33:19 +01:00