Commit graph

7328 commits

Author SHA1 Message Date
Aliaksandr Kalenik
98691810b1 LibWeb: Fix insert/delete rule invalidation for adopted style sheets
Invalidation for adopted style sheets was broken because we had an
assumption that "active" style sheet is always attached to
StyleSheetList which is not true for adopted style sheets. This change
addresses that by keeping track of all documents/shadow roots that own
a style sheet and notifying them about invalidation instead of going
through the StyleSheetList.
2025-01-13 23:03:07 +01:00
devgianlu
24e374d7e1 LibCrypto: Remove old unused padding schemes and codes 2025-01-13 17:00:18 +01:00
devgianlu
a59b48cffc LibCrypto+LibWeb: Replace RSA_OAEP-EME implementation
This replaces the old `OAEP` implementation with one backed by OpenSSL.
The changes also include some added modularity to the RSA class by
making the `RSA_EME` and `RSA_EMSE` for encryption/decryption and
signing/verifying respectively.
2025-01-13 17:00:18 +01:00
devgianlu
70bc26e32a LibCrypto+LibTLS: Replace RSA_PKCS1-EMSA implementation
This commit replaces the old implementation of `EMSA_PKCS1_V1_5` with
one backed by OpenSSL. In doing so, the `sign` and `verify` methods of
RSA have been modified to behave like expected and not just be
encryption and decryption.

I was not able to split this commit because the changes to `verify` and
`sign` break pretty much everything.
2025-01-13 17:00:18 +01:00
devgianlu
6e721110f9 LibCrypto: Make RSA class easily configurable
This is a small change to allow subclasses of `RSA` to configure the
`EVP_PKEY_CTX` without rewriting everything.
2025-01-13 17:00:18 +01:00
devgianlu
91c393ea98 LibCrypto: Use OpenSSL for RSA encryption and decryption 2025-01-13 17:00:18 +01:00
devgianlu
daa81c9b32 LibCrypto: Remove OpenSSL as a public header dependency
Add a forwarding header for OpenSSL types so that we can build without
propagating the OpenSSL dependency.
2025-01-13 17:00:18 +01:00
devgianlu
559c5a7311 LibCrypto: Move OpenSSL RAII helper methods out of line 2025-01-13 17:00:18 +01:00
devgianlu
977af95b5b LibCrypto: Move hash constructors out of line 2025-01-13 17:00:18 +01:00
devgianlu
0fc02d4d00 LibCrypto: Make PKSystem methods return a ByteBuffer directly
It used to be that the caller would supply a buffer to write the output
to. This created an anti-pattern in multiple places where the caller
would allocate a `ByteBuffer` and then use `.bytes()` to provide it to
the `PKSystem` method. Then the callee would resize the output buffer
and reassign it, but because the resize was on `Bytes` and not on
`ByteBuffer`, the caller using the latter would cause a bug.

Additionally, in pretty much all cases the buffer was pre-allocated
shortly before.
2025-01-13 17:00:18 +01:00
Psychpsyo
bb5d1ac4a3 LibWeb: Fix CSS tag seletor case sensitivity for SVG elements
They can appear in HTML documents but must not be matched
according to the HTML spec.
2025-01-13 12:11:34 +00:00
Psychpsyo
7757df5bb5 LibWeb: Implement CSS 'isolation' property 2025-01-13 11:07:55 +00:00
Sam Atkins
4e1aa96dce LibWeb/CSS: Use CalcSV's context to determine what percentages are
This lets us implement the `matches_number()` and `matches_dimension()`
methods of `CSSNumericType` to spec, instead of being an ad-hoc hack.
2025-01-13 10:59:16 +00:00
Sam Atkins
6f60c258ce LibWeb/CSS: Mark transform property as resolving percentages as lengths 2025-01-13 10:59:16 +00:00
Sam Atkins
a40dbd080d LibWeb/CSS: Remove CSSNumericType::matches_resolution_percentage()
This isn't a spec type.
2025-01-13 10:59:16 +00:00
Sam Atkins
4efdb76857 LibWeb/CSS: Give calc() a CalculationContext for resolving percentages
This is passed in at construction, meaning we will be able to refer to
it later, when we're no longer inside the Parser.
2025-01-13 10:59:16 +00:00
Sam Atkins
bc00ef8314 LibWeb/CSS: Replace Parser "current property" with a stack of contexts
`current_property_id()` is insufficient to determine if a quirk is
allowed. For example, unitless lengths are allowed in certain
properties, but NOT if they are inside a calc() or other function. It's
also incorrect when we are parsing a longhand inside a shorthand. So
instead, replace that with a stack of value-parsing contexts. For now,
this is either properties or CSS functions, but in future can be
expanded to include media features and other places.

