Commit graph

3500 commits

Author SHA1 Message Date
Sam Atkins
b647a74557 AK: Add Utf8View::for_each_split_view() method
Returns one Utf8View at a time, using a callback function to identify
code points to split on.

(cherry picked from commit 3f10a5701d9634e47111203b837283bdfc2d8b18)
2024-11-15 23:09:44 -05:00
Sam Atkins
4548cd6e5f AK: Ensure empty StringViews all compare as equal
Before this change, a StringView with a character-data pointer would
never compare as equal to one with a null pointer, even if they were
both length 0. This could happen for example if one is
default-initialized, and the other is created as a substring.

(cherry picked from commit ec5101a1d3cc7bc9068fa4863e16aa482536929a)
2024-11-15 23:09:44 -05:00
Tim Ledbetter
2a35f9a834 Tests/WPT: Enable Qt neworking when running WPT tests
(cherry picked from commit 21eefb788bcee36afce24e02ec4ef90e27510fbb;
amended to resolve a minor conflict)
2024-11-15 19:07:17 -05:00
Asutosh Variar
50cc1b5d63 Everywhere: Convert from_string_view -> from_string_literal where static
(cherry picked from commit 229b64a4b723a391c21f247d72d78cd575ace6ff;
minorly amended to fix conflict in image.cpp due to serenity in the
meantime adding webp writing support, and due to changes in Android and
Vulkan-related files that serenity doesn't have)
2024-11-15 08:56:39 -05:00
Sam Atkins
f63a15665d LibWeb: Calculate hidden password text using code-point count
This means that an `<input type=password>` will show the correct number
of *s in it when non-ASCII characters are entered.

We also don't need to perform text-transform on these as that doesn't
affect the output length, so I've moved it earlier.

(cherry picked from commit c747b1c6b56156b5797fad0d8d95164f415c8b25;
amended to slightly adjust some BlockContainer and PaintableWithLines
widths, since serenity does not use harfbuzz for text shaping)
2024-11-14 23:38:34 -05:00
Pavel Shliak
f445caa585 Tests: Remove duplicated test for FloatingPointParsing
(cherry picked from commit 672590c360e80a20d72f1b4f7f9918c53c5a89f3)
2024-11-14 23:38:34 -05:00
Pavel Shliak
cb7d2b706f Tests: Remove duplicated test for UnicodeCharacterTypes
(cherry picked from commit 5fe1d389553319e4d6554343141e5e4162f6776b)
2024-11-14 23:38:34 -05:00
Pavel Shliak
d990144180 Tests: Remove duplicated test for StringView
(cherry picked from commit cf5521ec68af3982bdabc9a80188dd0111798649)
2024-11-14 23:38:34 -05:00
Gingeh
c591562b0d LibURL: Use UTF-8 for percent encoding URL fragments
(cherry picked from commit c10cb8ac8d6c897c8fb184d5f0c2a09b8f699b1d)
2024-11-14 22:21:55 -05:00
Timothy Flynn
60782cb219 AK: Do not coerce i64 and u64 values to i32 and u32
First, this isn't actually helpful, as we no longer store 32-bit values
in JsonValue. They are stored as 64-bit values anyways.

But more imporatantly, there was a bug here when trying to coerce an i64
to an i32. All negative values were cast to an i32, without checking if
the value is below NumericLimits<i32>::min.

(cherry picked from commit 7b3b608cafbed8049ac7a34104c66622c1445ffc)
2024-11-14 19:52:23 -05:00
Jelle Raaijmakers
35f4f5cf54 LibWeb: Implement AudioListener
This exposes BaseAudioContext.listener, which is a container for
parameters related to the configuration of an actual "listener" in 3D
space.

(cherry picked from commit 2a98f2a12d5069a2189fa38b4a7e158d84ee03ec)
2024-11-14 17:46:06 -05:00
ronak69
8fbecc096d LibWeb: Insert title as first child on setting title of svg document
Before, the new title element got appended instead of prepended, as
nullptr was passed as the "child" argument to the insert_before()
function.

This change makes two WPT tests pass in:
http://wpt.live/html/dom/documents/dom-tree-accessors/document.title-09.html

(cherry picked from commit 3ff613712132bd3d03f44f27986f7ca5aaea8eb5)
2024-11-14 17:46:06 -05:00
sin-ack
23e49f2835 BindingsGenerator: Handle global interfaces without named properties
DedicatedWorkerGlobalScope is an object with a Global extended
attribute, but does not define any named property getters. This needs to
be handled by setting the prototype chain to:

    DedicatedWorkerGlobalScope
    ^ DedicatedWorkerGlobalScopePrototype
    ^ WorkerGlobalScopePrototype

(This is different from something like Window, where there is an
intermediate WindowProperties object for named properties.)

Previously, we treated the GlobalMixin object as if it was a simple
prototype object, accidentally setting DedicatedWorkerGlobalScope's
prototype to WorkerGlobalScopePrototype. This caused the expression

    self instanceof DedicatedWorkerGlobalScope

to return false inside workers.

This makes us pass many more of the "/xhr/idlharness.any.worker" WPT
tests than before, rather than failing early.

(cherry picked from commit d5948709cd499ef0e7bfa3c24e8c03befed115fe)
2024-11-14 17:46:06 -05:00
Arhcout
0845de1018 LibWeb: Don't trigger onchange event when setting <select> value
(cherry picked from commit 5d00211a8605b0fab9f330082699f6f089961052)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers
b67c8d138c LibWeb: Add WebGLShaderPrecisionFormat
(cherry picked from commit 3d8ab0e67c707062e4d889598fbd176fa0c6fce8)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
b288bfd994 LibWeb: Add WebGLActiveInfo
(cherry picked from commit d63a979bde54ad93422c2fadb5cf24cbc3339e07)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
59ed552646 LibWeb: Add WebGLUniformLocation
(cherry picked from commit 889e7942fa090a240743d3b53ab2bc5288e064c3)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
1097eaf38b LibWeb: Add WebGLTexture
(cherry picked from commit f2a164365007ad5e06f3ce47702ded55c42fbcb6)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
e41789f5f9 LibWeb: Add WebGLShader
(cherry picked from commit 2b09afb971059f22a0eb82661262954211b694b9)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
e64cf9633d LibWeb: Add WebGLRenderbuffer
(cherry picked from commit d53cb9833b274658c1ec1b6c1813cfb466470bdb)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
8e05ba45d0 LibWeb: Add WebGLProgram
(cherry picked from commit 6b7d5dbec6a9daf1033ee2e8c4c48037ccd35360)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
88ce676d20 LibWeb: Add WebGLFramebuffer
(cherry picked from commit 5d0b206d6ec9c3a5284ee6db7452b21a6cf6c7cd)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
4e9c64c37f LibWeb: Add WebGLBuffer
(cherry picked from commit b21857b26587a1108325ba7d1e7c69986d3ddaa3)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
1e0b742903 LibWeb: Add WebGLObject interface
(cherry picked from commit e6ee7f3e642acd548b3ae96c47f7174ceb98f730)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
e87b17b0e0 LibWeb: Add stubbed Media Source Extensions API
Just the boilerplate :^)

