Commit Graph

2709 Commits

Author SHA1 Message Date
Timothy Flynn
dc60651607 LibWeb: Clean up HTMLInputElement-related includes
This mainly uses forward declarations as appropriate for input element
related files. This reduces the number of targets being built when we
change HTMLInputElement.h from 430 to 44.

(cherry picked from commit 57e4fb0caebb0074a23bef70d7558ce5e8a5f357)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
76e28b6a2a LibWeb: Update close_top_level_traversable() to match the spec
(cherry picked from commit 583eef265fe9ba4f91a08e5ef1b7c7339f2371d7)
2024-11-10 10:46:01 -05:00
Andreas Kling
4172811f75 LibWeb: Abort ongoing fetch before starting a new link element fetch
If we decide to fetch another linked resource, we don't care about the
earlier fetch and can safely abort it.

This fixes an issue on GitHub where we'd load the same style sheet
multiple times and invalidate style for the entire document every time
it finished fetching.

By aborting the ongoing fetch, no excess invalidation happens.

(cherry picked from commit 57e26ed6b9b2c0cf1e4f5ac3e85ca0c7f3647caa)
2024-11-10 10:46:01 -05:00
Andreas Kling
adad01a830 LibWeb: Always flush character insertions before exiting HTML parser
This fixes an issue where document.write() with only text input would
leave all the character data as unflushed text in the parser.

This fixes many of the WPT tests for document.write().

(cherry picked from commit a0ed12e839f14b3ac80caca0e18a09ca256fd99d)
2024-11-10 10:46:01 -05:00
Andreas Kling
cfa323ed6e LibWeb: Let style elements remember which StyleSheetList they live in
Instead of trying to locate the relevant StyleSheetList on style element
removal from the DOM, we now simply keep a pointer to the list instead.

This fixes an issue where using attachShadow() on an element that had
a declarative shadow DOM would cause any style elements present to use
the wrong StyleSheetList when removing themselves from the tree.

(cherry picked from commit 8543b8ad6a4d96bd0c247052572b8c2abf3929a7)
2024-11-10 10:46:01 -05:00
Andreas Kling
38ed84421b LibWeb: Add StyleElementUtils::visit_edges()
Let's do this instead of making embedders visit every field of this
helper class.

(cherry picked from commit 2064be708f7318f72553fb210f918fe167e08257)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
8bf45930df LibWeb: Expose crypto object to workers
This change moves the `crypto()` getter from `Window` to
`WorkerOrWindowGlobalScope`. This aligns our implementation with the
WebCrypto specification.

(cherry picked from commit 89b6cd3fb1b9a3058dbada9e12606950b466936a)
2024-11-09 16:08:01 -05:00
Simon Wanner
c7debcd4fd LibWeb: Handle http-equiv pragmas without insertion requirements
These pragmas are either ignored or handled elsewhere

(cherry picked from commit 77610db58cd7297ab30d4fe58f5c604ce1c291cb)
2024-11-09 16:08:01 -05:00
Simon Wanner
52ac4ad816 LibWeb: Use correct http-equiv keywords for comparisons
Previously `#keyword` was used in the macro, meaning all keywords
gained `""` around them

(cherry picked from commit d828d80b756468eb343aec074e7c9944d129437f)
2024-11-09 16:08:01 -05:00
Jamie Mansfield
25d3e1fe74 LibWeb: Implement AbstractWorker
This effectively implements Worker.onerror, and in future
SharedWorker.onerror.

(cherry picked from commit 3440d2b843331fca7392d29ea1b776935d1310de)
2024-11-09 16:08:01 -05:00
Jamie Mansfield
ee8de58b98 LibWeb/HTML: Implement DataTransferItem.webkitGetAsEntry()
(cherry picked from commit 2e9aec984cc3c75f10ea3e6f50ea2ed34f4bd2b6)
2024-11-09 16:08:01 -05:00
Khaled Lakehal
71a01c8122 LibWeb: Add setter implementation for location.search
This commit implements the setter for `location.search`, allowing
updates to the query string of the URL.