This lets us disallow quirks inside functions, like we're supposed to.

It also lays the groundwork for being able to more easily determine
what type a percentage inside a calculation should become, as this is
based on the same stack of contexts.
2025-01-13 10:59:16 +00:00
Tim Ledbetter
619df0bc2c LibWeb: Don't crash when upgrading custom element with a bad constructor
Previously, a crash would occur when attempting to throw an error in
this case because the method used to create the exception tried to get
the current realm from the execution context stack, which is empty. The
realm is now passed explicitly when constructing the error, avoiding
the crash.
2025-01-13 10:55:46 +00:00
Gingeh
403cda5cd6 LibWeb: Allow color keywords in theme-color metadata 2025-01-12 19:47:01 +00:00
Gingeh
9f2ce259ad LibWeb: Check for missing node or invalid query in obtain_theme_color 2025-01-12 19:47:01 +00:00
Gingeh
6fd03425b2 UI: Prevent crash when right clicking on an unloaded image 2025-01-12 19:29:57 +00:00
Shannon Booth
57479c2d4b LibWeb/HTML: Include better information in 'report an exception' event
Instead of always reporting a colno and lineno of zero try and use the
values from the Error object that may be provided, falling back to the
source location of the invocation if not provided. We can definitely
improve the reporting even more, but this is a start!

Also update this function to latest spec while we're in the area.
2025-01-12 18:49:55 +00:00
Shannon Booth
f388d3c88c LibWeb/HTML: Fix crash creating canvas pattern without context
This isn't a full fix, as the paint function does not handle this
either. But instead of getting the bitmap from the image source
immediately, follow the spec a bit more closely by creating the
CanvasPatern object with the ImageSource directly.

Fixes a crash for the 5 included WPT tests.
2025-01-12 18:40:37 +00:00
Shannon Booth
dfdcfc8e88 LibWeb/Bindings: Generate undefined in a union as 'Empty'
This can only ever be undefined, and no other JS value, so it makes
sense to use undefined to represent this case.
2025-01-12 18:39:24 +00:00
devgianlu
fef1f62ecc LibCrypto: Use OpenSSL to generate RSA keys
Replace our slow, possibly incorrect RSA key generation with OpenSSL.

This should fix many WPT tests that are timing out because we were too
slow at computing keys.
2025-01-12 01:13:19 +01:00
devgianlu
130f890497 LibCrypto: Add methods to convert OpenSSL BN <-> UnsignedBigInteger
These methods allow to convert between OpenSSL big numbers and ours.
2025-01-12 01:13:19 +01:00
devgianlu
7b38923144 LibCrypto: Refactor OpenSSL RAII wrappers to a macro 2025-01-12 01:13:19 +01:00
devgianlu
df05cc8478 LibCrypto: Make PKSystem methods return ErrorOr
Make `encrypt`, `decrypt`, `sign` and `verify` return `ErrorOr` for
better error propagation.
2025-01-12 01:13:19 +01:00
devgianlu
6ba627b047 LibCrypto: Remove default key size for RSA::generate_key_pair
The current default is unsafe, but determining a safe value is not easy.
Leave it up to the caller to decide.
2025-01-12 01:13:19 +01:00
devgianlu
9e08f71fd9 LibCrypto: Make RSA::generate_key_pair return ErrorOr
Not currently needed as it cannot fail, but useful for future commits.
2025-01-12 01:13:19 +01:00
Timothy Flynn
d5e3a557fd LibWebView: Avoid replication of the HTML namespace string
Now that we can use these string constants, let's avoid the replication.
2025-01-12 00:35:58 +01:00
Timothy Flynn
a4324ee6e9 LibWeb: Remove the initialize_strings methods
We added these methods to propagate OOM errors at process startup, but
we longer fret about these tiny OOM failures. Requiring that these init
methods be called prohibits using these strings in processes that have
not set up a MainThreadVM. So let's just remove them and initialize the
strings in a sane manner.

