Commit graph

34317 commits

Author SHA1 Message Date
Tim Ledbetter a88effd0fe LibWeb: Follow the specification steps to serialize a DOMTokenList
This ensures that calling `element.classList.toString()` always
produces the correct value.

(cherry picked from commit ec1f7779cb16223dab0ef9f7bf875c3f7b5724a9)
2024-07-28 14:13:20 -04:00
Tim Ledbetter 66280e96e9 LibWeb: Update Element class list is when class attribute is removed
(cherry picked from commit 21e21abeed122b8b9ebd1bb98ad2201d7edae4f7)
2024-07-28 14:13:20 -04:00
Tim Ledbetter a439fe0d5b 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.

(cherry picked from commit 5a796629c61221261c1856e19dd829973e6158f0)
2024-07-28 14:13:11 -04:00
Shannon Booth 303e13046a 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.

(cherry picked from commit 22969a8e929eae00a45989acae99eb5a97269358)
2024-07-28 14:12:04 -04:00
Shannon Booth 9203a8d46b 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.

(cherry picked from commit 8a5985b87f618120ce891bfbe87786381654af25)
2024-07-28 14:12:04 -04:00
Shannon Booth 1ffbd29683 Bindings: Implement is_supported_property_index in terms of item_value
Greatly simplifying the code :^)

(cherry picked from commit 9b1af542e7a718d110786551a1a18914cc386a2d)
2024-07-28 14:12:04 -04:00
Shannon Booth 930725ce8d 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.

(cherry picked from commit c5c1a8fcc78af986e5dd1a1f0bef1223e458ed37)
2024-07-28 14:12:04 -04:00
Shannon Booth daa4dc63f5 Bindings: Remove exception handling for named_item_value
(cherry picked from commit 9b59dc5e8b88d311089e57fe134a1377a39242cb)
2024-07-28 14:12:04 -04:00
Shannon Booth 7bcb02822e Bindings: Remove exception handling for named_item
We don't need this for any case, so just remove it to simplify handling
in PlatformObject.

(cherry picked from commit 081c92bf3dc66773887243718cf41011289ac55e)
2024-07-28 14:12:04 -04:00
Andreas Kling 91bca10aa3 LibWeb: Only inject "User-Agent"/"Accept" headers when they're missing
...otherwise we send out HTTP requests with duplicates of these headers.

(cherry picked from commit 847243b7065b80739fdd4d015bc6559b0581bb66)
2024-07-28 14:11:20 -04:00
Sam Atkins fc6c6573b1 LibWeb: Prevent elements with no layout box from modifying counters
(cherry picked from commit 696ccc1aa992fdd7e22a44571d8be7d89738261d)
2024-07-28 13:31:02 -04:00
Sam Atkins 6ab5a043e6 Last: LibWeb: Add counter() and counters() functions to content property
These let you format counters' current values as strings for use in
generated content.

(cherry picked from commit 898e3bd89878ddb87df06e056031673dc770be2b)
2024-07-28 13:31:02 -04:00
Sam Atkins 07fe3e57c6 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").

(cherry picked from commit 576a4314084e5c3b839006da00dddb16e58b3503)
2024-07-28 13:31:02 -04:00
Sam Atkins 1bc896fa60 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.

(cherry picked from commit 017d6c3314d57d4e351764f328c1d25dbc9d033a)
2024-07-28 13:31:02 -04:00
Sam Atkins 491b2632df LibWeb: Format Properties.json
(cherry picked from commit 4c42e93853541db2a2f87179e3bb1688811655d0)
2024-07-28 13:31:02 -04:00
Sam Atkins bab7f225c6 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.

(cherry picked from commit ca10fb412947f6b6080326573418bfa8a3759c12)
2024-07-28 13:31:02 -04:00
Sam Atkins b2333ad4cf 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.

(cherry picked from commit 6f2f91d1f50130b6060ccfb1af1faaa890e81618)
2024-07-28 13:31:02 -04:00
Sam Atkins e06d74c314 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.

(cherry picked from commit 708f49d906389f8875f006894e2aacf2305834bf)
2024-07-28 13:31:02 -04:00
Jamie Mansfield b1ebaee65f LibWeb/DOM: Check if name is valid in Element.toggleAttribute
This resolves a test in https://wpt.live/dom/nodes/attributes.html.

