Commit graph

62914 commits

Author SHA1 Message Date
Jamie Mansfield
b7f0241ab5 LibWeb: Use "en" as a fallback when setting preferred languages
This will set the preferred languages to [ "en" ] if an empty list is
provided.
2024-07-27 08:18:16 +02:00
Jamie Mansfield
7b105e1ecf LibWeb: Add a default for the navigator's languages
This will mean that non-Qt frontends don't return an empty array.
2024-07-27 08:18:16 +02:00
Andrew Kaster
89a4fa4d24 CI: Only run clang plugins workflow on pushes to master
Enabling the plugins makes the job take ~1h even for small changes.
2024-07-26 13:40:50 -06:00
Andreas Kling
2daaa22a15 LibWeb: Stop trying to guess include paths in IDL codegen
It turns out we were already generating all the necessary include
statements, and we can simply remove all this goofy code soup that
uses the C preprocessor to speculatively look for include files.
2024-07-26 17:33:29 +02:00
Sam Atkins
59778d2b36 LibWeb/CSS: Make CSS Parser::create() infallible
Now that `Tokenizer::tokenize()` just returns a String, there are no
errors to propagate, and we can simplify the user code a bit.
2024-07-26 17:29:20 +02:00
Sam Atkins
89c5f25016 LibWeb/CSS: Remove tiny-oom propagation from CSS Tokenizer 2024-07-26 17:29:20 +02:00
Shannon Booth
22969a8e92 Bindings: Avoid second property index lookup for platform objects
While conceptually is_supported_property_index is a cheap index lookup,
it is not currently cheap for an container such as HTMLAllCollection
that is operating on an uncached collection. Instead - just do the
lookup once. It also happens to look a little nicer to not blindly
dereference an optional.
2024-07-26 14:26:16 +02:00
Shannon Booth
8a5985b87f Bindings: Use is_supported_property_name instead of contains_slow
This uses a faster hashtable lookup in the case of HTMLCollection.

Also port invoke_named_property_setter to FlyString to avoid a
FlyString->String->FlyString conversion that surfaces from this change.
2024-07-26 14:26:16 +02:00
Shannon Booth
9b1af542e7 Bindings: Implement is_supported_property_index in terms of item_value
Greatly simplifying the code :^)
2024-07-26 14:26:16 +02:00
Shannon Booth
c5c1a8fcc7 Bindings: Make item_value return an Optional<JS::Value>
This removes some ambiguity about what the return value should be if
the index is out of range.

Previously, we would sometimes return a JS null, and other times a JS
undefined.

It will also let us fold together the checks for whether an index is a
supported property index, followed by getting the value just afterwards.
2024-07-26 14:26:16 +02:00
Shannon Booth
9b59dc5e8b Bindings: Remove exception handling for named_item_value 2024-07-26 14:26:16 +02:00
Shannon Booth
081c92bf3d Bindings: Remove exception handling for named_item
We don't need this for any case, so just remove it to simplify handling
in PlatformObject.
2024-07-26 14:26:16 +02:00
Andreas Kling
273593afba LibWeb: Don't proceed with Element.click() on disabled form controls
Fixes an infinite reload loop on some of the dom/events/ tests in WPT.
2024-07-26 14:25:04 +02:00
Sam Atkins
696ccc1aa9 LibWeb: Prevent elements with no layout box from modifying counters 2024-07-26 11:04:30 +01:00
Sam Atkins
898e3bd898 Last: LibWeb: Add counter() and counters() functions to content property
These let you format counters' current values as strings for use in
generated content.
2024-07-26 11:04:30 +01:00
Sam Atkins
576a431408 LibWeb: Implement CounterStyleValue
This is `counter(name, style?)` or `counters(name, link, style?)`. The
difference being, `counter()` matches only the nearest level (eg, "1"),
and `counters()` combines all the levels in the tree (eg, "3.4.1").
2024-07-26 11:04:30 +01:00
Sam Atkins
017d6c3314 LibWeb: Implement counter-[increment,reset,set] properties
These control the state of CSS counters.

Parsing code for `reversed(counter-name)` is implemented, but disabled
for now until we are able to resolve values for those.
2024-07-26 11:04:30 +01:00
Sam Atkins
4c42e93853 LibWeb: Format Properties.json 2024-07-26 11:04:30 +01:00
Sam Atkins
ca10fb4129 LibWeb/CSS: Refactor contains_single_none_ident() to actually parse it
The new method is Parser::parse_all_as_single_none_value(), which has a
few advantages:

1. There's no need for user code to manually create a StyleValue.
2. It consumes tokens so that doesn't have to be done manually.
3. Whitespace before or after the `none` is consumed correctly.

It does mean we create and then discard a `none` StyleValue in a couple
of places, namely parsing for `grid-*` properties. We may or may not
want to migrate those to returning the IdentifierStyleValue instead.
2024-07-26 11:04:30 +01:00
Sam Atkins
6f2f91d1f5 LibWeb: Stop computing content in NodeWithStyle::apply_style()
This seems to have been required when pseudo-elements were first
implemented, but has since become unused. It's also awkward because we
don't have access to the DOM Element and its CountersSet at this point.
So, let's remove it.

For reference, Chrome&Firefox both return the computed value for
`content: counter(foo)` as `counter(foo)`, not as the computed string.
So not computing it here seems like the intended behaviour.
2024-07-26 11:04:30 +01:00
Sam Atkins
708f49d906 LibWeb: Give DOM Elements a CountersSet
This represents each element's set of CSS counters.
https://drafts.csswg.org/css-lists-3/#css-counters-set

