Commit graph

72002 commits

Author SHA1 Message Date
Aliaksandr Kalenik
c5da92f664 LibWeb: Try to dispatch wheel event on hit-testing target first
...before falling back to containing block. Fixes a bug when we can't
scroll innermost scrollable element, because wheel event dispatching
immediately falls back to containing block.
2025-10-03 19:34:20 +02:00
Jelle Raaijmakers
b1a7782c59 Devcontainer: Add libtool to dependencies 2025-10-03 15:00:09 +01:00
Johannes Gustafsson
e9e58d83b3 LibWeb: Add WPT tests related to XPath evaluation 2025-10-03 13:16:11 +02:00
Johannes Gustafsson
d2030a5377 LibWeb: Implement Document.evaluate and related XPath methods 2025-10-03 13:16:11 +02:00
Johannes Gustafsson
0ea519c539 LibWeb: Implement XPath functionality using libxml2 2025-10-03 13:16:11 +02:00
Johannes Gustafsson
f04b866cb0 LibWeb: Implement stubs for XPathEvaluator 2025-10-03 13:16:11 +02:00
Zaggy1024
1ae7ecc3e9 LibGfx: Free the harfbuzz buffer when measuring text width
I spotted this leak when WebContent was exiting with ASan enabled on a
page with a media element. MediaPaintable calls Gfx::Font::width(),
which calls through to measure_text_width(), which then drops an
hb_buffer_t* without freeing it.
2025-10-03 09:22:22 +02:00
Timothy Flynn
400300945f LibJS: Fill all available space when TA.copyWithin shrinks the array
This is a normative change in the ECMA-262 spec. See:
d228070p
2025-10-03 09:03:40 +02:00
Timothy Flynn
a7e55f3024 LibJS: Explicitly prevent out-of-bounds access in String.lastIndexOf
This is a normative change in the ECMA-262 spec. See:
541b2f6

Note we already handled this case well, but let's update our impl to
match the latest spec text.
2025-10-03 09:03:40 +02:00
Timothy Flynn
a4991143e0 LibJS: Update spec links and steps for the U8Array base64/hex proposal
This proposal reached stage 4 and was merged into ECMA-262. See:
3dfa316
2025-10-03 09:03:40 +02:00
Timothy Flynn
a7e5fa2256 LibJS: Update spec links and steps for the Math.sumPrecise proposal
This proposal reached stage 4 and was merged into ECMA-262. See:
27172c8
2025-10-03 09:03:40 +02:00
Timothy Flynn
cb56ea7e24 LibJS: Update spec links and steps for the Error.isError proposal
This proposal reached stage 4 and was merged into ECMA-262. See:
caa0482
2025-10-03 09:03:40 +02:00
Timothy Flynn
979761ad82 LibJS: Implement WeakMap.prototype.getOrInsert[Computed]
This is part of the Upsert proposal:
https://github.com/tc39/proposal-upsert
2025-10-03 08:58:40 +02:00
Timothy Flynn
b6924309a0 LibJS: Implement Map.prototype.getOrInsert[Computed]
This is part of the Upsert proposal:
https://github.com/tc39/proposal-upsert
2025-10-03 08:58:40 +02:00
Timothy Flynn
7d4245cf8a LibJS: Remove unnecessary call to Value::to_string_without_side_effects
This is handled internally by the throw completion formatter.
2025-10-03 08:58:40 +02:00
Timothy Flynn
853e3ecf23 LibJS: Include the WeakMap key (not value) in non-weakable key errors
It is the key that cannot be held weakly, and thus the key that should
be include in the error message.
2025-10-03 08:58:40 +02:00
Feng Yu
fd3c69227f LibWeb/HTML: Implement focus restoration in HTMLDialogElement
When a dialog is closed, restore focus to the previously focused
element if focus is within the dialog or if the dialog was modal.
2025-10-03 08:55:53 +02:00
vedant-pandey
d082e7ec58 LibJS: Move Typed Array copyWithin optimization before index update
The optimization for non-shared ArrayBuffers operates on incorrect
values of from_byte_index and to_byte_index because they will have been
modified in the preceding steps. This causes the incorrect range to be
copied within the buffer.
2025-10-02 19:41:31 +02:00
Aliaksandr Kalenik
20490d146c LibWeb/WebGL: Deduplicate read_and_pixel_convert_texture_image_source()
After we commited code produced by WebGL generator this function ended
up duplicated between WebGL 1 and 2 contexts.
2025-10-02 18:41:02 +02:00
Aliaksandr Kalenik
a6288e12e9 LibWeb/WebGL: Use TexImageSource alias in method signatures 2025-10-02 18:41:02 +02:00
Timothy Flynn
bbe254f3cb test-web: Log which WebView is running each test
When trying to repro a failed CI test, it is handy to know the order in
which test-web ran its tests. We've seen in the past that the exact
order can be important to debug flakey tests.