(cherry picked from commit f774d75f890e89a8483e5c7459de4fd96ce1b479)
2024-07-28 13:17:47 -04:00
Ali Mohammad Pur ed5c5de25a Utilities/js: Make it possible to exit via two consecutive ^C's
Apparently this is common in the js repl world.
Fixes #743.

(cherry picked from commit d3f089dc268931e670ea6a00ac8bcb06ed9822e6)
2024-07-28 13:06:44 -04:00
Sam Atkins c847487f30 LibWeb: Reserve enough space for span>1 columns in BorderConflictFinder
This code previously only allocated enough space in
m_col_elements_by_index for 1 slot per column, meaning that columns
with a span > 1 would write off the end of it.

(cherry picked from commit 9e32c9329acd89d73eeff3494a5e728077962513)
2024-07-28 13:00:11 -04:00
Sam Atkins 1ea6e6c395 LibWeb: Correct logic for removing end nodes from HTMLOptionsCollection
This test case would previously crash.

Found with domato.

(cherry picked from commit 0cec68ea996623ee652900986c7232c8d538a209)
2024-07-28 13:00:11 -04:00
Timur Sultanov 9e36f7c86c LibWeb: Improve HTMLSelectElement spec compliance
Set default `size` value according to spec

(cherry picked from commit ad7b2b7c26c343504be32b9da8961e4fb5df3e86)
2024-07-28 12:59:58 -04:00
Timur Sultanov 54afd8bdc9 LibWeb: Improve HTMLOptionElement spec compliance
Implement ask_for_a_reset() function

(cherry picked from commit 9d4f3c938fd182d5cd195beefb1adf4d1bde376b)
2024-07-28 12:59:58 -04:00
Timur Sultanov 8344a54408 LibWeb: Implement selectedness algorithm
Implement selectedness setting algorithm in HTMLSelectElement

(cherry picked from commit f4102b1dc99c9bb1ec012106d28a35e03a6faea3)
2024-07-28 12:59:58 -04:00
Nico Weber 6ab69b1cc1 LibGfx/WebPWriterLossless: Use predictor transform
...for images that don't use a color indexing transform.

For now, write the predictor transform unconditionally, and predict
every pixel as its left neighbor (that is, use predictor 1 everywhere).

This will grow a better heuristic in time, and eventually we might want
to use more than 1 of the 13 different predictor modes. But on average,
doing this unconditionally is better than not doing it unconditionally.
(Also, it's possible to disable this transform using `image`'s
`--webp-allowed-transforms` flag.)

Using the same benchmark as in #24819, this reduces the total size
of the test images further, from 88M to 69M (21.6%). It does increase
runtime for compressing all these images from about 4.4s to 4.7s,
a 6.8% slowdown.

For the usual test image (no effect on the two animations, which use
the color indexing transform):

    sunset_retro.png (876K):
        1.2M -> 730K, 31.4 ms ± 0.8 ms -> 31.4 ms ± 0.7 ms

From 37% larger than the input to 16% _smaller_ than the input :^)
(A 39% size reduction for this image.)

Compressing sunset_retro.png with zopflipng produces a 820K image,
so we're smaller even than what the best PNG encoder can do with
this image.

It's not a win for all images: For example, the size of
qoi_benchmark_suite/screenshot_web/sublime.png goes from 1.0M to 1.5M,
a fairly dramatic size increase. Hopefully we can get that back in
the future with better heuristics. (The input sublime.png is 1.3M,
and sublime.png encoded using our QOI encoder creates a 1.6M file,
so the 1.5M isn't atrocious, even though it's much bigger than the
size without the predictor transform.)

Our WebP Lossless writer currently now has a similar feature set
to our QOI writer: RLE, color cache, left prediction, and
subtract green is somewhat similar to QOI's luma chunk. The WebP
writer also writes huffman trees, which QOI doesn't do. For most
images, the WebP writer creates smaller files than the QOI writer,
while being about 50% slower. The WebP writer also writes smaller
files than Serenity OS's png writer, while being ~40x as fast
(for sunset_retro, ~30ms instead of ~1.3s; 730K output instead of
999K).

