Commit graph

187 commits

Author SHA1 Message Date
Sam Atkins
90e763de4c LibURL: Replace Host's Empty state with making Url's Host optional
A couple of reasons:
- Origin's Host (when in the tuple state) can't be null
- There's an "empty host" concept in the spec which is NOT the same as a
  null Host, and that was confusing me.
2024-11-30 12:07:39 +01:00
Shannon Booth
6a668f27c7 LibWeb: Push promise rejection handling onto UniversalGlobalScopeMixin
This is needed for shadow realms which don't have a window or worker
global object. Fixes a crash for the attached test.
2024-11-30 11:55:11 +01:00
Shannon Booth
bc10729af6 LibWeb: Add relevant principal helper abstract operations
These were recently added into the shadow realm merge request as
convenience helpers.
2024-11-30 11:55:11 +01:00
Shannon Booth
d5aaff818e LibWeb: Adjust 'resolve a module specifier' to shadow realm proposal 2024-11-30 11:55:11 +01:00
Shannon Booth
bb10b0e301 LibWeb: Always assert that principal realm returns a principal realm
There was a bug in the HTML proposal where a synthetic realm settings
object's principal realm was a shadow realm if there were nested shadow
realms, which this assertion catches more directly (rather than later
down the track, where it is used).

We were meant to also assert for this case, but we were previously
returning early.
2024-11-30 11:55:11 +01:00
Shannon Booth
b39f4f0b5a LibWeb: Add stub definition for WorkletGlobalScope 2024-11-30 11:19:35 +01:00
Shannon Booth
4417f63ca0 LibWeb: Move ServiceWorker classes to ServiceWorker namespace
These are defined by the ServiceWorker spec, not the HTML one.
2024-11-30 11:19:35 +01:00
Tim Ledbetter
b39fdcfec2 LibWeb: Implement the HTMLInputElement.height attribute
This allows the height of an image button input to be set and queried.
2024-11-30 11:01:33 +01:00
Tim Ledbetter
45a2823e08 LibWeb: Implement the HTMLInputElement.width attribute
This allows the width of an image button input to be set and queried.
2024-11-30 11:01:33 +01:00
joshua stein
12442ca430 LibWeb: Remove a misleading duplicate comment in HTMLParser 2024-11-30 07:07:30 +00:00
Tim Ledbetter
99f8972928 LibWeb: Ignore negative values when setting HTMLProgressElement.max
When attempting to set `HTMLProgressElement.max` to a value not greater
than 0, we were previously setting the value to 1. We now retain the
previous value.
2024-11-29 15:32:04 +01:00
Tim Ledbetter
6218f1a609 LibWeb: Limit HTMLSelectElement.size to allowed values
This change ensures that the correct default value of 0 is used and
that values greater than 2147483647 will fall back to the default value.