In doing so, this also standardizes how we initialize strings whose C++
variable name differs from their string value. Instead of special-casing
these strings, we just include their string value in the x-macro list.
2025-01-12 00:35:58 +01:00
Timothy Flynn
ed726b6af0 LibWeb: Remove outdated FIXME about missing HTML event names
The drag-and-drop event names are already included, and the app cache
event names no longer exist (and the spec link here 404s).
2025-01-12 00:35:58 +01:00
Psychpsyo
19f97472eb LibWeb: Verify element namespace in DOM::create_element() 2025-01-11 23:29:17 +01:00
Tim Ledbetter
1e9e2b6564 LibWeb: Clone all attribute properties when cloning a single node
Previously, the namespace of the attributes on the cloned element was
not being set.
2025-01-11 23:10:09 +01:00
Tim Ledbetter
a467005855 LibWeb: Make node cloning methods const 2025-01-11 23:10:09 +01:00
Psychpsyo
31b20e38ee LibWebView: Fix capitalization in devtools 2025-01-11 16:28:51 -05:00
Shannon Booth
64eeda6450 LibWeb: Return a representation of an 'Agent' in 'relevant agent'
This makes it more convenient to use the 'relvant agent' concept,
instead of the awkward dynamic casts we needed to do for every call
site.

mutation_observers is also changed to hold a GC::Root instead of raw
GC::Ptr. Somehow this was not causing problems before, but trips up CI
after these changes.
2025-01-11 10:39:48 -05:00
Shannon Booth
5bed8f4055 LibURL+LibWeb: Make URL::basic_parse return an Optional<URL>
URL::basic_parse has a subtle bug where the resulting URL is not set
to valid when StateOveride is provided and the URL parser early returns
a valid URL.

This has not surfaced as a problem so far, as the only users of the
state override API provide an already valid URL buffer and also ignore
the result of basic parsing with a state override.

However, this bug surfaces implementing the URL pattern spec, which as
part of URL canonicalization:
 * Provides a dummy URL record
 * Basic URL parses that URL with state override
 * Checks the result of the URL parser to validate the URL

While we could set URL validity on every early return of the URL parser
during state override, it has been a long standing FIXME around the code
to try and remove the awkward validity state of the URL class. So this
commit makes the first stage of this change by migrating the basic
parser API to return Optional, which also happens to make this subtle
issue not a problem any more.
2025-01-11 10:08:29 -05:00
Tim Ledbetter
5b6f2bb23a LibWeb: Set dirty checkedness flag when setting checked IDL attribute
This matches the behavior of other browsers, which always set the dirty
checkedness flag when setting checkedness, except when setting the
`checked` content attribute.
2025-01-11 11:13:32 +01:00
Tim Ledbetter
c87bc78d5d LibWeb: Preserve indeterminate value when cloning HTMLInputElement 2025-01-11 11:13:32 +01:00
devgianlu
b9ba1b3f72 LibWeb: Add Ed448 support in WebCryptoAPI
Add full support for Ed448 and import relevant tests.
2025-01-11 11:13:06 +01:00
devgianlu
c23765c8f2 LibCrypto: Add Ed448 OID to know algorithm identifiers 2025-01-11 11:13:06 +01:00
devgianlu
27b4bae78b LibCrypto: Implement Ed448
Implement the Ed448 curve for signing and verifying using OpenSSL.

The methods could be all made static, but all other curves are not.
I think this is material for further refactoring.
2025-01-11 11:13:06 +01:00
devgianlu
4817ca489f LibCrypto: Add useful macros and classes for working with OpenSSL
Add a couple of macros to aid error handling with OpenSSL and some RAII
classes that manage the lifetime of some OpenSSL objects.
2025-01-11 11:13:06 +01:00
Tim Ledbetter
e03fec2a15 LibWeb: Use DocumentLoadTimingInfo values in PerformanceTiming interface 2025-01-11 11:11:52 +01:00
Tim Ledbetter
f8b8c9c4a4 LibWeb: Wait until ReadyState is complete before detaching HTML parser
Previously, the DOM complete time was never being set, as the HTML
parser was detached before `DocumentReadyState` was set to complete.
2025-01-11 11:11:52 +01:00
Sam Atkins
03024765e9 LibWeb/HTML: Halt navigation if navigate event returns false 2025-01-11 11:10:43 +01:00
Sam Atkins
f11347739a LibWeb/HTML: Stop observing lazy-loaded iframes when navigating 2025-01-11 11:10:43 +01:00
Sam Atkins
0957c59c26 LibWeb/HTML: Update Navigable::navigate spec steps
No code changes.
2025-01-11 11:10:43 +01:00
Sam Atkins
97616fa108 LibWeb/DOM: Move "stop intersection observing..." code into a method
We'll need to call it from elsewhere.