Only doing RLE and using a single predictor for the entire image is
similar to what fpng is doing (...but fpng uses the T predictor always).

We still don't write a meta prefix image to keep the huffman trees
flatter, we still don't do full LZ77 backward matches, and we still
don't write color transforms. But the writer has now enough features
to be in usable shape. It's now Serenity OS's best-compressing lossless
image writer.

The test_webp_color_indexing_transform_single_channel test uses a
linear horizontal gradient, which the predictor transform compresses
so well that encoded_data_without_color_indexing ends up being
smaller than the color indexed file. Just disable the predictor
transform in that test for now.
2024-07-28 12:35:41 -04:00
Andreas Kling 94c1066f68 LibWeb: Inherit CSS variables across shadow boundaries
This fixes a bunch of issues on https://wpt.fyi/

(cherry picked from commit de2b9eebe6012e321c85cdae0ca14b4be40de624)
2024-07-28 07:33:15 -04:00
Jamie Mansfield a28019e98b LibWeb/HTML: Implement HTMLMediaElement.addTextTrack
Removes some noise from the console when browsing bbc.co.uk :^)

(cherry picked from commit 793248aec977d4b15006d6e55a960da2e115a734,
amended to s/UIEvents::KeyCode/KeyCode/ to resolve cherry-pick conflict)
2024-07-28 07:32:58 -04:00
Jamie Mansfield 62caf51004 LibWeb/HTML: Add readiness state to TextTrack
(cherry picked from commit ff08c2f735e938c8280089eca690fd5e65d017c1)
2024-07-28 07:32:58 -04:00
Jamie Mansfield b24f6bc13b LibWeb/HTML: Implement TextTrack.mode
(cherry picked from commit 4b16f1df05208e3ae15e4b2d2096e50045597252)
2024-07-28 07:32:58 -04:00
doctortheemh 5d1beff35f LibWeb: Parse fill and stroke values
Use the CSS color data type using the CSS parser.

(cherry picked from commit 9cbb3fac123d0ce12bc1d0127d22ed26417dffd7)
2024-07-28 07:32:47 -04:00
Tim Ledbetter 8c56eb0743 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.

(cherry picked from commit 3802d9ccc4ea4428b82c6d584c3667c040cb46c7)
2024-07-28 07:32:31 -04:00
Tim Ledbetter 25325e7ce9 LibWeb: Assert that cloned node is not null before returning
This makes potential issues easier to track down.

(cherry picked from commit f8b1e96e2be0682e67f574f8a723e51cea9642a9)
2024-07-28 07:32:31 -04:00
Tim Ledbetter 6a6c0ae791 LibWeb: Don't crash when cloning a CDATASection node
(cherry picked from commit 72ed62a560c654370e6a3583bc8bd078732f44db)
2024-07-28 07:32:31 -04:00
Andreas Kling a8a5463d33 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.

(cherry picked from commit d49ae5af32044cb83bc14073b92676a1662c3bc1)
2024-07-28 07:32:17 -04:00
Tim Ledbetter 19380be618 LibWeb: Make DocumentType::node_name() return DocumentType::name()
This aligns our implementation with the specification.

(cherry picked from commit ea2bb52962d958f2c9d374867452e95217ccaa76)
2024-07-28 07:32:04 -04:00
Edwin Hoksberg dd843ae282 LibWeb: Implement grid-template function fit-content()
(cherry picked from commit e5deaa1c073f4762fe2cdc7d36f90099f0ca4d11)
2024-07-28 07:31:47 -04:00
Edwin Hoksberg 95ea566850 LibWeb: Move css_clamp function to FormattingContext
Since we need it in the FlexFormattingContext and
GridFormatting context now.

(cherry picked from commit de84e6f93ac910569eba2627267c779852975495)
2024-07-28 07:31:47 -04:00
Kenneth Myhra d15dc82b15 LibWeb: Append fetch record to client's fetch group when request is a
...subresource.

(cherry picked from commit a744a9ebe7c3ff8134d9e529b4d0436ae5ed5f02)
2024-07-28 07:31:26 -04:00
Kenneth Myhra d7927aec19 LibWeb: Add spec link to fetch group concept
(cherry picked from commit e36607bdbacef9a829b28ef618c048026a6d6d5f)
2024-07-28 07:31:26 -04:00
Andreas Kling 20a9c3b238 LibWeb: Cache name->element mappings in HTMLCollection
This makes https://wpt.fyi/ load today instead of tomorrow, although
there's a lot of room for improvement still.