This adds the index of the WebView running the test to verbose log
statements (which is enabled in CI).
2025-10-02 11:12:47 -04:00
Sam Atkins
ccd9bb0286 LibWeb/CSS: Remove outdated use of PropertyID::Invalid
This doesn't exist any more, but did when I submitted the
PropertyNameAndID PR. Oops!
2025-10-02 14:25:48 +01:00
Zaggy1024
592be4ecad LibCore: Allow Promise to be resolved if it has a non-Error error type 2025-10-02 14:50:04 +02:00
Sam Atkins
e24d1ee895 WebDriver: Support custom properties in WebDriver::get_element_css_value
I noticed the existing code would end up calling
`computed_properties->property(PropertyID::Custom)`
so let's actually ask for the custom property instead.
2025-10-02 13:46:04 +01:00
Sam Atkins
561fdc0228 LibWeb/CSS: Use PropertyNameAndID in Parser::convert_to_style_property() 2025-10-02 13:46:04 +01:00
Sam Atkins
d014c6818a LibWeb/CSS: Use PropertyNameAndID in CSSSV::parse_a_css_style_value() 2025-10-02 13:46:04 +01:00
Sam Atkins
2906176500 LibWeb/CSS: Update CSS::supports() to match current spec
Also introduce usage of PropertyNameAndID.
2025-10-02 13:46:04 +01:00
Sam Atkins
ce7a8418ed LibWeb: Add and use CSSStyleProperties helpers in Algorithms code 2025-10-02 13:46:04 +01:00
Sam Atkins
2f02ccc5c1 LibWeb/CSS: Take PropertyNameAndID in in style-only CSSSD methods
StylePropertyMap only ever works with style properties - never
descriptors. Switching `has_property()` and `get_property_style_value()`
to taking PropertyNameAndID skips some duplicate work.
2025-10-02 13:46:04 +01:00
Sam Atkins
47062424fb LibWeb/CSS: Pull out and expand CSSStyleProperties::get_property()
This awkwardly sat as the internal final API for getting a StyleProperty
directly for a given PropertyID, and also the external API for getting
the StyleProperty for a PropertyID. For the latter, it lacked support
for shorthands, and for both it lacked support for custom properties.

This commit:
- Moves the code from get_property() into get_direct_property()
- Makes get_property() call get_property_internal() to support
  shorthands
- Adds custom property support for get_direct_property()

This also wins us some WPT points for StylePropertyMap.
2025-10-02 13:46:04 +01:00
Sam Atkins
8f456d781c LibWeb/CSS: Take PropertyNameAndID in get_property_internal() 2025-10-02 13:46:04 +01:00
Sam Atkins
d60c8d80e5 LibWeb: Rename CSSStyleProperties::property() -> get_property()
Verbs are nice, and `property` is too useful as a variable name.
2025-10-02 13:46:04 +01:00
Sam Atkins
38664cb79f LibWeb/CSS: Use PropertyNameAndID in CSSSP::set/remove_property()
This saves the PropertyID overloads from converting the ID to a string,
and then back to an ID again.
2025-10-02 13:46:04 +01:00
Sam Atkins
a30afafcc9 LibWeb/CSS: Use FlyString for CSSStyleValue property name 2025-10-02 13:46:04 +01:00
Sam Atkins
a8312bf571 LibWeb/CSS: Use FlyString const& for property name IDL parameters 2025-10-02 13:46:04 +01:00
Sam Atkins
37fa6459fb LibWeb/Editing: Use PropertyID CSSStyleProperties overloads 2025-10-02 13:46:04 +01:00
Sam Atkins
c0ef7f09e4 LibWeb/CSS: Use PropertyNameAndID instead of old Variant 2025-10-02 13:46:04 +01:00
Sam Atkins
3af8e705c1 LibWeb/CSS: Introduce a PropertyNameAndID type
We often want to call a function with either a built-in or custom
property, and that means either passing it as a string (and converting
back and forth between strings and PropertyIDs) or using the
PropertyIDOrCustomPropertyName variant, which complicates user code.
PropertyNameAndID is intended to make that easier: Create it with a
string or PropertyID, and it can tell you either one.
2025-10-02 13:46:04 +01:00
Sam Atkins
89c89470ef LibWeb/CSS: Stop rejecting declarations with vendor-prefixed keywords
property_accepts_type() only looks at the property itself, not any
longhands it might have, so we thought that `font` didn't accept
`<custom-ident>`s, and seeing "-apple-..." makes us throw out the
declaration even though it's valid as a font name.