Also add a missing step 5 from where we previously called it.
2025-01-11 11:10:43 +01:00
Sam Atkins
c6a18f795d LibWeb/HTML: Pass user_involvement through navigables code
This corresponds to part of https://github.com/whatwg/html/pull/10818
2025-01-11 11:10:43 +01:00
Tim Ledbetter
8b5e9c2a1d LibWeb: Emit comment token for unterminated bogus comments on EOF 2025-01-11 11:09:47 +01:00
Shannon Booth
627b7dd936 LibWeb/Bindings: Define constructor properties in the correct order 2025-01-11 01:43:31 +00:00
Tim Ledbetter
3261f873c5 LibWeb: Validate parameters for source node start() and stop() methods 2025-01-10 23:35:20 +01:00
Jelle Raaijmakers
98ec1825de LibWeb: Implement the "useCSS" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
70af48c18b LibWeb: Implement the "selectAll" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
03bcfb9b8c LibWeb: Implement the "outdent" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
fbc0d40d2c LibWeb: Implement the "justifyCenter/Full/Left/Right" editing commands 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
1c3251e2d5 LibWeb: Implement the "insertUnorderedList" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
26cadf06d2 LibWeb: Implement the "insertText" editing command
Minus the autolinking algorithm.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
199eaf0d3e LibWeb: Implement the "insertOrderedList" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
01ce9cb151 LibWeb: Implement the "insertImage" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
20fb7b1a49 LibWeb: Implement the "insertHTML" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
cb05ab6515 LibWeb: Implement the "insertHorizontalRule" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
c6cde85534 LibWeb: Implement the "indent" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
a12d887eb4 LibWeb: Implement the "formatBlock" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
e686328cbd LibWeb: Implement the "unlink" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
043a28baeb LibWeb: Implement the "underline" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
679fbb5eda LibWeb: Implement the "superscript" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
ef8af01e1d LibWeb: Implement the "subscript" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
8c51d6863f LibWeb: Implement the "strikethrough" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
aee8a75c40 LibWeb: Implement the "removeFormat" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
ae12f7036b LibWeb: Implement the "italic" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
228c66f2e1 LibWeb: Implement the "foreColor" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
1d2500e31f LibWeb: Implement the "fontSize" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
9366a50dd3 LibWeb: Implement the "fontName" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
1b02e0dea3 LibWeb: Implement the "createLink" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
05386fe99c LibWeb: Implement the "backColor" and "hiliteColor" editing commands 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
7736d63290 LibWeb: Implement the "forwardDelete" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
a71e999ac8 LibWeb: Implement the "bold" editing command 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
fef02036dd LibWeb: Implement the "set the selection's value" editing algorithm 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
aeec57a440 LibWeb: Implement the "indent" and "outdent" editing algorithms 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
9750896af3 LibWeb: Implement the "push down values" editing algorithm 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
9bcf2fc0f5 LibWeb: Implement last remaining FIXME for wrap editing algorithm 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
148e465131 LibWeb: Implement remaining FIXMEs in "specified command value" algo 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
5e7a31bf60 LibWeb: Implement "move node preserving ranges" editing algorithm 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
2b6a14c5ee LibWeb: Implement "preserves overrides" property of editing commands 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
e21ee10b3c LibWeb: Add command state & value overrides to DOM::Document 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
67800091c5 LibWeb: Check for editability and visibility of "formattable nodes"
The associated spec was only partially implemented.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
85abad30b0 LibWeb: Add explicit "active range" editing algorithm
This makes some of the spec implementations easier to follow and makes
it extra clear that the range is optional.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
2987dd1060 LibWeb: Fix node insertion in split_the_parent_of_nodes()
If we are to insert nodes _before_ the original parent, we need to
insert them at the original parent's index, not the index before that.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
83f48a07d4 LibWeb: Make normalize_sublists_in_node() take a Node instead of Element
This prevents some unnecessary casting to DOM::Element.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
d08febcf67 LibWeb: Add Node::for_each(_inclusive)_ancestor()
Allows for easy iteration over the chain of ancestors for a node.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
4323669939 LibWeb: Add Range::for_each_contained()
This centralizes the logic for iterating over a Range's contained nodes.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
2466021e55 LibWeb: Rename argument to split_the_parent_of_nodes() to reflect spec
The spec calls it a "node list", not "nodes".
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
f4c822ee38 LibWeb: Simplify fix_disallowed_ancestors_of_node()'s usage of node
Commit 98df4c2b changes the node argument to a GC::Ref<DOM::Node>, but
not all usages were updated accordingly.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
bd2488a468 LibWeb: Make block_extend_a_range() take a GC::Ref for the range
This makes it more consistent with the other signatures.
2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
e5b107b6b6 LibWeb: Fix typo in spec comment for non-list single line containers 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
acef5a34de LibWeb: Remove useless move from remove_node_preserving_its_descendants 2025-01-10 23:33:35 +01:00
Jelle Raaijmakers
e64766d54d LibWeb: Add spec links to editing command definitions 2025-01-10 23:33:35 +01:00
Aliaksandr Kalenik
cf57efd252 LibWeb: Unload fonts when adopted style sheet is removed
Add missing unloading step that we do for regular style sheets but
mistakenly missed for adopted style sheets.
2025-01-10 19:12:48 +03:00
Aliaksandr Kalenik
d8b0b1535b LibWeb: Skip keyframe animation update if target element isn't connected
Makes some pages on Github faster as previously we had to update
animation for elements in not connected shadow trees.
2025-01-10 15:41:37 +01:00
Aliaksandr Kalenik
de062e4d2c LibWeb: Invalidate style if url changed in HTMLHyperlinkElementUtils
Previously, <a> elements were frequently invalidated because
`set_the_url()` was called by `reinitialize_url()`, which is a
preparation step in every HTMLHyperlinkElementUtils function. As a
result, styles were unnecessarily invalidated each time any of these
functions were invoked without changing the URL.
2025-01-10 14:35:33 +00:00
Tim Ledbetter
84b69c2387 LibWeb: Make TemporaryExecutionContext [[nodiscard]] 2025-01-10 13:21:36 +00:00
Tim Ledbetter
5d4aa15ada LibThreading: Make MutexLocker [[nodiscard]] 2025-01-10 13:21:36 +00:00
Shannon Booth
1f4c7ac62b LibWeb/DOM: Remove uneccessary ExceptionOr for NodeIterator::create 2025-01-10 08:08:46 +00:00
Shannon Booth
17c92d7c2b LibWeb/DOM: Create TreeWalker in document's realm 2025-01-10 08:08:46 +00:00
Shannon Booth
84f22cb6b3 LibWeb/DOM: Create NodeIterator in document's realm 2025-01-10 08:08:46 +00:00
sideshowbarker
10766ecf54 LibWeb: Ignore role=none for focusable & has-global-ARIA-attribute cases
This change causes explicit role=none and role=presentation attribute
values to be ignored in cases where the elements for which those values
are specified are either focusable, or have global ARIA attributes —
per https://w3c.github.io/aria/#conflict_resolution_presentation_none.
2025-01-09 14:08:23 +00:00
sideshowbarker
ead3af0163 LibWeb: Ignore name-required landmark roles which lack accessible names
This change implements the role-checking requirement from the ARIA spec
at https://w3c.github.io/aria/#document-handling_author-errors_roles
that the “form” and “region” roles are required to have accessible
names — and that if they don’t have accessible names as required, UAs
must treat them as if they’d not been specified at all.
2025-01-09 14:08:23 +00:00
sideshowbarker
2cb7baa581 LibWeb: Ignore “orphaned” ARIA roles
This change causes explicitly-specified role attributes to be ignored in
the case where the specified role is “orphaned” — that is, when its
element lacks a required ancestor with an appropriate role.
2025-01-09 14:08:23 +00:00
sideshowbarker
56c7857053 LibWeb: Return true for is_focusable() elements with non-null tabindex
This change implements the requirements stated in the HTML spec at
https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
that UAs must allow HTML elements with non-null tabindex values to be
considered as focusable areas.
2025-01-09 14:08:23 +00:00
sideshowbarker
173368bd5e LibWeb: Allow accessible-name computation to skip role-attribute lookup
Per https://w3c.github.io/aria/#document-handling_author-errors_roles,
determining whether to ignore certain specified landmark roles requires
first determining whether the element for which the role is specified
has an accessible name.