(cherry picked from commit 4d78c66b3d0092d0e6137a11d55e59a6b8bfc5b1)
2024-07-28 07:30:54 -04:00
Andreas Kling de66b176d1 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.

(cherry picked from commit 007c292af3202a85eb146b121720d988a66ed64b)
2024-07-28 07:30:38 -04:00
Andreas Kling 582ab50fe7 LibCore: Guess MIME type of .xhtml files to be application/xhtml+xml
(cherry picked from commit b011d47b86289e558253d776f1770e8ad871a4bc)
2024-07-28 07:30:38 -04:00
paaspaas00 73f7b56ca5 LibWeb: Fix typo "rtr" -> "rtl"
(cherry picked from commit cdfc7a92f72165ad530bfaf920f1caf18974692f)
2024-07-28 07:30:26 -04:00
Timur Sultanov 0506847101 LibWeb: Set the first added <option> element under <select> as selected
(cherry picked from commit afb2e063b7cd4f3e7c291975a703c8d843fab18b)
2024-07-28 07:30:11 -04:00
Timur Sultanov 629aaabb0d LibWeb: Use queue_a_task() function to queue an element task
Remove direct usage of task_queue() and use a helper function instead

(cherry picked from commit d1a7caa35d860f9ac425021dfa8d55b3ea0242b5)
2024-07-28 07:30:11 -04:00
Timur Sultanov 5160b88e1e LibWeb: Schedule Microtasks on Microtask queue
(cherry picked from commit 93b6334966a17fe8622615f3dd701206b7d02e14)
2024-07-28 07:30:11 -04:00
Andreas Kling 99a06079ce 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.

(cherry picked from commit 273593afba71a42f1d760ac5b6664b77f74ffb7a)
2024-07-28 07:29:46 -04:00
Kemal Zebari ddefb5a822 LibWeb: Implement Blob::bytes()
Implements https://w3c.github.io/FileAPI/#dom-blob-bytes.

(cherry picked from commit c5f1e478838092dcf6e4ad8ee0bfef32a47e2d68)
2024-07-28 07:29:31 -04:00
Sam Atkins d8dafd6b28 LibWeb: Check CanvasTextDrawingStyles.font assignment is valid
Checking that the string parsed for the `font` property is not enough,
the spec also wants to rule out CSS-wide keywords like `inherit`. The
simplest way to do so is to check if it's a ShorthandStyleValue, which
also rules out use of `var()`; this matches other browsers' behaviour.

The newly-added test would previously crash, and now doesn't. :^)

(cherry picked from commit 64d45afd8a650981d4dbab98aa49d47629568f5b)
2024-07-27 22:54:40 -04:00
Alec Murphy 27d1b896f5 Mail: Remove CRLF chars from base64 data before decoding
This PR removes the CRLF characters from the message body data before
passing it to `decode_base64()` so that we can properly display the
message contents.
2024-07-27 22:54:00 -04:00
Andreas Kling c2fce0f19c LibWeb: Implement :host and :host(<compound-selector>) selector matching
The :host family of pseudo class selectors select the shadow host
element when matching against a rule from within the element's shadow
tree.

This is a bit convoluted due to the fact that the document-level
StyleComputer keeps track of *all* style rules, and not just the
document-level ones.

In the future, we should refactor style storage so that shadow roots
have their own style scope, and we can simplify a lot of this.

(cherry picked from commit 4c326fc5f6f64797764e7f32a9789b74665f2fec)
2024-07-27 22:53:52 -04:00
Andreas Kling 0b30b73e85 LibWeb: Don't infer descendant combinator for <compound-selector>
This fixes an issue where :host(foo) would parse as if "foo" was the
on the right side of a descendant combinator.

Not testable yet, but will be in the next commit.

