Commit graph

2141 commits

Author SHA1 Message Date
aplefull
50445dc9ef LibWeb: Don't add extra gap when placing flex items in reverse order 2025-01-17 10:10:43 +01:00
Shannon Booth
ac9670fb55 LibWeb/HTML: Fix grammar in spec note for error checking serialization
See: https://github.com/whatwg/html/commit/90720ff
2025-01-17 10:08:42 +01:00
Shannon Booth
76397c9ecd LibWeb: Use finalize for cleaning up all navigables
The use of this HashMap looks very spooky, but let's at least use
finalize when cleaning them up on destruction to make things slightly
less dangerous looking.
2025-01-17 10:08:42 +01:00
Timothy Flynn
0c09a099a5 LibWeb: Add missing #include to InputEventsTarget.h
While investigating an issue with Unicode::Segmenter (the result of
which is passed to functions in this file), this missing include was
causing clangd to be unable to find non-virtual implementations.
2025-01-16 23:22:48 +01:00
Tim Ledbetter
d7ff409032 LibWeb: Align OfflineAudioContext constructors with current spec steps 2025-01-16 13:56:18 +00:00
Tim Ledbetter
f01ccf5424 LibWeb: Align AudioContext constructor with current spec steps 2025-01-16 13:56:18 +00:00
Shannon Booth
c33d72bb41 LibWeb/Fetch: Remove FIXME for since fixed spec bug 2025-01-16 01:16:47 +00:00
Tim Ledbetter
3d20587911 LibWeb: Fetch source file when HTMLTrackElement src attribute changes
This commit begins to implement the track processing model. When the
`src` attribute is updated, we now fetch the given source file.
Currently, we always fire an `error` event once fetching is completed,
as we don't support processing the fetched data.
2025-01-15 20:59:18 +01:00
Tim Ledbetter
e44fcc644f LibWeb: Use AttributeNames::value rather than StringView literals 2025-01-15 20:59:18 +01:00
Sam Atkins
18e0ff6537 LibWeb/CSS: Properly classify calculations inside transform functions
Assuming all calculations produce `<length-percentage>` is a very bad
assumption, and was causing crashes on https://ai.cloudflare.com/
2025-01-15 14:29:08 +00:00
Shannon Booth
51102254b5 LibWeb/HTML: Scroll to the fragment before loading the document
Otherwise nowhere ends up scrolling to the fragment specified by the
fragment in document's URL. This fixes ladybird scrolling to the
correct location in the document when navigating to a link that
has a fragment, e.g:

https://html.spec.whatwg.org/multipage/browsing-the-web.html#try-to-scroll-to-the-fragment

As well as use of the :target selector.
2025-01-15 12:43:48 +00:00
Shannon Booth
e74ca82083 LibWeb/XHR: Isomorphic decode accessing XMLHttpRequest response headers
Fixes a crash on:

https://wpt.live/html/browsers/browsing-the-web/navigating-across-documents/refresh/subresource.any.html
2025-01-15 12:35:56 +00:00
Tim Ledbetter
639ed5a052 WebContent+LibWeb: Add an option to disable painting viewport scrollbars 2025-01-15 12:33:53 +00:00
Shannon Booth
7b637b1eee LibWeb/HTML: Only use maxlength <input> attribute when applicable 2025-01-15 11:41:39 +01:00
Timothy Flynn
e95096d2a9 LibWeb: Mark a few calls to set_attribute as infallible
These cannot possibly throw an exception because the attribute names are
already known to be valid.
2025-01-15 08:46:51 +01:00
stelar7
b43bb2429a LibWeb: Rename ConnectionQueue to RequestList 2025-01-14 23:46:09 +01:00
stelar7
73272d92f0 LibWeb: Implement IDBKeyRange 2025-01-14 23:46:09 +01:00
stelar7
596f1d8426 LibWeb: Move IDBDatabase::close out of line 2025-01-14 23:46:09 +01:00
stelar7
47b8a015a7 LibWeb: Turn IDB internal Key into a GC type 2025-01-14 23:46:09 +01:00
Psychpsyo
5b9d18b462 LibWeb: Improve <select> dropdown position 2025-01-14 07:34:51 +00:00
Psychpsyo
8cd2fe3d08 LibWeb: Fix CSS clip-path ignoring scroll position 2025-01-13 20:03:28 -07:00
Aliaksandr Kalenik
98691810b1 LibWeb: Fix insert/delete rule invalidation for adopted style sheets
Invalidation for adopted style sheets was broken because we had an
assumption that "active" style sheet is always attached to
StyleSheetList which is not true for adopted style sheets. This change
addresses that by keeping track of all documents/shadow roots that own
a style sheet and notifying them about invalidation instead of going
through the StyleSheetList.
2025-01-13 23:03:07 +01:00
devgianlu
a59b48cffc LibCrypto+LibWeb: Replace RSA_OAEP-EME implementation
This replaces the old `OAEP` implementation with one backed by OpenSSL.
The changes also include some added modularity to the RSA class by
making the `RSA_EME` and `RSA_EMSE` for encryption/decryption and
signing/verifying respectively.
2025-01-13 17:00:18 +01:00
devgianlu
0fc02d4d00 LibCrypto: Make PKSystem methods return a ByteBuffer directly
It used to be that the caller would supply a buffer to write the output
to. This created an anti-pattern in multiple places where the caller
would allocate a `ByteBuffer` and then use `.bytes()` to provide it to
the `PKSystem` method. Then the callee would resize the output buffer
and reassign it, but because the resize was on `Bytes` and not on
`ByteBuffer`, the caller using the latter would cause a bug.