Counters are resolved while building the tree. Most elements will not
have any counters to keep track of, so as an optimization, we don't
create a CountersSet object until the element actually needs one.

In order to properly support counters on pseudo-elements, the
CountersSet needs to go somewhere else. However, my experiments with
placing it on the Layout::Node kept hitting a wall. For now, this is
fairly simple at least.
2024-07-26 11:04:30 +01:00
Kenneth Myhra
a744a9ebe7 LibWeb: Append fetch record to client's fetch group when request is a
...subresource.
2024-07-26 10:22:17 +02:00
Kenneth Myhra
e36607bdba LibWeb: Add spec link to fetch group concept 2024-07-26 10:22:17 +02:00
Kemal Zebari
c5f1e47883 LibWeb: Implement Blob::bytes()
Implements https://w3c.github.io/FileAPI/#dom-blob-bytes.
2024-07-26 10:21:32 +02:00
Timur Sultanov
1ce9bbdd6d Tests: Add test for selection option in <select>
Verify that we can select option using JS
2024-07-26 09:15:39 +01:00
Timur Sultanov
ad7b2b7c26 LibWeb: Improve HTMLSelectElement spec compliance
Set default `size` value according to spec
2024-07-26 09:15:39 +01:00
Timur Sultanov
9d4f3c938f LibWeb: Improve HTMLOptionElement spec compliance
Implement ask_for_a_reset() function
2024-07-26 09:15:39 +01:00
Timur Sultanov
f4102b1dc9 LibWeb: Implement selectedness algorithm
Implement selectedness setting algorithm in HTMLSelectElement
2024-07-26 09:15:39 +01:00
doctortheemh
9cbb3fac12 LibWeb: Parse fill and stroke values
Use the CSS color data type using the CSS parser.
2024-07-26 09:14:09 +01:00
Jamie Mansfield
793248aec9 LibWeb/HTML: Implement HTMLMediaElement.addTextTrack
Removes some noise from the console when browsing bbc.co.uk :^)
2024-07-26 09:30:19 +02:00
Jamie Mansfield
ff08c2f735 LibWeb/HTML: Add readiness state to TextTrack 2024-07-26 09:30:19 +02:00
Jamie Mansfield
4b16f1df05 LibWeb/HTML: Implement TextTrack.mode 2024-07-26 09:30:19 +02:00
Tim Ledbetter
97436e7d65 Tests: Add test for Node.nodeName 2024-07-26 07:19:23 +02:00
Tim Ledbetter
ea2bb52962 LibWeb: Make DocumentType::node_name() return DocumentType::name()
This aligns our implementation with the specification.
2024-07-26 07:19:23 +02:00
sideshowbarker
cdb9081a86 LibWebView: Emit “submit an issue” suggestion when Ladybird crashes 2024-07-25 18:37:02 -06:00
Andrew Kaster
05e1b54e97 CI: Enable Clang plugins for Linux Clang job 2024-07-25 18:35:57 -06:00
Andrew Kaster
15d60779a9 Tests: Update ClangPlugins tests for current clang version
Something is up with the plugin option and the current version of lit,
so XFAIL the test for that for now.
2024-07-25 18:35:57 -06:00
Andrew Kaster
24ff698914 ClangPlugins: Don't build plugins with sanitizers 2024-07-25 18:35:57 -06:00
Andrew Kaster
cdffc4238a WebContent: Ignore GC for page client member of BackingStoreManager
This is very non-ideal, but the use of a reference for this member is
technically ok in its current usage as a member of the PageClient
itself.
2024-07-25 18:35:57 -06:00
Andrew Kaster
b73bd76571 LibWeb: Visit the DataTransfer member of DragEvent 2024-07-25 18:35:57 -06:00
Andrew Kaster
f314f58fca LibJS+ClangPlugins: Add escape hatch for GCPtr checks 2024-07-25 18:35:57 -06:00
Andrew Kaster
7f953a8519 ClangPlugins: Enable building in release mode with current warnings 2024-07-25 18:35:57 -06:00
sideshowbarker
8affa377fb Documentation: Add guidance on “can’t find Ninja” error message 2024-07-25 20:57:32 +01:00
Andrew Kaster
88176d4be2 LibThreading: Guard closing the background thread on the thread existing
This prevents a crash in ImageDecoder when it's closed before any
image decoding requests have been made.
2024-07-25 20:55:31 +01:00
Andreas Kling
de2b9eebe6 LibWeb: Inherit CSS variables across shadow boundaries
This fixes a bunch of issues on https://wpt.fyi/
2024-07-25 21:38:32 +02:00
Tim Schumacher
cf6929fef3 Meta: Guard everything that installs headers with an option 2024-07-25 13:25:09 -06:00
Tim Schumacher
ffc03eb25a Tests: Do not install LibMedia test files 2024-07-25 13:25:09 -06:00
Andreas Kling
d49ae5af32 LibWeb: Make offsetTop and offsetLeft behave more like other browsers
We now follow the rules from the spec more closely, along with an
unspecified quirk for when the offsetParent is a non-positioned body
element. (Spec bug linked in a comment.)

This fixes a whole bunch of css-flexbox tests on WPT, which already had
correct layout, but the reported metrics from JS API were wrong.
2024-07-25 18:52:04 +02:00
sideshowbarker
34583902dc Meta: Add guidance on how to write reduced test cases 2024-07-25 16:59:09 +02:00
Timur Sultanov
2bf37cb914 Tests: Add tests for <select> element behavior
Check that `<select>` element has options available immediately
2024-07-25 16:58:12 +02:00