(cherry picked from commit 514a2a1757b10b9b4ff020237c84f70ba5a79c4b)
2024-11-09 16:08:01 -05:00
Jamie Mansfield
b20a9496f5 LibWeb: Implement ServiceWorkerContainer.onmessageerror
(cherry picked from commit f1098b4226bde9e574995a63eb3580be537d563d)
2024-11-09 12:29:58 -05:00
Jamie Mansfield
02d9f6186a LibWeb: Implement ServiceWorkerContainer.onmessage
(cherry picked from commit 4b1273cbde387b8f10d488ad90512ecb76b567cc)
2024-11-09 12:29:58 -05:00
Shannon Booth
125dfd9849 LibWeb: Use HeapFunction directly in SessionHistoryTraversalQueue
This allows us to use HeapFunction all of the way down, allowing us
to remove the Handle usage in after_session_callback for
create_new_child_navigable.

(cherry picked from commit fc83653f3c7a650229d2be3eef0f1738a9395db9)
2024-11-09 07:30:40 -05:00
Shannon Booth
41e497d8f7 LibWeb: Port populate_session_history_entry_document to HeapFunction
...For the completion steps. This is quite nice, as we can simply
capture this in the heap function where it is used instead of
needing to establish a new root.

Note that with these changes, to represent 'an empty algorithm', we now
use a null HeapFunction and do not invoke the steps.

(cherry picked from commit b6d2ab23322ebc6d667276257220c401fe025617)
2024-11-09 07:30:40 -05:00
Shannon Booth
74e0101cb1 LibWeb: Convert create_new_child_navigable to HeapFunction
(cherry picked from commit 3a7ccf8c25e56be550b66dda1d9d154e720c72e1)
2024-11-09 07:30:40 -05:00
Shannon Booth
72738891cb LibWeb: Port HTMLImageElement BatchingDispatcher to HeapFunction
(cherry picked from commit b86ddac11a747f45902aa575cde155818ffcfafb)
2024-11-09 07:30:40 -05:00
Colin Reeder
3b03c98e03 LibWeb: Fix handling of SSEs split across chunks
(cherry picked from commit 347928b9508df8f8effe92c372bd72873c4ba2aa)
2024-11-09 07:30:40 -05:00
Tim Ledbetter
943f47fa97 LibWeb: Implement the setter for location.protocol
(cherry picked from commit 1365289d984c32ca7bc076b7892dd56041ab26e2)
2024-11-09 07:30:40 -05:00
Tim Ledbetter
892c6c0439 LibWeb: Return empty string if object element data URL is invalid
(cherry picked from commit c61262684b51864618de99f8b302567c932455be)
2024-11-09 07:30:40 -05:00
Tim Ledbetter
760fea7ffa LibWeb: Return empty string if image element currentSrc URL is invalid
(cherry picked from commit 4f7a4d9c578429b156f4dab78f4f8b0601be9f39)
2024-11-09 07:30:40 -05:00
Jelle Raaijmakers
fe5fa25f47 LibWeb: Implement the "fire a focus event" spec
We weren't setting the focus event's composed flag and view field
correctly.

(cherry picked from commit 124779a376a6951029f81bda980452440a6c6edf)
2024-11-09 07:30:40 -05:00
Shannon Booth
1afda6b82a LibURL+LibWeb: Pass a mutable reference URL to URL parser
If given, the spec expects the input URL to be manipulated on the fly
as it is being parsed, and may ignore any errors thrown by the URL
parser.

Previously, we were not exactly following the specs assumption here
which resulted in us needed to make awkward copies of the URL in these
situations.

For most cases this is not an issue. But it does cause problems for
situations where URL parsing would result in a failure (which is
ignored by the caller), and the URL is _partially_ updated
while parsing.

Such a situation can occur when setting the host of an href alongside a
port number which is not valid. It is expected that this situation will
result in the host being updates - but not the port number.

Adjust the URL parser API so that it mutates the URL given (if any), and
adjust the callers accordingly.

