Commit Graph

142 Commits

Author SHA1 Message Date
Tim Ledbetter
8537cd76f3 LibWeb: Limit HTMLProgressElement.max to positive values
Previously, 0 was returned if `HTMLProgressElement.max` was set to a
negative value.

(cherry picked from commit 353e3e75dcff05f05a65cfc3c70d1cff8db5d50c)
2024-11-07 22:42:20 -05:00
Shannon Booth
51b710bce1 LibWeb: Actually perform "update the href steps"
We completely missed this step, which made setters not actually do
anything!

Fixes 336 test failures on:

https://wpt.live/url/url-setters-a-area.window.html
(cherry picked from commit deff8df2c79af718f08f16bc47f5a22ac6add553)
2024-11-07 21:52:13 -05:00
Tim Ledbetter
95527fd7aa LibWeb: Implement cloning steps for HTMLTextAreaElement
(cherry picked from commit d3e076f963716222787903a9613e0678d909a7ab)
2024-11-04 13:39:53 -05:00
Tim Ledbetter
3710a5b1fb LibWeb: Implement cloning steps for HTMLInputElement
(cherry picked from commit 71cfa705d1eab052e773e6a695c438bab87ec8b0)
2024-11-04 13:39:53 -05:00
Tim Ledbetter
3d130ee6ef LibWeb: Don't group radio buttons from different trees together
Previously, we were searching for other radio buttons from the document
root, rather than the element root.

(cherry picked from commit 67981af276cf55d69d51a872ec83e5b59d793b6c)
2024-11-04 12:29:19 -05:00
Jamie Mansfield
c45292e1aa LibWeb: Don't crash with invalid import maps
See:
 - http://wpt.live/import-maps/multiple-import-maps/with-errors.html
(cherry picked from commit c891b83fc079ee0c34ea9ccc71cfed67e3b14cd2)
2024-11-02 06:45:48 -04:00
Andreas Kling
00e187e0a9 LibWeb: Fix crash when setting innerHTML inside iframe srcdoc document
In particular, there was an assertion failure due to the temporary
parser document's "about base URL" being empty when trying to "parse a
URL" during parsing.

We fix this by copying the context element's document's about base URL
to the temporary parsing document while parsing a fragment.

This fixes a crash when loading search results on https://amazon.com/

(cherry picked from commit b64df59cc61f31b8a0aab91abb4630b3ecb1dcee)
2024-11-02 06:45:38 -04:00
Timothy Flynn
cd69ebdecd LibWeb: Implement the DataTransferItem kind and type attributes
(cherry picked from commit 001d8384e5ea51e2a435517814d299174d65d786)
2024-11-01 22:04:14 -04:00
Timothy Flynn
695771695d LibWeb: Implement the DataTransferItemList length attribute
(cherry picked from commit 843f8f04a518ec0968e4f39ce27264efe0546fa9)
2024-11-01 22:04:14 -04:00
Timothy Flynn
cf1bdd72ac LibWeb: Implement DataTransferItemList.prototype.add()
(cherry picked from commit 74d9cfbf2a2ef84e8634dafc78fc56e6cb153b6b)
2024-11-01 22:04:14 -04:00
Timothy Flynn
77a96886e2 LibWeb: Implement separate DataTransfer factories for IDL / internal use
The IDL constructor has to take separate steps than a DataTransfer that
is internally constructed. Notably, an IDL-created object has its own
drag data store, and that store is placed in a read-write mode.

(cherry picked from commit 5c9287aa99e52886a3d144c26de6a54980a53db6)
2024-11-01 22:04:14 -04:00
Jamie Mansfield
abe4acab3a LibWeb: Implement HTMLTrackElement.readyState
(cherry picked from commit 1d12cb69d46a46442de2baa2a316d5b004821352)
2024-11-01 21:11:17 -04:00
Timothy Flynn
a3050819d2 LibWeb: Implement the DataTransfer files attribute
(cherry picked from commit 4bb9168712d6e706465ded9e1b6764a039651ea0)
2024-11-01 19:58:08 -04:00
Timothy Flynn
7085b7f127 LibWeb: Implement the DataTransfer types attribute
(cherry picked from commit 9f4e3c7e25bbc94a479a2a96cdbe85c47f634627)
2024-11-01 19:58:08 -04:00
Timothy Flynn
a7133e5f31 LibWeb: Begin implementing the drag-and-drop processing model
The drag-and-drop processing model allows for users to drag around
either elements within the DOM or objects completely outside the DOM.
This drag event can either end without action (via cancellation or user
input), or in a drop event, where the dragged object is dropped onto
another element within the DOM.

