Commit graph

66580 commits

Author SHA1 Message Date
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
Nicolas Ramz
0d92cd1f36 UI/AppKit: Add debug menu to clear all cookies 2025-01-10 14:57:26 +00: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
Shannon Booth
80e8313880 Tests/LibWeb: Import webidl current realm WPT test 2025-01-10 08:08:46 +00:00
Sam Atkins
c86ad5c505 AK: Make ScopeGuard and ArmedScopeGuard [[nodiscard]]
Brought to you by a significant amount of pain and suffering, which this
would have prevented.
2025-01-09 18:36:34 +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
Ivan Zuzak
36190e3baf AK: Optimize performance in GenericShorthands via forwarding references
Functions in AK/GenericShorthands used pass-by-value which results in
copying values when calling those functions. This could be expensive
for complex types. To optimize performance, we switch the functions to
use forwarding references.
2025-01-09 09:03:50 +01:00
Ivan Zuzak
49fc569136 AK: Add tests for GenericShorthands 2025-01-09 09:03:50 +01: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
876d26c32e LibWeb/WebGL: Respect subarrays in readPixels 2025-01-08 17:55:17 +03: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
6bf6cd3f19 LibWeb/WebGL: Account for subarrays in tex(Sub)Image{2D,3D}
This allows Ruffle to correctly upload textures.
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
2b20b8aaff LibWeb/WebGL: Return correct types from get{Shader,Program}Parameter
Returning numbers instead of booleans for the statuses made Ruffle
(through the wgpu crate) think a shader/program failed to compile/link,
as it does a strict type comparison.
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