Fixes two tests on https://wpt.live/url/url-setters-a-area.window.html

(cherry picked from commit ff71d8f2c97441bff5975c117a7e7c8820e33e44)
2024-11-09 07:30:40 -05:00
Colin Reeder
b2e5dd2458 LibWeb: Update stylesheet media value when changing link media attribute
(cherry picked from commit 00f75648e56f1077f5e18d8fca04da57afa93195)
2024-11-09 07:30:40 -05:00
Tim Ledbetter
51854c4ffd LibWeb: Resolve HTMLFormElement.action relative to document base URL
Rather than returning a relative URL, an absolutized URL is now
returned relative to the document base URL

(cherry picked from commit 48e5d28ec985aeaee565d06a625a0d664b6975d3)
2024-11-09 07:29:52 -05:00
Tim Ledbetter
ec91831999 LibWeb: Implement HTMLInputElement.formAction
(cherry picked from commit 33c62be7f96eec887d8f65552bbd61439b09a346)
2024-11-09 07:29:52 -05:00
Tim Ledbetter
42d17fb875 LibWeb: Return document URL if formAction attribute is missing or empty
This change also ensures that relative URLs are resolved relative to
the document's base URL.

(cherry picked from commit c25dda767eb43d1620602ccc2c955bc56ef1745b)
2024-11-09 07:29:52 -05:00
Jamie Mansfield
3b1d615320 LibWeb: Implement WorkerNavigator.mediaCapabilities
(cherry picked from commit 936ca720b469899c63c410ed2570a65291843f19)
2024-11-09 07:29:52 -05:00
Jamie Mansfield
4d9f68df8b LibWeb: Implement Navigator.mediaCapabilities
This is enough to stop Crunchyroll showing an unsupported browser
modal :^)

(cherry picked from commit f08946bcd255ccc28ae77ddc69c8e24e37a8a7c9)
2024-11-09 07:29:52 -05:00
Johan Dahlin
dad0b13791 HTMLImageElement: Improve decoding stub
Add an enum and warn when setting to sync/async.

(cherry picked from commit 977e77bd4a0cb5b7441e30b29532a4fc45bfcaf0)
2024-11-09 07:29:52 -05:00
Khaled Lakehal
5de05eba65 LibWeb: Add scope attribute to HTMLTableCellElement
(cherry picked from commit d1bea9c2a4f6bfc9382f7cd1362f6ac7f64a8152)
2024-11-09 07:29:52 -05:00
Jamie Mansfield
312873205b LibWeb: Expose TextMetrics to Worker
(cherry picked from commit f02ca0c431828d535d6a64ef6ca67802fcd8f1c9)
2024-11-08 22:32:11 -05:00
Jamie Mansfield
6f82891ce7 LibWeb: Expose Worker to DedicatedWorker and SharedWorker
(cherry picked from commit 4133177895edffa18c2ecec9c4a24b51a1909638)
2024-11-08 22:32:11 -05:00
Timothy Flynn
7fbe1f8db9 LibWeb: Implement DataTransferItem.prototype.getAsString()
(cherry picked from commit 181ece4d9c64bdd97c19a7c10ed54cdd0e59b43f)
2024-11-08 22:32:11 -05:00
Timothy Flynn
a3b3221607 LibWeb: Implement DataTransferItem.prototype.getAsFile()
This is used on imgur after drag-and-dropping an image onto its page.

(cherry picked from commit b978dba8bdb53f0a1e54b74dde3031242ec268f9)
2024-11-08 22:32:11 -05:00
Andreas Kling
f687fdf000 LibWeb: Handle document/navigable disconnection during favicon decode
If the document is disconnected from the navigable by the time a favicon
decode completes successfully, we don't want to show the favicon for
whatever document is now loaded in the navigable.

Fix this by deferring getting the navigable until after the decode has
completed.

(cherry picked from commit 5606ce412e1d946dcd59a85ed50e429efdde863f)
2024-11-08 22:32:11 -05:00
Jamie Mansfield
38dc317291 LibWeb: Implement HTMLTableCellElement.cellIndex
See:
 - http://wpt.live/html/semantics/tabular-data/attributes-common-to-td-and-th-elements/cellIndex.html