(cherry picked from commit 274c46a3c97e1f9969d18b7704ced4c39770e152)
2024-07-27 22:53:52 -04:00
Mohamed amine Bounya 6bec376d1d LibWeb: Bring 'construct_entry_list' closer to specs
(cherry picked from commit 6e77fff698e1bbb5443c7071d81cb26aaf5f5153)
2024-07-27 22:50:52 -04:00
Alec Murphy 430c6cc43d LibIMAP: Handle escaped quotes in parse_quoted_string()
This PR fixes truncation of quoted strings containing escaped quotes,
which were not being handled properly by the parser, resulting in
occasional crashes.
2024-07-27 17:33:50 -04:00
Andreas Kling 80b06d464f LibWeb: Make details and summary elements display:block in the UA style
This is the expected behavior per the HTML spec. Fixes an issue where
styling these elements wouldn't have the expected effect unless you also
set the display property.

(cherry picked from commit 3faff34bf6a290e4df1c73f92e8c7d992a78a8e0)
2024-07-27 15:13:37 -04:00
Andreas Kling 7021616873 LibTextCodec: Use String::from_utf8() when decoding UTF-8 to UTF-8
This way, we still perform UTF-8 validation, but don't go through the
slow generic code path that rebuilds the decoded string one code point
at a time.

This was a bottleneck when loading a canned copy of reddit.com, which
ended up being ~120 MiB large.

- Time spent decoding UTF-8 before this change: 1192 ms
- Time spent decoding UTF-8 after this change:  154 ms

That's still a long time, but 7.7x faster is nothing to sneeze at! :^)

Note that if the input fails UTF-8 validation, we still fall back to
the slow path and insert replacement characters per the WHATWG Encoding
spec: https://encoding.spec.whatwg.org/#utf-8-decode

(cherry picked from commit 1a46d8df5fc81eb2c320d5c8a5597285d3d8fb3a)
2024-07-27 15:13:16 -04:00
simonkrauter 4dadfd851c LibWeb: Use absolute padding box to calculate max scroll offset
In `PaintableBox::set_scroll_offset()` the scrollport size was measured
by `content_size()` instead of `absolute_padding_box_rect()`.

Fixes #788

(cherry picked from commit 54066ec5a454f33d8c5e4ea1f8695942b95b1b82)
2024-07-27 15:12:36 -04:00
Nico Weber 52b457cf75 LibGfx/WebPWriterLossless: Use subtract green transform by default
...except for images that already use a color indexing transform
or are constant-alpha grayscale.

This makes some images larger, but it's on average better than
not doing it: When compressing all images in:

* Base/res/wallpapers
* qoi_benchmark_suite/screenshot_web
* qoi_benchmark_suite/textures_photo

...this reduces the combined output size from 105M to 88M (16%).
See PR for details on reproducing this.

(Runtime for compressing all images increases from a little under
4.4s to a little over 4.4s, so no big per cost either.)

For the images in those directories, it's even always a win.
The size of qoi_benchmark_suite/textures_pk01/pk01_floor01_local.png
increases from 366K to 375K (2.5%), so it's not _always_ a win.
Total size of qoi_benchmark_suite/textures_pk01 increases by 0.6%,
small enough that `du -sh` output is identical for that directory.

    sunset_retro.png (876K):
        1.4M -> 1.2M, 31.3 ms ± 0.7 ms -> 31.4 ms ± 0.8 ms

From 60% larger than the input file to 37% larger (13.3% smaller),
for a less-than-1% slowdown.

(The size of my two test gifs doesn't change, since those use the
color indexing transform.)
2024-07-27 13:31:31 -04:00
Nico Weber e2722dcf46 LibGfx/WebPWriterLossless: Write smaller grayscale images
We used to write a color indexing transform for grayscale images.
This stores a palette and then indexes into that palette.

For grayscale images with constant alpha, we don't need to store
the palette image: Using a subtract green transform has the same effect.

(For animations, most frames don't have constant alpha because
AnimationWriter replaces identical pixels with transparent black,
making sure that these frames have a mix of opaque and transparent
pixels. But the first frame of a grayscale animation will use this.)

Only saves a couple of bytes for storing the palette image,
but it's also free in term of performance, and it's conceptually
pleasing.

