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)
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)
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)
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.
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)
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)
This PR fixes truncation of quoted strings containing escaped quotes,
which were not being handled properly by the parser, resulting in
occasional crashes.
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)
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)
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)
...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.)
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.
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.
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.
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)
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)
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)
This to avoid clashing with the GCC typeof extension, which apparently
confuses clang-format.
(cherry picked from commit 14beda00c9e823dd34da74e7d8fdf46aa57e845c)
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)
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)
Previously, `document.getElementsByClassName("")` would return a
collection containing all elements in the given document.
(cherry picked from commit 0fceede029e6af0cab98e86f20367d8835008472)
Previously, we had two implementations of the same function in
`Document` and `Element`, which had inadvertantly diverged.
(cherry picked from commit faf64bfb41393a59e958e21545aa556c9bb9d6a8)
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)
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)
This would have saved me an hour of debugging, so putting it here for
the next person. :^)
(cherry picked from commit ebacb921dac6f8fd335d917100e6b04521a3f893)
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)
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)
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)
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)
Previously, you'd see one frame of the sleeping animation, and then it
would stop. This was because Frame2 = 0x1 and Frame1 = 0x0, so once the
Frame2 bit was set, or-ing with Frame1 would not unset it. Since the
current frame was already tracked separately to the state, we can avoid
setting it in the state, and instead only use it when we fetch the
bitmap, preventing this issue.
This method accepts a namespace URI as an argument and returns true if
the given URI is the default namespace on the given node, false
otherwise.
(cherry picked from commit 055c902a375bb34b8c0e31f015c2815fe935c6a9)
This method takes a prefix and returns the namespace URI associated
with it on the given node, or null if no namespace is found.
(cherry picked from commit 27d429a85f359b9c87bf9807e4dea33f7092308a)
This change implements the download, ping, rel, hreflang, and type
attributes using the [Reflect] annotation in the IDL file.
(cherry picked from commit 7562f89d4e2b0dd22430962e102a2195186f8458)
Add fetch group concept from the '2.4. Fetch groups' in
the fetch specs to the environment settings object.
(cherry picked from commit 9e223f6daeb3969d3997084a973b26daff6b4f7e)
Previously, `Node::is_equal_node()` would return true for nodes in
different namespaces that were otherwise equal.
(cherry picked from commit 7ab7be694d1232f4cdc108a2adc88812fc0a9ca9)
This matches the behavior of other browsers. Previously, a click event
was used, so the value was only updated when the mouse was released.
(cherry picked from commit b4b947c60797328d930c8d3de466b8ef292d0ed4)
An input event is now fired when the step up or step down button of an
input element of type number is clicked.
This ensures that any associated <output> element is updated when these
buttons are clicked.
(cherry picked from commit 2a980816e756d727261d53450b4b3f48069d5d50)
Input elements without a defined user-interaction behavior need to fire
an input event when the user changes the element's value in some way.
This change moves the code to do this into its own function and adds
some spec text to explain what is being done.
(cherry picked from commit a3d12e569c88d0dae530657e5bddc18699fb9c9b)
The spec allows setting a constructor on non built-in Iterator objects.
This is a normative change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/30b3501
(cherry picked from commit fb228a3d850eb5e4b06550823755719a377b41e6)
The spec allows setting the prototype on non built-in Iterator objects.
This is a normative change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/30b3501
(cherry picked from commit 734e37442db4419b58228e25702bfe176e52f5e3)
The EntryType has three possible values: Fetching, Failed or
ModuleScript. It is possible that we transition from Fetching to Failed
as in #13.1. Change the assertion to include the failed scenario.
Fixes: https://github.com/LadybirdBrowser/ladybird/issues/661
(cherry picked from commit 319bb6353e0ba64fc5e54b32ddb2b38736cedef9)
This fixes some bugs on wpt.dom/events/Event-init-while-dispatching.html,
although the test still fails due to [GH-23722].
[GH-23722]: https://github.com/SerenityOS/serenity/issues/23722
(cherry picked from commit aefab1de38948b0d86a6aed33647e995340859e2)