But if we then try to retrieve a role for such elements, we end up
calling right back into the accessible-name computation code — which
would cause the calls to loop infinitely.

So to avoid that — and to have handling for any other future cases the
spec may introduce of such recursive calls that will loop indefinitely —
this change introduces a parameter that callers can pass to cause
role-attribute lookup to be skipped during accessible-name computation.
2025-01-09 14:08:23 +00:00
sideshowbarker
9f01eebff3 LibWeb: Add a to_element function to ARIAMixin
This change adds a virtual to_element function to ARIAMixin, and
overrides it in DOM::Element so it can then be used back inside
ARIAMixin to get an element when needed (for example, when computing a
role requires checking the roles of ancestors of an element).
2025-01-09 14:08:23 +00:00
Tim Ledbetter
81d6cd497a LibWeb: Validate AudioNode::disconnect() input and output arguments 2025-01-09 11:34:38 +00:00
Tim Ledbetter
5c57acf140 LibWeb: Validate AudioParam context in AudioNode::connect()
An exception is now thown if an `AudioNode` attempts to connect to an
`AudioParam` from a different `BaseAudioContext`.
2025-01-09 11:34:38 +00:00
Tim Ledbetter
2edd0812ca LibWeb: Validate AudioNode::connect() input and output arguments 2025-01-09 11:34:38 +00:00
Jelle Raaijmakers
e6334d217b LibWeb: Update implementation of Range::partially_contains_node()
This accurately reflects the spec it's implementing. This algorithm is
used in 5 spots in the spec but the old buggy behavior was never
triggered:

  * In both ::extract() and ::clone_the_contents(), invocations to this
    method are guarded by a check to see if the start node is the
    inclusive ancestor of the end node, or vice versa - effectively
    resulting in the inequality checks to be accidentally correct.

  * In ::surround_contents(), we forego the usage of this algorithm as
    stated in the spec, and instead use a correct and more optimized
    version that simply compares the start and end nodes.