Reduces the size of 7z7c.webp by 30 bytes, from 8818 to 8788 bytes.
2024-07-27 13:31:31 -04:00
Alec Murphy 787d8344d9 LibIMAP: Properly parse parenthesized address lists
This PR fixes a crash where the parser assumes parenthesized lists of
address structures should be separated by whitespace. Per RFC-9051,
there is no indication of this.
2024-07-27 13:20:25 -04:00
Alec Murphy dd59bfd52b LibIMAP: Avoid crashing on Group Addresses
This PR avoids crashing the parser when a group address is encountered,
and keeps the Mail reader happy :^).

Eventually, when we are able to send messages, we may want some kind of
GroupAddress object, but for now this should be ok.
2024-07-27 10:26:37 -04:00
Alec Murphy ccfcc8112d Mail: Don't spam commands on mailbox node selection
This PR fixes a bug where selecting a mailbox node would send multiple
repeated IMAP commands, ultimately hanging the parser.
2024-07-26 19:15:58 +01:00
Edwin Hoksberg a4ed72afae LibWeb: Implement Element::check_visibility
(cherry picked from commit 5f154ba372f9a667351a026aa4a31306c45fd2a5)
2024-07-24 08:08:15 -04:00
Edwin Hoksberg fd17cbe54d LibWeb: Resolve content-visibility fixme in html details element
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
(cherry picked from commit 0ae048102cf43e961fb5346bf5b9ca8072a3c856)
2024-07-23 21:15:27 -04:00
Edwin Hoksberg 360cea781b LibWeb: Support content-visibility css
(cherry picked from commit 020b20d817d51dda9c0f9306543c69f4020891eb)
2024-07-23 21:15:27 -04:00
Colin Reeder a745a849cf LibWeb: Add more legacy -webkit- aliases
(cherry picked from commit 5c315b532e4edc561f30dfc492db9b2dcb59d5de)
2024-07-23 21:15:27 -04:00
Colin Reeder 70388b5676 LibWeb: Add support for -webkit-text-fill-color
(cherry picked from commit 449f81bfbed8343cfb49fcef4a890c33922889e5)

Commit altered to fix cherry-pick issue

Co-Authored-By: circl <circl.lastname@gmail.com>
2024-07-23 21:15:27 -04:00
Jamie Mansfield 19baedf891 LibWeb/WebGL: Stub missing properties in WebGLRenderingContextBase
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
(cherry picked from commit 835986de7bdff24e57886ef5710c473fc6abd765)
2024-07-23 13:06:46 -04:00
Aliaksandr Kalenik ad4f041fe1 LibWeb: Separate paint-only property resolution by paintable type
Having resolution of all properties for all paintable types in a single
function was hard to iterate on, so this change separates it into
smaller functions per paintable type.

(cherry picked from commit 7047fcf761ba3cac775befca78e7e6f758dc7c8b)
2024-07-23 13:06:46 -04:00
Kenneth Myhra 1d4e673e60 LibWeb: Implement formData() method steps for x-www-form-urlencoded
The Response interface of the Fetch API can now parse form urlencoded
bodies when Content-Type is set to 'application/x-www-form-urlencoded'.

(cherry picked from commit b8fa572c6742c0f1f63da0f63c8b86835a86988d)
2024-07-23 13:06:46 -04:00
bbb651 a6ba31af93 WebAudio: Stub BiquadFilterNode
(cherry picked from commit 64663d53fa466dcb9b62becc352c92e3d932353b)
2024-07-23 13:06:46 -04:00
bbb651 db21801fbc WebAudio: Stub AudioBufferSourceNode
(cherry picked from commit 6672fb4b47ee0da35678f55088b4afdfce5fd10b)
2024-07-23 13:06:46 -04:00
Ángel Carias 0b74214a6e LibWeb: Implement Text.wholeText
This getter returns the concatenation of the data of the contiguous
Text nodes of `this` (being this plus its siblings) in tree order.

(cherry picked from commit 69da6a0ce400d4a675bfba1f1dd1d313ee1f13c0)
2024-07-23 12:45:37 -04:00
Andreas Kling 0a42c97866 LibJS: Rename Value::typeof() to Value::typeof_()
This to avoid clashing with the GCC typeof extension, which apparently
confuses clang-format.