(cherry picked from commit fa5800ebc52a51ad66ddbf5a97ffb9fbb5424b70)
2024-11-08 21:51:25 -05:00
Jamie Mansfield
d81af2f5f5 LibWeb: Set script force async to false when async changes
(cherry picked from commit bedb626c29913f4e355dfd50c29194e15ed71561)
2024-11-08 21:51:25 -05:00
Jamie Mansfield
ceebaac9ef LibWeb: Script force async flag should default to true
See:
 - http://wpt.live/html/semantics/scripting-1/the-script-element/async_001.htm
(cherry picked from commit 77c41a82bec370ae7c8998aa939bd1117a29b31a)
2024-11-08 21:51:25 -05:00
Jamie Mansfield
d1e17efefe LibWeb/HTML: MathML's <ms> is a special tag
This is an omission I noticed while browsing some code :^)

(cherry picked from commit b3fa8f0ce2b8594c7439bf3c9408456d3b9c5dc6)
2024-11-07 23:07:20 -05:00
Shannon Booth
fd427b4efe LibWeb: Handle cases with <template> on the HTML parsing stack
This appears to have been a bug in the spec which was later corrected -
so to fix the crash we can simply remove this assertion.

Fixes: #868
(cherry picked from commit 07940a89cad5ecfa21c2d1d8e055941bdb097ef9)
2024-11-07 23:07:20 -05:00
Bastiaan van der Plaat
3f1147bb7e LibWeb: Add autocomplete property
(cherry picked from commit 517b1a26905667a1dca5ddb61958e0197f9b158a)
2024-11-07 23:07:20 -05:00
Colin Reeder
145c218c8d LibWeb: Use base URL for link loading
(cherry picked from commit c6975a16806a6e7d203a178bd5821941f8a9e4fa)
2024-11-07 23:07:20 -05:00
Jelle Raaijmakers
154af3da1c LibWeb: Implement HTMLMediaElement.preload attribute
This implements the `preload` reflected attribute. No actual preloading
is going on yet.

(cherry picked from commit fe933b2057eee8eb65d6e43a97b934bbe85d03bb)
2024-11-07 23:07:20 -05:00
bbb651
3e710465ca HTML: BrowsingContext: Remove m_parent and fix is_ancestor_of
`BrowsingContext::m_parent` has been removed from the spec,
and previously `m_parent` was always null.

`BrowsingContext::is_top_level` was already always returning
true before because of that, and the updated spec algorithm
causes assertions to fail.

This fixes the following example:
```html
<a href="about:blank" target="test">a
<iframe name="test">
```
clicking the link twice no longer causes it to open in a new tab.

(cherry picked from commit e6a668ad913f0755840954c188c255fc5fc66606)
2024-11-07 22:42:20 -05:00
bbb651
bb691c5537 HTML: Update coop-check-access-report to match spec
(cherry picked from commit f82e3345f2244e6150102fd0c99fb49cdf3af224)
2024-11-07 22:42:20 -05:00
Jamie Mansfield
334d2e0764 LibWeb/Canvas: Stub missing includes for CanvasRenderingContext2D
(cherry picked from commit b0fd4aff1a9a5d1f02f2a36b63812a63728eceea)
2024-11-07 22:42:20 -05:00
Aliaksandr Kalenik
8e3b7e3680 LibWeb: Skip documents of decoded SVGs while processing HTML event loop
None of HTML event loop processing steps are relevant for decoded SVGs,
so we can simply skip them while collecting documents for processing.

(cherry picked from commit c87214d79cf834ee9b7b4da65e902e5233c0a5cc)
2024-11-07 22:42:20 -05:00
Tim Ledbetter
1ca34ff710 LibWeb: Add the scope attribute
(cherry picked from commit c4225187927f12d444612a8bc4e5d0f6bd21aa83)
2024-11-07 22:42:20 -05:00