Additionally, in pretty much all cases the buffer was pre-allocated
shortly before.
2025-01-13 17:00:18 +01:00
Psychpsyo
bb5d1ac4a3 LibWeb: Fix CSS tag seletor case sensitivity for SVG elements
They can appear in HTML documents but must not be matched
according to the HTML spec.
2025-01-13 12:11:34 +00:00
Psychpsyo
7757df5bb5 LibWeb: Implement CSS 'isolation' property 2025-01-13 11:07:55 +00:00
Sam Atkins
4e1aa96dce LibWeb/CSS: Use CalcSV's context to determine what percentages are
This lets us implement the `matches_number()` and `matches_dimension()`
methods of `CSSNumericType` to spec, instead of being an ad-hoc hack.
2025-01-13 10:59:16 +00:00
Sam Atkins
6f60c258ce LibWeb/CSS: Mark transform property as resolving percentages as lengths 2025-01-13 10:59:16 +00:00
Sam Atkins
a40dbd080d LibWeb/CSS: Remove CSSNumericType::matches_resolution_percentage()
This isn't a spec type.
2025-01-13 10:59:16 +00:00
Sam Atkins
4efdb76857 LibWeb/CSS: Give calc() a CalculationContext for resolving percentages
This is passed in at construction, meaning we will be able to refer to
it later, when we're no longer inside the Parser.
2025-01-13 10:59:16 +00:00
Sam Atkins
bc00ef8314 LibWeb/CSS: Replace Parser "current property" with a stack of contexts
`current_property_id()` is insufficient to determine if a quirk is
allowed. For example, unitless lengths are allowed in certain
properties, but NOT if they are inside a calc() or other function. It's
also incorrect when we are parsing a longhand inside a shorthand. So
instead, replace that with a stack of value-parsing contexts. For now,
this is either properties or CSS functions, but in future can be
expanded to include media features and other places.

This lets us disallow quirks inside functions, like we're supposed to.

It also lays the groundwork for being able to more easily determine
what type a percentage inside a calculation should become, as this is
based on the same stack of contexts.
2025-01-13 10:59:16 +00:00
Tim Ledbetter
619df0bc2c LibWeb: Don't crash when upgrading custom element with a bad constructor
Previously, a crash would occur when attempting to throw an error in
this case because the method used to create the exception tried to get
the current realm from the execution context stack, which is empty. The
realm is now passed explicitly when constructing the error, avoiding
the crash.
2025-01-13 10:55:46 +00:00
Gingeh
403cda5cd6 LibWeb: Allow color keywords in theme-color metadata 2025-01-12 19:47:01 +00:00
Gingeh
9f2ce259ad LibWeb: Check for missing node or invalid query in obtain_theme_color 2025-01-12 19:47:01 +00:00
Gingeh
6fd03425b2 UI: Prevent crash when right clicking on an unloaded image 2025-01-12 19:29:57 +00:00
Shannon Booth
57479c2d4b LibWeb/HTML: Include better information in 'report an exception' event
Instead of always reporting a colno and lineno of zero try and use the
values from the Error object that may be provided, falling back to the
source location of the invocation if not provided. We can definitely
improve the reporting even more, but this is a start!