We'll reject these like any other unrecognized value if it's somewhere
that's not supported, so this was really just an optimization for a
rare edge case, and removing the check doesn't have any observable
effect except fixing this bug and any similar cases.

Changing property_accepts_type() to look at longhands is not
straightforward, as not all longhand values are valid in the shorthand.
2025-10-02 13:26:26 +02:00
aplefull
b3bdb202f8 LibGfx: Allow decoding of GIFs with empty LZW data
The decoder was requiring GIF files to be at least 32 bytes, but the
actual minimum for a valid GIF is only 26 bytes:
- 6 bytes for the header
- 7 bytes for the Logical Screen Descriptor
- 10 bytes for the Image Descriptor
- 2 bytes for the LZW minimum code size and block terminator
- 1 byte for the GIF trailer

This change allows us to load minimal 1x1 GIFs with empty LZW data.
They are commonly used on the web as transparent placeholders with
minimal file size.
2025-10-02 11:04:35 +02:00
Zaggy1024
30d4810d70 LibMedia: Actually read Matroska tracks' CodecDelay elements 2025-10-02 11:03:26 +02:00
Zaggy1024
ce228663f1 LibMedia: Rename Matroska TRACK_CODEC_PRIVATE to TRACK_CODEC_PRIVATE_ID 2025-10-02 11:03:26 +02:00
rmg-x
b9554038ff LibWeb+LibXML: Make Listener::set_source(ByteString) fallible
`set_source` takes a ByteString but the implementation might require a
specific encoding. Make it fallible so that we don't need to crash in
the case of invalid UTF-8 or similar.

The test includes a sequence of invalid UTF-8 bytes that crash the
browser without this change.
2025-10-02 02:25:28 +02:00
Ali Mohammad Pur
2397ae4af5 LibWasm: Use [[gnu::musttail]] on new-enough GCC versions
This is supported starting GCC 15.
The warning -Wmaybe-musttail-local-addr complained about &value possibly
escaping (it cannot, but gcc is being pessimistic about
store_to_memory), so a little rearrangement of that function was
necessary.
2025-10-01 23:47:29 +02:00
Ali Mohammad Pur
15bb9fee71 AK: Use OOB pointer for "empty" last-fast-access Vector last ptr
This is a _significant_ perf improvement as we no longer have to think
about tracking state transitions from empty <-> nonempty.
(corresponds to a ~20% perf improvement in LibWasm)
2025-10-01 23:47:29 +02:00
Ali Mohammad Pur
02b3c4f8a9 LibWasm: Utilise direct threading if/when possible
~50% performance improvement on coremark.
2025-10-01 23:47:29 +02:00
Ali Mohammad Pur
cf30d61d8b LibWasm: Use a faster way to detect live registers
Instead of doing a naive O(n^2) liveness detection loop, use a bitmap
for values allocated to registers.
This cuts down validating time from 20% to 1.4% of runtime on the same
game as last commit.
2025-10-01 23:47:29 +02:00
Ali Mohammad Pur
c0223befe1 LibWasm: Avoid frequent re/deallocations while validating expressions
Freeing and reallocating these vectors was ~6% of runtime when
validating some web-based game.
2025-10-01 23:47:29 +02:00
Ali Mohammad Pur
80e5356853 AK: Add Vector::remove_all(container)/remove_all(it, end)
Instead of repeatedly removing elements off the vector, this allows for
specifying all the removed indices at once, and does not perform any
extra reallocations or unnecessary moves.
2025-10-01 23:47:29 +02:00
Aliaksandr Kalenik
93d7efa4c3 LibIPC: Delete unused code in Connection 2025-10-01 14:59:23 -04:00