It also splits the display size concept into a separate method, as
this isn't supposed to be used when getting the IDL property.
2024-11-29 13:30:57 +01:00
Tim Ledbetter
4ad8ba11d5 LibWeb: Use the [Reflect] attribute to implement HTMLLinkElement.as
Also ensure that all valid potential destinations are allowed permitted.
2024-11-29 09:48:59 +01:00
Tim Ledbetter
aafc829e6d LibWeb: Don't allow HTMLTextAreaElement rows and cols to be set to 0
In this case we should fall back to the default value.
2024-11-29 09:48:45 +01:00
Tim Ledbetter
ae0c87c747 LibWeb: Limit HTMLInputElement.size to allowed values
Attempting to set `HTMLInputElement.size` to 0 via IDL now throws an
IndexSizeError DOMException. Attempting to set it to a value larger
than 2147483647 results in it being set to the default value.
2024-11-29 09:48:45 +01:00
Daniel La Rocque
e43e4d3a93 LibWeb: Add NullOrError to NavigationParamsVariant
To check whether a NavigationParams is null, we have to check whether
it's `Empty` or `NullWithError`. Instead, we can merge both of these
possible variants into an optional error. If `NullOrError` has no
value it's null, otherwise it contains an error message.
2024-11-27 14:15:37 -07:00
Psychpsyo
e602578501 LibWeb: Add handling for 'an end tag whose tag name is sarcasm' 2024-11-27 10:42:58 +00:00
Psychpsyo
397579096f LibWeb: Add search element to list of Special tags 2024-11-27 11:00:58 +01:00
Tim Ledbetter
7fe3bf07e2 LibWeb: Limit HTMLTextAreaElement attributes to allowed values
If `HTMLTextAreaElement.rows` or `HTMLTextAreaElement.cols`
is set to a value larger than 2147483647, then it should be set to its
default value.
2024-11-27 11:00:25 +01:00
Tim Ledbetter
a8719a706b LibWeb: Limit HTMLMarqueeElement attributes to allowed values
If `HTMLMarqueeElemnt.scrollAmount` or `HTMLMarqueeElemnt.scrollDelay`
is set to a value larger than 2147483647, then it should be set to its
default value.
2024-11-27 11:00:25 +01:00
Tim Ledbetter
cc0ad0d1ef LibWeb: Use [URL] extended attribute for HTMLInputElement.src 2024-11-26 23:20:20 +00:00
Gingeh
0adf261c32 LibWeb: Don't end parsing after reaching the insertion point 2024-11-26 23:50:18 +01:00
Tim Ledbetter
e176871fdf LibWeb: Use [Reflect] to implement HTMLImageElement.decoding
This ensures the correct behavior when the value of the `decoding`
attribute is changed with `setAttribute()`.
2024-11-26 21:56:28 +00:00
Tim Ledbetter
9face18ab2 LibWeb: Use correct integer parsing rules in HTMLOListElement::start() 2024-11-26 19:09:24 +01:00
Tim Ledbetter
a61883ae88 LibWeb: Use correct integer parsing rules in HTMLLIElement::value() 2024-11-26 19:09:24 +01:00
Tim Ledbetter
67d05b0104 LibWeb: Use [URL] extended attribute for HTMLVideoElement.poster 2024-11-26 19:07:53 +01:00
Tim Ledbetter
d73f809af5 LibWeb: Implement HTMLElement.enterKeyHint
This reflects the value of the `enterkeyhint` content attribute
2024-11-26 18:38:38 +01:00
Tim Ledbetter
12fc1de9ca LibWeb: Implement HTMLElement.inputMode
This reflects the value of the `inputmode` content attribute
2024-11-26 18:38:38 +01:00
Andreas Kling
733c6b14ff LibWeb: Teach HTMLObjectElement to negotiate natural size with SVGs
We do this by generalizing the code previously used for SVGSVGBox into
something that can be used for NavigableViewportContainer as well.
2024-11-26 18:32:48 +01:00
Andreas Kling
2405805ddf LibWeb: Delay load event in more HTMLObjectElement situation 2024-11-26 18:32:48 +01:00
Andreas Kling
e88286b337 LibWeb: Mark HTMLObjectElement as potentially delaying the load event 2024-11-26 18:32:48 +01:00
Andreas Kling
3ebc7fbd28 LibWeb: Create layout node for HTMLObjectElement navigable containers
This makes SVGs in object elements actually render!
2024-11-26 18:32:48 +01:00
Andreas Kling
dd7623eb30 LibWeb: Rename NestedBrowsingContextP => NavigableContainerViewportP
...where P is for Paintable :^)
2024-11-26 18:32:48 +01:00
Andreas Kling
443a8539e9 LibWeb: Rename Layout::FrameBox => NavigableContainerViewport 2024-11-26 18:32:48 +01:00
Glenn Skrzypczak
74645facae LibWeb/HTML: Implement cite attribute according to spec
Implements the cite attribute of `q`, `blockqoute`, `ins` and `del`
elements according to spec by returning a valid URL.
2024-11-26 11:40:42 +00:00
Khaled Lakehal
2f51e9a98e LibWeb/HTML: Use default input size (20) when value is 0
According to the HTML specification, the `size` attribute of an input
element must be a valid non-negative integer greater than zero. If the
value is invalid or set to `0`, the default size of `20` should be used.