(cherry picked from commit 35043702813117d22e841e1b1d887d1726d4ed2d;
amended to fix conflict in idl_files.gni due to ladybird being worse
than serenity at having that file sorted alphabetically)
2024-11-13 19:32:14 -05:00
Luke Wilde
c1767b1964 LibWeb: Make iframe insertion steps check the shadow including root
The insertion steps for iframes were following an old version of the
spec, where it was checking if the iframe was "in a document tree",
which doesn't cross shadow root boundaries. The spec has since been
updated to check the shadow including root instead.

This is now needed for Cloudflare Turnstile iframe widgets to appear,
as they are now inserted into a shadow root.

(cherry picked from commit 4dd14d812f73377cb1efa5a8e8a114912a90b5af)
2024-11-13 19:32:02 -05:00
Luke Wilde
dd6ede831d LibWeb: Actually traverse the shadow root of the inclusive descendant
Previously, the inclusive descendant, which is the node that
for_each_shadow_including_inclusive_descendant was called on, would not
have it's shadow root traversed if it had one.

This is because the shadow root traversal was in the `for` loop, which
begins with the node's first child. The fix here is to move the shadow
root traversal outside of the loop, and check if the current node is an
element instead.

(cherry picked from commit 6df4e5f5e75d7d6d439d1365ed7bed4fd2a8a1da)
2024-11-13 19:32:02 -05:00
Andreas Kling
337b113e68 LibWeb: Use the correct document URL in DOMParser.parseFromString()
We were hard-coding "about:blank" as the document URL for parsed HTML
documents, which was definitely not correct.