(cherry picked from commit 14beda00c9e823dd34da74e7d8fdf46aa57e845c)
2024-07-23 08:53:02 -04:00
Andreas Kling 4a4ee92402 LibJS: Make typeof a lot faster by caching all possible results
The typeof operator has a very small set of possible resulting strings,
so let's make it much faster by caching those strings on the VM.

~8x speed-up on this microbenchmark:

    for (let i = 0; i < 10_000_000; ++i) {
        typeof i;
    }

(cherry picked from commit d0b11af3876a64e6b254b5fc3f474d9bbe552024)
2024-07-23 08:53:02 -04:00
Tim Ledbetter 75e2dc712d LibWeb: Return a NodeList from document.getElementsByName()
This aligns our implementation with the specification.

(cherry picked from commit bd1213d0c527bd4e7facd9218c08ee86635c58a5)
2024-07-23 08:44:55 -04:00
Tim Ledbetter e399a716fa LibWeb: Ensure document.getElementsByName("") returns no elements
Previously, if a document had any element with a name attribute that
was  set to the empty string, then `document.getElementsByName("")` and
`element.getElementsByName("")` would return a collection including
those elements.

(cherry picked from commit e40352b6b59e99a9f3fd922142c2abafd9840e6c)
2024-07-23 08:44:55 -04:00
Tim Ledbetter d3c2d2ba3f LibWeb: Ensure document.getElementsByClassName("") returns no elements
Previously, `document.getElementsByClassName("")` would return a
collection containing all elements in the given document.

(cherry picked from commit 0fceede029e6af0cab98e86f20367d8835008472)
2024-07-23 08:44:55 -04:00
Tim Ledbetter d58709588f LibWeb: Move get_elements_by_name implementation to ParentNode
Previously, we had two implementations of the same function in
`Document` and `Element`, which had inadvertantly diverged.

(cherry picked from commit faf64bfb41393a59e958e21545aa556c9bb9d6a8)
2024-07-23 08:44:55 -04:00
Tim Ledbetter ed4f5b88d3 LibWeb: Ensure document.getElementById("") returns null
Previously, if a document had an element whose id was the empty string,
then `document.getElementById("")` and `element.getElementById("")`
would return that element.

(cherry picked from commit f666d967d6bac289346cf19f833f81bdc22adbdb)
2024-07-23 08:44:55 -04:00
Andreas Kling c17f7c84ef LibWeb: Use correct scope when removing style sheet inside a shadow tree
Before this change, removing a style element from inside a shadow tree
would cause it to be unregistered with the document-level list of sheets
instead of the shadow-root-level list.

This would eventually lead to a verification failure if someone tried to
update the text contents of that style element, since it was still in
the shadow-root-level list, but now with a null owner element.

Fixes a crash on https://www.swedbank.se/

(cherry picked from commit 3b7534b3628641244b0998fd5061c6fa75a61cf5)
2024-07-23 08:15:57 -04:00
Andreas Kling 9f173e5101 LibWeb: Verify something was removed in StyleSheetList::remove_sheet()
This would have saved me an hour of debugging, so putting it here for
the next person. :^)

(cherry picked from commit ebacb921dac6f8fd335d917100e6b04521a3f893)
2024-07-23 08:15:57 -04:00
simonkrauter 61f38a1fa7 LibWeb: Support accent-color for range input and progress element
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
Fixes #466

(cherry picked from commit 9df8e1f22468884db353f55d10823cd3d15c511b)
2024-07-22 21:29:38 -04:00
Andrew Kaster a8c4f34bff LibWeb: Create separate DedicatedWorkerGlobalScope class
This is how it's supposed to have been from the beginning, we were just
lazy :).

(cherry picked from commit 40a2bb32c3ab3fb0a5e298a31f674a5eb80b4870)
2024-07-22 21:29:21 -04:00
Andrew Kaster 5d0488ce6f LibWeb: Add closing flag to WorkerGlobalScope
Also implement close a worker AO.