This small change fixes one issue identified in
https://wpt.live/html/rendering/widgets/input-text-size.html
The WPT test suite was also automatically imported.
2024-11-26 10:01:57 +00:00
Sam Atkins
310cdc35f0 LibWeb: Fill-in some fixmes around sandboxing flag sets
...Including a couple of steps in
obtain_a_browsing_context_to_use_for_a_navigation_response() which
didn't have FIXMEs.

No apparent changes on WPT.
2024-11-26 10:59:50 +01:00
Sam Atkins
2c7e730726 LibWeb/HTML: Consume user activation when choosing a Navigable
Corresponds to https://github.com/whatwg/html/pull/10547
2024-11-26 10:59:50 +01:00
Pavel Shliak
af9d855b70 LibGfx: Delete DeprecatedPath 2024-11-25 21:13:53 +01:00
Pavel Shliak
dbfe5be9ff LibGfx: Delete DeprecatedPainter 2024-11-25 21:13:53 +01:00
Nathan van der Kamp
1870f1a0a8 LibWeb: Fix crash when skipping to previous word with ctrl+left arrow
Before this change, skipping a word to the left in a non empty text
input element would crash when near the end of the text as the
offset + length of the substring would exceed the length of the string.
2024-11-24 21:02:38 -05:00
Shannon Booth
b677844f8d LibWeb: Remove underlying realm from SyntheticRealmSettings
This was removed from the ShadowRealm HTML spec integration PR after my
suggestion as it is not used anywhere, and I don't believe it would ever
need to be used in the future or by other specs.
2024-11-24 15:29:47 -07:00
Shannon Booth
43f75dcba0 LibWeb: Don't store reference to temporary in resolve_module_specifier
An environment settings object will return a copy to the URL. From a
quick glance, we could probably make an environment settings object
return a reference to one, but let's just change this code to make
a copy since its not safe to rely on that.
2024-11-24 15:29:47 -07:00
Tim Ledbetter
63167cfd89 LibWeb: Remove EventLoop::documents_in_this_event_loop()
This function is no longer used anywhere.
2024-11-24 19:28:13 +00:00
Tim Ledbetter
c322603c42 LibWeb: Avoid Vector filtering when performing find in page queries 2024-11-24 19:28:13 +00:00
Andreas Kling
26f32b11f9 LibWeb: Avoid expensive Vector filtering in event loop
Instead of collecting all documents in a big vector and then filtering
the vector (twice!) with remove_all_matching(), we now pass a filter
callback to documents_in_this_event_loop_matching() and avoid all the
extra shuffling work.

Saw this stuff hogging ~20% of CPU time when profiling a WebContent
process in the middle of a WPT run.
2024-11-24 17:17:01 +01:00
Andreas Kling
5c70436cb2 LibWeb: Teach more of HTMLTokenizer to stop at the insertion point
In particular, input character lookahead now knows how to stop at the
insertion point marker if needed.

This makes it possible to do amazing things like having document.write()
insert doctypes one character at a time.
2024-11-24 11:45:23 +01:00
Kenneth Myhra
4c5019f89c LibWeb: Add serialization and deserilization steps to DOMException
This makes DOMException a Serializable object.
2024-11-24 11:11:44 +01:00
Kenneth Myhra
490c05ef29 LibWeb: Make create_serialized_type() in-fallible
The ::create() functions have all been converted into in-fallible
versions so there is no longer any point in create_serialized_type()
being fallible.
2024-11-24 11:11:44 +01:00
Kenneth Myhra
53394230ca LibWeb: Reorganize definitions and includes to avoid circular references
This is necessary to avoid a circular reference when including
Serializable.h in DOMException.h.

This moves the definition of SerializationRecord, SerializationMemory,
and DeserializationMemory into LibWeb/Forward.h so that Serializable.h
only needs to include LibWeb/Forward.h.
2024-11-24 11:11:44 +01:00