Also update this function to latest spec while we're in the area.
2025-01-12 18:49:55 +00:00
Shannon Booth
f388d3c88c LibWeb/HTML: Fix crash creating canvas pattern without context
This isn't a full fix, as the paint function does not handle this
either. But instead of getting the bitmap from the image source
immediately, follow the spec a bit more closely by creating the
CanvasPatern object with the ImageSource directly.

Fixes a crash for the 5 included WPT tests.
2025-01-12 18:40:37 +00:00
Shannon Booth
dfdcfc8e88 LibWeb/Bindings: Generate undefined in a union as 'Empty'
This can only ever be undefined, and no other JS value, so it makes
sense to use undefined to represent this case.
2025-01-12 18:39:24 +00:00
devgianlu
df05cc8478 LibCrypto: Make PKSystem methods return ErrorOr
Make `encrypt`, `decrypt`, `sign` and `verify` return `ErrorOr` for
better error propagation.
2025-01-12 01:13:19 +01:00
devgianlu
9e08f71fd9 LibCrypto: Make RSA::generate_key_pair return ErrorOr
Not currently needed as it cannot fail, but useful for future commits.
2025-01-12 01:13:19 +01:00
Timothy Flynn
a4324ee6e9 LibWeb: Remove the initialize_strings methods
We added these methods to propagate OOM errors at process startup, but
we longer fret about these tiny OOM failures. Requiring that these init
methods be called prohibits using these strings in processes that have
not set up a MainThreadVM. So let's just remove them and initialize the
strings in a sane manner.

In doing so, this also standardizes how we initialize strings whose C++
variable name differs from their string value. Instead of special-casing
these strings, we just include their string value in the x-macro list.
2025-01-12 00:35:58 +01:00
Timothy Flynn
ed726b6af0 LibWeb: Remove outdated FIXME about missing HTML event names
The drag-and-drop event names are already included, and the app cache
event names no longer exist (and the spec link here 404s).
2025-01-12 00:35:58 +01:00
Psychpsyo
19f97472eb LibWeb: Verify element namespace in DOM::create_element() 2025-01-11 23:29:17 +01:00
Tim Ledbetter
1e9e2b6564 LibWeb: Clone all attribute properties when cloning a single node
Previously, the namespace of the attributes on the cloned element was
not being set.
2025-01-11 23:10:09 +01:00
Tim Ledbetter
a467005855 LibWeb: Make node cloning methods const 2025-01-11 23:10:09 +01:00
Psychpsyo
31b20e38ee LibWebView: Fix capitalization in devtools 2025-01-11 16:28:51 -05:00
Shannon Booth
64eeda6450 LibWeb: Return a representation of an 'Agent' in 'relevant agent'
This makes it more convenient to use the 'relvant agent' concept,
instead of the awkward dynamic casts we needed to do for every call
site.

mutation_observers is also changed to hold a GC::Root instead of raw
GC::Ptr. Somehow this was not causing problems before, but trips up CI
after these changes.
2025-01-11 10:39:48 -05:00
Shannon Booth
5bed8f4055 LibURL+LibWeb: Make URL::basic_parse return an Optional<URL>
URL::basic_parse has a subtle bug where the resulting URL is not set
to valid when StateOveride is provided and the URL parser early returns
a valid URL.

This has not surfaced as a problem so far, as the only users of the
state override API provide an already valid URL buffer and also ignore
the result of basic parsing with a state override.

However, this bug surfaces implementing the URL pattern spec, which as
part of URL canonicalization:
 * Provides a dummy URL record
 * Basic URL parses that URL with state override
 * Checks the result of the URL parser to validate the URL

While we could set URL validity on every early return of the URL parser
during state override, it has been a long standing FIXME around the code
to try and remove the awkward validity state of the URL class. So this
commit makes the first stage of this change by migrating the basic
parser API to return Optional, which also happens to make this subtle
issue not a problem any more.
2025-01-11 10:08:29 -05:00
Tim Ledbetter
5b6f2bb23a LibWeb: Set dirty checkedness flag when setting checked IDL attribute
This matches the behavior of other browsers, which always set the dirty
checkedness flag when setting checkedness, except when setting the
`checked` content attribute.
2025-01-11 11:13:32 +01:00
Tim Ledbetter
c87bc78d5d LibWeb: Preserve indeterminate value when cloning HTMLInputElement 2025-01-11 11:13:32 +01:00