Commit graph

62850 commits

Author SHA1 Message Date
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
Timur Sultanov
afb2e063b7 LibWeb: Set the first added <option> element under <select> as selected 2024-07-25 16:58:12 +02:00
Timur Sultanov
d1a7caa35d LibWeb: Use queue_a_task() function to queue an element task
Remove direct usage of task_queue() and use a helper function instead
2024-07-25 16:58:12 +02:00
Timur Sultanov
93b6334966 LibWeb: Schedule Microtasks on Microtask queue 2024-07-25 16:58:12 +02:00
Tim Ledbetter
3802d9ccc4 LibWeb: Calculate length for all CharacterData type nodes correctly
We now ensure that `Node::is_character_data()` returns true for all
nodes of type character data.

Previously, calling `Node::length()` on `CDataSection` or
`ProcessingInstruction` nodes would return an incorrect value.
2024-07-25 15:57:21 +01:00
Tim Ledbetter
f8b1e96e2b LibWeb: Assert that cloned node is not null before returning
This makes potential issues easier to track down.
2024-07-25 15:57:21 +01:00
Tim Ledbetter
72ed62a560 LibWeb: Don't crash when cloning a CDATASection node 2024-07-25 15:57:21 +01:00
paaspaas00
cdfc7a92f7 LibWeb: Fix typo "rtr" -> "rtl" 2024-07-25 14:51:26 +01:00
Andreas Kling
007c292af3 LibWeb: Execute the correct script in XMLDocumentBuilder::element_end()
We were mistakenly executing the current node's script instead of the
document's pending parsing-blocking script.

This caused ~1000 WPT tests to time out, since we never ended up firing
a load event for XHTML pages that load multiple external scripts.
2024-07-25 15:05:28 +02:00
Andreas Kling
b011d47b86 LibCore: Guess MIME type of .xhtml files to be application/xhtml+xml 2024-07-25 15:05:28 +02:00
Aliaksandr Kalenik
61da1236e7 LibWeb: Add a very basic glyph texture cache in Skia painter
This prevents repeated uploading of the same glyph textures into
GPU-memory.
2024-07-25 14:33:33 +02:00
Aliaksandr Kalenik
67d68eac64 LibWeb: Save "background-clip: text" mask as a nested display list
Before this change, "background-clip: text" was implemented by saving a
Vector<Gfx::Path> of all glyphs needed to paint a mask for the
background. The issue with this approach was that once glyphs were
extracted into vector paths, the glyph rasterization cache could no
longer be utilized.

With this change, all text required for mask painting is saved in a
nested display list and rasterized as a regular text.
2024-07-25 14:33:33 +02:00
Aliaksandr Kalenik
50ab5642cc LibWeb: Make DisplayList ref-counted
This change is a preparation for the upcoming changes where display
list will be nested and the same display could be owned by multiple
display list items.
2024-07-25 14:33:33 +02:00
Aliaksandr Kalenik
e8b7c88881 LibWeb: Move display list command dispatch into player
With this change display list player will be able to recurse into
executing another display list, without having to construct new display
list player. It is going to be useful in the upcoming changes to paint
a mask from a display list owned by a command.
2024-07-25 14:33:33 +02:00
Tim Ledbetter
5a796629c6 LibWeb: Make document.createElementNS() case-sensitive
Previously, when creating a HTML element with
`document.createElementNS()` we would convert the given local name to
lowercase before deciding which element type to return. We now no
longer perform this lower case conversion, so if an uppercase local
name is provided, an element of type `HTMLUnknownElement` will be
returned. This aligns our implementation with the specification.
2024-07-25 13:12:34 +02:00