This fixes a bunch of WPT tests under /domparsing/ :^)

(cherry picked from commit 55f58eea99c0429dcc39cd0430fafa60eecf5542)
2024-11-13 10:17:34 -05:00
Simon König
e4903feab8 LibWeb: Don't crash on encountering display: list-item on pseudo element
On any `display: list-item` Node a CSS pseudo element (`::marker`) needs
to be created. This commit allows the ::maker pseudo element to be
nested within other pseudo elements (e. g. ::before or ::after).

This fixes this WPT test:
http://wpt.live/css/CSS2/generated-content/after-content-display-003.xht

(cherry picked from commit 15d2857a01b5bda90ace3d02cf9e1bc8ce279d38)
2024-11-13 10:17:34 -05:00
Benjamin Bjerken
a3c986021d LibWeb: Add SVGImageElement load and error events
This resolves all WPT timeouts in html/canvas/element/manual/imagebitmap
We can now run an additional 6 tests and 126 subtests :)

This also adds regression tests for this behavior.

(cherry picked from commit 0c04bd66764dfbe8f6da515d09b076683c61e93c)
2024-11-13 10:17:34 -05:00
Sam Atkins
ca5b3dbd7b LibWeb/CSS: Stop invalidating style when setting an animation's effect
This reverts 6d25bf3aac

Invalidating the style here means that transitions can cause an element
to leave style computation with its "needs style update" flag set to
true. This then causes a VERIFY to fail in the TreeBuilder.

This invalidation does not otherwise seem to have any effect. The
original commit suggests this was to fix a bug, but it's not clear what
bug that was. If it reappears, we can try to solve the issue in a
different way.

(cherry picked from commit 81596b41457d250bac28db37c1390fa46e6532de;
amended test with leading whitespace since we don't have
LadybirdBrowser/ladybird#1603 yet)
2024-11-13 10:17:34 -05:00
Benjamin Bjerken
6268e8f559 LibWeb: Fix CloseWatcher constructor for detached iframes
This fixes the last subtest in /close-watcher/frame-removal.html :)

(cherry picked from commit 63d9ed9d8c4fafd569e042e0698bd5dc844a1b29)
2024-11-13 10:17:34 -05:00
justus2510
fc2f49a936 LibWeb: Make FileReader fire progress event
Fixes wpt/FileAPI/reading-data-section/filereader_events.any.html :)

(cherry picked from commit 7a92b47a35609d4bb48a111d4582ff4c424c4088)
2024-11-13 10:17:34 -05:00
Ali Mohammad Pur
7c96d9a96d LibWasm+LibWeb+test-wasm: Refcount Wasm::Module for function references
Prior to funcref, a partial chunk of an invalid module was never needed,
but funcref allows a partially instantiated module to modify imported
tables with references to its own functions, which means we need to keep
the second module alive while that function reference is present within
the imported table.
This was tested by the spectests, but very rarely caught as our GC does
not behave particularly predictably, making it so the offending module
remains in memory just long enough to let the tests pass.

This commit makes it so all function references keep their respective
modules alive.