A lot of words to say: no functional changes :^)
2025-01-09 10:15:55 +00:00
Tim Ledbetter
e469c884d4 LibWeb: Use correct ranges for BiquadFilterNode parameters 2025-01-08 19:05:51 +00:00
Nicolas Ramz
423d106fd8 LibJS: Support date strings of the form "Thu, 09 Jan 2025 23:00:00" 2025-01-08 18:45:43 +01:00
Tim Ledbetter
911cd4aefd LibWeb/WebAudio: Add BaseAudioContext.createDelay() factory method 2025-01-08 15:31:59 +00:00
Tim Ledbetter
6c4c925f02 LibWeb/WebAudio: Add DelayNode interface 2025-01-08 15:31:59 +00:00
Luke Wilde
71746c47c2 LibWeb/WebGL: Bind default frame/render buffer when binding is null
This fixes the depth issues on github.com, as the depth commands are
now sent to the right frame/render buffer.
2025-01-08 17:55:17 +03:00
Luke Wilde
e5d59a2d42 LibWeb/WebGL2: Implement getSyncParameter 2025-01-08 17:55:17 +03:00
Luke Wilde
49c966b4e7 LibWeb/WebGL2: Implement uniform{1,2,3,4}ui 2025-01-08 17:55:17 +03:00
Luke Wilde
2f26ade426 LibWeb/WebGL2: Implement copyBufferSubData 2025-01-08 17:55:17 +03:00
Luke Wilde
db2d8f8f17 LibWeb/WebGL2: Implement bindBufferRange 2025-01-08 17:55:17 +03:00
Luke Wilde
c30c1d65f4 LibWeb/WebGL2: Implement clearBuffer{fv,iv,uiv,fi} 2025-01-08 17:55:17 +03:00
Luke Wilde
f627c91bf3 LibWeb/WebGL2: Implement deleteSampler 2025-01-08 17:55:17 +03:00
Luke Wilde
09ad685238 LibWeb/WebGL2: Implement samplerParameter{i,f} 2025-01-08 17:55:17 +03:00
Luke Wilde
42cce393f4 LibWeb/WebGL2: Implement drawElementsInstanced 2025-01-08 17:55:17 +03:00
Luke Wilde
c05fa44cf8 LibWeb/WebGL2: Implement vertexAttribDivisor 2025-01-08 17:55:17 +03:00
Luke Wilde
b6bc5912d6 LibWeb/WebGL: Implement tex(Sub)Image2D with TexImageSource 2025-01-08 17:55:17 +03:00
Luke Wilde
f66f01ce53 LibWeb/WebGL: Implement getUniformBlockIndex 2025-01-08 17:55:17 +03:00
Luke Wilde
216d5b33be LibWeb/WebGL: Enforce minimum size when resizing existing context
Previously the enforcement was only done on creation. Not enforcing it
on change would cause a crash if the canvas width/height was set to
zero or less.
2025-01-08 17:55:17 +03:00
Luke Wilde
8e453d5069 LibWeb/WebGL: Preserve original bound objects to return in getParameter
Required by https://qwasm2.m-h.org.uk, which adds a custom `name`
attribute to objects it generates. It then gets some of these objects
out with getParameter, and expects the `name` attribute to be there.
2025-01-08 17:55:17 +03:00
Luke Wilde
c067271897 LibWeb/WebGL2: Implement getActiveUniformBlockParameter 2025-01-08 17:55:17 +03:00
Luke Wilde
191ceb0f61 LibWeb/WebGL2: Implement getActiveUniformBlockName 2025-01-08 17:55:17 +03:00
Luke Wilde
7957793863 LibWeb/WebGL2: Implement uniformBlockBinding 2025-01-08 17:55:17 +03:00
Luke Wilde
28a73dc392 LibWeb/WebGL: Implement deleteRenderbuffer 2025-01-08 17:55:17 +03:00
Luke Wilde
e26b524721 LibWeb/WebGL2: Implement invalidateFramebuffer 2025-01-08 17:55:17 +03:00
Luke Wilde
63b792c205 LibWeb/WebGL2: Implement bufferSubData with offset and length 2025-01-08 17:55:17 +03:00
Luke Wilde
18ea91715b LibWeb/WebGL2: Implement bufferData with offset and length 2025-01-08 17:55:17 +03:00
Tim Ledbetter
a6ab9cc983 LibWeb: Initialize AudioBufferSourceNode with correct defaults 2025-01-08 14:45:51 +00:00
Psychpsyo
9370990ff2 LibWeb: Implement user-select
This implements all values of user-select.
2025-01-08 14:37:28 +00:00
Sam Atkins
ba43dfe49a LibWeb/CSS: Remove use of Dimension in calc() parsing
Rather than partly-converting number, dimension, and ident tokens at the
start of parsing a calculation, and then later finishing it off, we can
just do the whole step in convert_to_calculation_node(). This is a
little less code, but mainly means we are left with only a single use
of the Dimension type in the codebase, so that can be removed soon.
2025-01-08 14:28:54 +00:00
Sam Atkins
5cda2ac961 LibWeb/CSS: Remove illegal <number-percentage> type
Various places in the spec allow for `<number> | <percentage>`, but this
is either/or, and they are not allowed to be combined like dimensions
and percentages are. (For example, `calc(12 + 50%)` is never valid.)

User code generally doesn't need to care about this distinction, but it
does now need to check if a calculation resolves to a number, or to a
percentage, instead of a single call.

The existing parse_number_percentage[_value]() methods have been kept
for simplicity, but updated to check for number/percentage separately.
2025-01-08 14:28:54 +00:00
Sam Atkins
ab5ac82db6 LibWeb/CSS: Parse dimension and number types individually
An upcoming change requires that we can determine which property we are
parsing before we parse the value. That's the opposite of what this
code previously did, which was to parse a generic dimension or calc()
and then figure out what property would accept it.
2025-01-08 14:28:54 +00:00
Sam Atkins
87da0453c8 LibWeb/CSS: Use parse_length_percentage() in parse_position_value()
Also some minor TokenStream-usage tweaks to make that possible.
2025-01-08 14:28:54 +00:00