The processing model is rather large. This implements enough of it to
allow the UI process to specifically handle dragging objects outside of
the DOM onto the DOM. For example, dragging an image from the OS file
manager onto a file-upload input element. This does not implement the
ability to drag DOM elements.

(cherry picked from commit e8a1b8944719e1e297453527fbe0a84cc2c33eb6)
2024-11-01 19:58:08 -04:00
Tim Ledbetter
ac68be994b LibWeb: Implement a minimal version of Window.find()
This is a non-standard API that other browsers implement, which
highlights matching text in the current window.

This is just a thin wrapper around our find in page functionality, the
main motivation for adding this API is that it allows us to write tests
for our find in page implementation.

(cherry picked from commit c4d5ae28ea40ae0a0c783f34d840fb94662780fb)
2024-11-01 09:38:01 -04:00
Jelle Raaijmakers
004462c6e9 LibWeb: Implement history.scrollRestoration
(cherry picked from commit 2106617f5b97dd2e3c4aea11ef26685f43e75261)
2024-10-20 16:39:16 -04:00
Shannon Booth
1308cab372 LibURL+LibWeb: Do not percent decode in password/username getters
Doing it is not part of the spec. Whenever needed, the spec will
explicitly percent decode the username and password.

This fixes some URL WPT tests.

(cherry picked from commit f511c0b441a591bc85f409242229c7b295e118e4)
2024-10-15 12:08:50 -04:00
Tim Ledbetter
84187c2252 LibWeb: Don't crash when parsing HTMLInputElement invalid time values
(cherry picked from commit fe42e2719f1ba92e04a530ca3910a7c8bfbbf1af)
2024-10-11 21:15:10 -04:00
Andreas Kling
dc8eb851ca LibWeb: Make requestAnimationFrame() callback IDs sequential
This is required by the spec, so let's stop returning random IDs in
favor of a simple sequential integer sequence.

(cherry picked from commit 0e1256e5a405627fda18b597d8fd08073dd60b77)
2024-10-11 09:27:51 -04:00
Timur Sultanov
ff18de7f46 Tests: Add test for selection option in <select>
Verify that we can select option using JS

(cherry picked from commit 1ce9bbdd6dcf0f1634014e57d700b697635a79d8)
2024-07-28 12:59:58 -04:00
Jamie Mansfield
a28019e98b LibWeb/HTML: Implement HTMLMediaElement.addTextTrack
Removes some noise from the console when browsing bbc.co.uk :^)

(cherry picked from commit 793248aec977d4b15006d6e55a960da2e115a734,
amended to s/UIEvents::KeyCode/KeyCode/ to resolve cherry-pick conflict)
2024-07-28 07:32:58 -04:00
Timur Sultanov
a74e721c09 Tests: Add tests for <select> element behavior
Check that `<select>` element has options available immediately

(cherry picked from commit 2bf37cb91444dbdaa8e0ccf965b7c9e84717da12)
2024-07-28 07:30:11 -04:00
Andreas Kling
99a06079ce LibWeb: Don't proceed with Element.click() on disabled form controls
Fixes an infinite reload loop on some of the dom/events/ tests in WPT.

(cherry picked from commit 273593afba71a42f1d760ac5b6664b77f74ffb7a)
2024-07-28 07:29:46 -04:00
Edwin Hoksberg
a4ed72afae LibWeb: Implement Element::check_visibility
(cherry picked from commit 5f154ba372f9a667351a026aa4a31306c45fd2a5)
2024-07-24 08:08:15 -04:00
Jamie Mansfield
2ad1fa17fb LibWeb/SVG: Implement SVGAElement.relList
(cherry picked from commit 6ca4c2beb08a81bc4aaa2571ee8c5b3207d0b3a2)
2024-07-21 16:55:11 -04:00
Andreas Kling
7ddd8bac62 LibWeb: Cap HTML dimension values at 17895700 (same as Firefox)
Instead of allowing arbitrarily large values (which could eventually
overflow an i32), let's just cap them at the same limit as Firefox does.

Found by Domato.

(cherry picked from commit 4e0edd42b95abf8ad707c64414dbe618313ce89e)
2024-07-21 14:07:57 -04:00
Andreas Kling
d2ae01f8ad LibWeb: Fix StringView OOB access when parsing 3-character legacy color
Found by Domato.