(cherry picked from commit f99c7ad85d150bbe3372edad1a7634263e804eb1)
2024-07-22 21:29:21 -04:00
Andrew Kaster 446f04b575 LibWeb+WebWorker: Add IPC messages to request and communicate shutdown
(cherry picked from commit 27ef9ffa8f76b9bb38bc30ce05a1fdc19b849d91)
2024-07-22 21:29:21 -04:00
Andrew Kaster f2e3d117a2 LibWeb: Initialize HTML::EventLoop with its type
(cherry picked from commit 5d8784318d8240413e555bf2e55bc00d95ea0749)
2024-07-22 21:29:21 -04:00
Edwin Hoksberg fd55229c0e LibWeb: Support percentage values in SVG line element
(cherry picked from commit ac6126e263964a7695167c0ee6a74453957d4c5c)
2024-07-22 19:05:02 -04:00
Edwin Hoksberg 097a50141f LibWeb: Support percentage values in SVG text positioning element
(cherry picked from commit 356bddbdbb774cf86dd77d2a54a6fddccf82767e)
2024-07-22 19:05:02 -04:00
mobounya f820114bc6 LibWeb: Update update_for_history_step_application
Update 'update_for_history_step_application' to meet some of the specs
introduced in https://github.com/whatwg/html/pull/9856 and in
https://github.com/whatwg/html/pull/9990

(cherry picked from commit 2497f43989af3efa695d0d33de59001cb87bacb6)
2024-07-22 18:58:29 -04:00
Tim Ledbetter 098a2ad2e9 LibWeb/SVG: Ensure SVG transform has an inverse before using it
This avoids a crash that occurred when calling `getBBox()` on an SVG
element that had a transform with no inverse.

Found by Domato.

(cherry picked from commit d417b7568360f20487e4182e52872b82c8fbbf60)
2024-07-22 18:27:26 -04:00
Tim Ledbetter 9b524d043f LibWeb: Don't crash when SVG viewbox has a width of 0
Previously, `SVGSVGBox` would have a natural aspect ratio of 0 if it
had a viewbox with zero width. This led to a division by zero, causing
a crash.

Found by Domato.

(cherry picked from commit 4cdafea36334bcff8c4bbb083076ae55b599177c)
2024-07-22 18:27:26 -04:00
Tim Ledbetter 949ca71b31 LibWeb: Clamp paintable box maximum scroll offset to 0
Previously calling `PaintableBox::set_scroll_offset()` with a
PaintableBox whose content size was larger than its scrollble overflow
rect would cause a crash.

Found by Domato.

(cherry picked from commit 604f6040a180ac409cf338045c8709a171d920d5)
2024-07-22 18:27:26 -04:00
circl 78a22f5098 LibWeb: Replace templated retarget function with a regular one
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
The templating is not necessary anywhere and was effectively just a cast

(cherry picked from commit 37f93e4be13890c88f2a34a2669b41297fafa1c8)
2024-07-22 12:42:17 -04:00
Daniel Bertalan a06c27c5b7 LibWeb/DOM: Work around GCC 14 warning on always true is<T>()
GCC 14 emits a warning when an always succeeding `dynamic_cast`'s return
value is compared to NULL inside the `AK::is<T>(U)` template when `T` ==
`U`.

While warning on tautological `is` calls seems useful, it's a bit
awkward when it comes from a function template where the cast may fail
in some instantiation. There is a GCC bug open for it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664

Work around the warning by performing the algorithm on the base type
(`EventTarget`), with a wrapper that casts it to the more specialized
input type.

(cherry picked from commit 31eb0ed938dff11dee7391a4f616f4132aa250c0)
2024-07-22 12:42:17 -04:00
circl e85f10a380 LibWeb: Set document.activeElement using the spec algorithm
(cherry picked from commit 8357f18e9b9920e26fbb563dfa634bd269519171)
2024-07-22 12:42:17 -04:00
circl fec428b988 LibWeb: Move retarget function to its own file
(cherry picked from commit 1aa928210395ba157c868fa303ae531a8ee2d6d8)
2024-07-22 12:42:17 -04:00
Jamie Mansfield 33a8d6c010 LibWeb/HTML: Stub History.scrollRestoration
(cherry picked from commit e4e64c15aa1027754a4ed47504e2ba42d262e927)
2024-07-22 12:23:12 -04:00
Jamie Mansfield 924ff79fdc LibWeb/HTML: Stub HTMLImageElement.{x,y}
(cherry picked from commit 9eede09c3c228da193e015dbaf95f784e9c96b92)
2024-07-22 12:23:12 -04:00