(cherry picked from commit a60ecea16abe62aae988ba877fdb98466d2919d3)
2024-11-13 10:17:34 -05:00
Jamie Mansfield
5ef8538d38 LibWeb/UIEvents: Implement TextEvent
(cherry picked from commit f610a12671cccc5bf96c7ce8f7773c02412b8d81)
2024-11-12 22:26:21 -05:00
Jamie Mansfield
ad93d00ed2 LibWeb/UIEvents: Implement CompositionEvent
(cherry picked from commit 86e20ea2469c0defb6fca40de3cbb339c168b543)
2024-11-12 22:26:21 -05:00
Jamie Mansfield
77cdbb5318 LibWeb/UIEvents: Implement InputEvent
(cherry picked from commit 9fce70069dc29f2232feb8247e69d21fe720fa94)
2024-11-12 22:26:21 -05:00
Tim Ledbetter
05e8835555 LibWeb: Follow spec steps to set the selectionDirection attribute value
(cherry picked from commit d0b97873d421d092eb41e3b7a7d8959347b3b436)
2024-11-12 22:26:21 -05:00
Timothy Flynn
48ce92598d LibWeb: Dispatch click events using the correct button/buttons
We were generating click events always using the primary mouse button
instead of the provided button, and with the buttons field set to that
provided button.

(cherry picked from commit dd5a0361f2307b280a910d219fbc2dfd0072409f)
2024-11-12 22:26:21 -05:00
Diego Frias
a97996351f LibWasm: Remove type information from Value
Gets fib(30) from 380ms to 340ms.

(cherry picked from commit a58704296cd36d3080dbf8f1be49300de2c25ea9;
amended to comment out two dbgln_if()s that no longer compile after
this change if WASM_TRACE_DEBUG is defined to 1 -- see comments on
LadybirdBrowser/ladybird#960. Likewise, one dbgln_if() in Wasi.cpp
got commented out as well)
2024-11-12 19:58:14 -05:00
justus2510
da16c169ae LibWeb: Handle unpaired surrogates in USVStrings
This should fix (at least) the last two remaining WPT test failures in
FileAPI/unicode.html.

(cherry picked from commit 55f0dc823ff266aeb29fd6f7d47d5e7f89a50ee6)
2024-11-12 19:57:55 -05:00
Cory Virok
bca960ce36 LibWeb: Added tests for missing xmlns during XHMTL parsing
The main culprit for the following WPT test failure is that we
weren't using the HTML namespace for XHTML docs unless one was
explicitly provided.

(cherry picked from commit 6a5bca1302161a84d95313bef1481d9a8a56702c)
2024-11-12 19:57:55 -05:00
ronak69
9ee02fc952 LibWeb: Frameset should be the body element if it comes before body
Fixes one WPT test: "Frameset followed by body inside the html element"
http://wpt.live/html/dom/documents/dom-tree-accessors/Document.body.html

(cherry picked from commit 5f9a36feacede04cd51c1a286bc5fb87b60fb5e2)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
be7110a3a4 LibWeb: Map dimension attributes for table elements
(cherry picked from commit 140dc95e6769a41542f98abef333d5bc32b86e39)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
ea8914aeac LibWeb: Map embedded content element attributes to dimension properties
(cherry picked from commit 728236f4d20b4dbabfe0936b79a2f63ac80f4da3)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
8dee6b9ebd Libweb: Map marquee attributes to dimension properties
(cherry picked from commit baca0e5e5568b1b9b301cefa7d6cc8312b39be28)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
7e456212c7 LibWeb: Map hr width attribute to the width dimension property
(cherry picked from commit 4c3101e021e323b487e8ab10026a14fdf40fa2f0)
2024-11-12 19:57:55 -05:00
Gingeh
3b9064089a LibWeb: Don't move focus when setting input value
(cherry picked from commit 1d9c404b8cb898b351ee3c69840bf943e97d499c)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
bb798071a0 LibWeb: Treat dates and times with repeated separators as invalid
These would previously be treated as valid by the value sanitization
algorithm.

(cherry picked from commit f9282f65d3a4daf7df2c6033b03c70a56130aa72)
2024-11-12 19:57:55 -05:00
Ankush Chatterjee
d5ed665461 LibWeb/CSS: Add math expression support for transform-origin
(cherry picked from commit 85356094b50878e78d40d79c2a9e96ff9aac5a6b)
2024-11-12 10:45:53 -05:00