(cherry picked from commit 1c00e5688d3330626f809e758bb63c8348776971)
2024-07-21 14:07:57 -04:00
Tim Ledbetter
1506f72219 LibWeb: Populate filename in WindowOrWorkerGlobalScope.reportError()
Previously, when `WindowOrWorkerGlobalScope.reportError()` was called
the `filename` property of the dispatched error event was blank. It is
now populated with the full path of the active script.

(cherry picked from commit 34b987366449313c96a73ec1d70e88e60f2c4510)
2024-07-14 06:57:29 -04:00
Natsuki Ikeguchi
fceb6e021f LibWeb: Add initial implementation of global.reportError()
(cherry picked from commit ccb3a2f7add22105a92ca997b67bbe02ec65b535)
2024-07-13 21:40:50 -04:00
Tim Ledbetter
d9245bc5ac LibWeb: Implement the HTMLTrackElement.kind attribute
This reflects the HTML `kind` attribute.

(cherry picked from commit bdaa7f0e8ed738ad0bd6e19878f296436fe40377)
2024-07-01 12:45:34 +02:00
Aliaksandr Kalenik
c6e3c0a339 LibWeb: Create BlockContainer layout node for <input type="button">
...and shadow tree with TextNode for "value" attribute is created.
This means InlineFormattingContext is used, and button's text now
respects CSS text-decoration properties and unicode-ranges.

(cherry picked from commit 8feaecd5c8d02a2fdb989a9a9671e008d1c3a7de)
2024-06-27 19:02:45 +02:00
circl
462abc242e Tests/LibWeb: Add test to verify correctness of getImageData
(cherry picked from commit dbc94ce92e09e987f8a07a5b1e978250286b015a)
2024-06-14 18:18:40 -04:00
Jamie Mansfield
ea69ec8e52 LibWeb: Use a single test for loading attribute 2024-06-08 14:16:48 -04:00
Jamie Mansfield
e5a1f1e582 LibWeb: Test fetchPriority attribute on all elements 2024-06-08 14:16:48 -04:00
Jamie Mansfield
91c7920b34 LibWeb: Implement HTMLAreaElement.referrerPolicy 2024-06-08 14:07:38 -04:00
Jamie Mansfield
07cd441e95 LibWeb: Implement HTMLIFrameElement.referrerPolicy 2024-06-08 14:07:38 -04:00
Jamie Mansfield
c8e87352d8 LibWeb: Implement HTMLImageElement.referrerPolicy 2024-06-08 14:07:38 -04:00
Jamie Mansfield
901fb0d068 LibWeb: Implement HTMLLinkElement.referrerPolicy 2024-06-08 14:07:38 -04:00
Jamie Mansfield
a6fd653afa LibWeb: Use Reflect for HTMLAnchorElement.referrerPolicy 2024-06-08 14:07:38 -04:00
Jamie Mansfield
ade7c6c8fb LibWeb: Use Enumerated for HTMLScriptElement.referrerPolicy 2024-06-08 14:07:38 -04:00
Jamie Mansfield
82fba65faa LibWeb: Implement HTMLImageElement.crossOrigin 2024-06-05 05:02:55 +01:00
Jamie Mansfield
5adce08003 LibWeb: Implement HTMLLinkElement.crossOrigin 2024-06-05 05:02:55 +01:00
Jamie Mansfield
5ae9b49099 LibWeb: Implement HTMLImageElement.fetchPriority 2024-06-05 05:02:55 +01:00
Tim Ledbetter
7d192ed8c1 LibWeb: Don't crash on clicking a label with an associated text input
Previously, we assumed that all label control paintables were of type
`LabelablePaintable`. This caused a crash when clicking on a label with
a text input control.
2024-05-28 08:07:05 +02:00
Jamie Mansfield
600daea544 LibWeb: Implement HTMLIFrameElement.loading 2024-05-27 17:34:59 +02:00
Jamie Mansfield
9ee061ea14 LibWeb: Implement HTMLImageElement.loading
Removes some console noise while loading mmu.ac.uk :)
2024-05-27 17:34:59 +02:00
Andreas Kling
802af5ad9d LibWeb: Allow Element.insertAdjacentHTML on the document element
This fixes wpt/domparsing/insert_adjacent_html.html
2024-05-27 17:33:29 +02:00
Shannon Booth
67b1f4af55 LibWeb: Implement HTMLFormElement.encoding 2024-05-26 07:47:59 +02:00
Shannon Booth
aeb815cc66 LibWeb: Implement HTMLFormElement.enctype 2024-05-26 07:47:59 +02:00