Commit Graph

2523 Commits

Author SHA1 Message Date
Kenneth Myhra
d7927aec19 LibWeb: Add spec link to fetch group concept
(cherry picked from commit e36607bdbacef9a829b28ef618c048026a6d6d5f)
2024-07-28 07:31:26 -04:00
Andreas Kling
de66b176d1 LibWeb: Execute the correct script in XMLDocumentBuilder::element_end()
We were mistakenly executing the current node's script instead of the
document's pending parsing-blocking script.

This caused ~1000 WPT tests to time out, since we never ended up firing
a load event for XHTML pages that load multiple external scripts.

(cherry picked from commit 007c292af3202a85eb146b121720d988a66ed64b)
2024-07-28 07:30:38 -04:00
paaspaas00
73f7b56ca5 LibWeb: Fix typo "rtr" -> "rtl"
(cherry picked from commit cdfc7a92f72165ad530bfaf920f1caf18974692f)
2024-07-28 07:30:26 -04:00
Timur Sultanov
0506847101 LibWeb: Set the first added <option> element under <select> as selected
(cherry picked from commit afb2e063b7cd4f3e7c291975a703c8d843fab18b)
2024-07-28 07:30:11 -04:00
Timur Sultanov
5160b88e1e LibWeb: Schedule Microtasks on Microtask queue
(cherry picked from commit 93b6334966a17fe8622615f3dd701206b7d02e14)
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
Kemal Zebari
ddefb5a822 LibWeb: Implement Blob::bytes()
Implements https://w3c.github.io/FileAPI/#dom-blob-bytes.

(cherry picked from commit c5f1e478838092dcf6e4ad8ee0bfef32a47e2d68)
2024-07-28 07:29:31 -04:00
Sam Atkins
d8dafd6b28 LibWeb: Check CanvasTextDrawingStyles.font assignment is valid
Checking that the string parsed for the `font` property is not enough,
the spec also wants to rule out CSS-wide keywords like `inherit`. The
simplest way to do so is to check if it's a ShorthandStyleValue, which
also rules out use of `var()`; this matches other browsers' behaviour.

The newly-added test would previously crash, and now doesn't. :^)

(cherry picked from commit 64d45afd8a650981d4dbab98aa49d47629568f5b)
2024-07-27 22:54:40 -04:00
Mohamed amine Bounya
6bec376d1d LibWeb: Bring 'construct_entry_list' closer to specs
(cherry picked from commit 6e77fff698e1bbb5443c7071d81cb26aaf5f5153)
2024-07-27 22:50:52 -04:00
Edwin Hoksberg
fd17cbe54d LibWeb: Resolve content-visibility fixme in html details element
(cherry picked from commit 0ae048102cf43e961fb5346bf5b9ca8072a3c856)
2024-07-23 21:15:27 -04:00
Andreas Kling
c17f7c84ef LibWeb: Use correct scope when removing style sheet inside a shadow tree
Before this change, removing a style element from inside a shadow tree
would cause it to be unregistered with the document-level list of sheets
instead of the shadow-root-level list.

This would eventually lead to a verification failure if someone tried to
update the text contents of that style element, since it was still in
the shadow-root-level list, but now with a null owner element.

Fixes a crash on https://www.swedbank.se/

(cherry picked from commit 3b7534b3628641244b0998fd5061c6fa75a61cf5)
2024-07-23 08:15:57 -04:00
simonkrauter
61f38a1fa7 LibWeb: Support accent-color for range input and progress element
Fixes #466

(cherry picked from commit 9df8e1f22468884db353f55d10823cd3d15c511b)
2024-07-22 21:29:38 -04:00
Andrew Kaster
a8c4f34bff LibWeb: Create separate DedicatedWorkerGlobalScope class
This is how it's supposed to have been from the beginning, we were just
lazy :).

(cherry picked from commit 40a2bb32c3ab3fb0a5e298a31f674a5eb80b4870)
2024-07-22 21:29:21 -04:00
Andrew Kaster
5d0488ce6f LibWeb: Add closing flag to WorkerGlobalScope
Also implement close a worker AO.

(cherry picked from commit f99c7ad85d150bbe3372edad1a7634263e804eb1)
2024-07-22 21:29:21 -04:00
Andrew Kaster
f2e3d117a2 LibWeb: Initialize HTML::EventLoop with its type
(cherry picked from commit 5d8784318d8240413e555bf2e55bc00d95ea0749)
2024-07-22 21:29:21 -04:00
mobounya
f820114bc6 LibWeb: Update update_for_history_step_application
Update 'update_for_history_step_application' to meet some of the specs
introduced in https://github.com/whatwg/html/pull/9856 and in
https://github.com/whatwg/html/pull/9990

(cherry picked from commit 2497f43989af3efa695d0d33de59001cb87bacb6)
2024-07-22 18:58:29 -04:00
Jamie Mansfield
33a8d6c010 LibWeb/HTML: Stub History.scrollRestoration
(cherry picked from commit e4e64c15aa1027754a4ed47504e2ba42d262e927)
2024-07-22 12:23:12 -04:00
Jamie Mansfield
924ff79fdc LibWeb/HTML: Stub HTMLImageElement.{x,y}
(cherry picked from commit 9eede09c3c228da193e015dbaf95f784e9c96b92)
2024-07-22 12:23:12 -04:00
mobounya
1146868f6d LibWeb: Add fetch group from the fetch spec
Add fetch group concept from the '2.4. Fetch groups' in
the fetch specs to the environment settings object.

(cherry picked from commit 9e223f6daeb3969d3997084a973b26daff6b4f7e)
2024-07-21 16:54:54 -04:00
Tim Ledbetter
75d1715f29 LibWeb: Fire a change event on mouseup of number input buttons
This matches the behavior of other browsers.

(cherry picked from commit e9e195418ef32e73e7c7beb97f4653e5868ee4ef)
2024-07-21 16:54:15 -04:00
Tim Ledbetter
d91ea8ceb8 LibWeb: Update number input on mousedown of number input buttons
This matches the behavior of other browsers. Previously, a click event
was used, so the value was only updated when the mouse was released.

(cherry picked from commit b4b947c60797328d930c8d3de466b8ef292d0ed4)
2024-07-21 16:54:15 -04:00
Tim Ledbetter
c9b06f3a90 LibWeb: Fire input event on user interaction with input element buttons
An input event is now fired when the step up or step down button of an
input element of type number is clicked.

This ensures that any associated <output> element is updated when these
buttons are clicked.

(cherry picked from commit 2a980816e756d727261d53450b4b3f48069d5d50)
2024-07-21 16:54:15 -04:00
Tim Ledbetter
c219ebc0db LibWeb: Deduplicate the firing of input events in HTMLInputElement
Input elements without a defined user-interaction behavior need to fire
an input event when the user changes the element's value in some way.
This change moves the code to do this into its own function and adds
some spec text to explain what is being done.

(cherry picked from commit a3d12e569c88d0dae530657e5bddc18699fb9c9b)
2024-07-21 16:54:15 -04:00
Holger Hans Peter Freyther
fbf44c1dca LibWeb: Fix assertion failure on telekom.de
The EntryType has three possible values: Fetching, Failed or
ModuleScript. It is possible that we transition from Fetching to Failed
as in #13.1. Change the assertion to include the failed scenario.

Fixes: https://github.com/LadybirdBrowser/ladybird/issues/661
(cherry picked from commit 319bb6353e0ba64fc5e54b32ddb2b38736cedef9)
2024-07-21 14:21:11 -04:00
Jamie Mansfield
e8688eed3e LibWeb/HTML: Remove FIXMEs from HTMLTrackElement constants
(cherry picked from commit 87880e9b81a2dde1d0ea46c2d43877e502fd0ea0)
2024-07-21 14:19:52 -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
e99c005c80 LibWeb: Propagate exceptions from setAttribute() in DOMStringMap setter
We were incorrectly assuming that setAttribute() could never fail here,
even when passed an invalid name.

Found by Domato.

(cherry picked from commit 093f1dd805f699801079f55d0d490d80b463ccbb)
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
Andreas Kling
fc462c6c65 LibWeb: Use static_cast<HTMLTemplateElement> right after an is<> check
The double verify_cast here was just barely visible in a profile.

(cherry picked from commit 7dacd6be89619d4c4ac7da3b5bb955cd772a2dc6)
2024-07-21 12:37:05 -04:00
Andreas Kling
630aff7a20 LibWeb: Stop creating transient throwaway JS::Handles in HTML parser
These were being immediately stored in JS::GCPtrs (and dutifully visited
by HTMLParser), so creating temporary handles for them was a complete
waste of time.

(cherry picked from commit f9f11dc51d50746ccb1a82cd304fe30901edc347)
2024-07-21 12:37:05 -04:00
Andreas Kling
457de9e99d LibWeb: Use StringBuilder::append_code_point() over append(Utf32View)
When appending a single Unicode code point, we don't have to go through
the trouble of creating a Utf32View wrapper over it.

(cherry picked from commit 7892ee355df95f6414ab5334d8d997c2c0356a45)
2024-07-21 12:37:05 -04:00
Colin Reeder
8908038f96 LibWeb: Add support for indexed setter of HTMLOptionsCollection
(cherry picked from commit 99824eae142b02c7bce84b9e98d10fc6428f31fe)
2024-07-21 11:29:07 -04:00
circl
5a5c6afd2d LibWeb: Pass network error message to generated error page
(cherry picked from commit b83e82c32cf82d2b9d21271322a4a9161357f081)
2024-07-14 19:57:14 -04:00
Jamie Mansfield
8ce8639ed8 LibWeb: Implement MessageEvent.initMessageEvent
This fixes wpt/html/webappapis/scripting/events/messageevent-constructor.https.html

(cherry picked from commit ffb3a28684b1b4c028af93aa6d7d9194f002d503)
2024-07-14 18:12:26 -04:00
Jamie Mansfield
6e9f9b5efc LibWeb: Implement EmbedderPolicy struct
(cherry picked from commit 190a41971569ad90c26662d7e7e850a61c55c8dd)
2024-07-14 16:45:35 -04:00
Tim Ledbetter
7d71a5483c LibWeb: Don't dispatch click events to disabled FormAssociatedElements
Disabled FormAssociatedElements also no longer receive focus when
clicked.

(cherry picked from commit e18501f67fb0361a10392bc626e6c43f26f1e9cc)
2024-07-14 16:45:21 -04:00
Jamie Mansfield
1d2fa89d9f LibWeb: Implement HTMLMediaElement.textTracks
(cherry picked from commit 65be928d4e18108146645e177b586a3d9117aebc)
2024-07-14 14:01:30 -04:00
Jamie Mansfield
a09b52e40f LibWeb/HTML: Implement TextTrackList IDL interface
(cherry picked from commit ecad28657a0941c99870bdb72f3a6f09b6db6ee3)
2024-07-14 14:01:30 -04:00
Jamie Mansfield
894567cb44 LibWeb: Implement TextTrack.id
(cherry picked from commit ba8e77df1690e9ce00c4903b65adbc19fbda25ed)
2024-07-14 14:01:30 -04:00
Jamie Mansfield
c8cd40fa21 LibWeb: Allow TrackEvent track to be a TextTrack
Fixes two FIXMEs :^)

(cherry picked from commit ab91a616b8e8bdd32c195adb2f081ba07fba2ac4)
2024-07-14 14:01:30 -04:00
simonkrauter
5838244afc LibWeb: Use correct default value for <input type=range>
Previously the input element was displayed with value 0, when no value
was set in the HTML. Now it uses `value_sanitization_algorithm()`, which
will calculate the default value.
In `value_sanitization_algorithm()` there was a logical mistake/typo.
The comment from the spec says "unless the maximum is less than the
minimum".
The added layout test would fail without the code changes.
Fixes #520

(cherry picked from commit 191531b7b18d2edf97dc7bf88a9c19903eeae2d5)
2024-07-14 14:01:21 -04:00
Tim Ledbetter
497fc7476d LibWeb: Remove m_src_is_set field from HTMLScriptElement
Now that we pass an `old_value` parameter to `attribute_changed` it is
no longer necessary to store the current attribute state in
`HTMLScriptElement`.

(cherry picked from commit aa4e18fca50b261eabd5672a3f1163b4ac7ef50b)
2024-07-14 14:01:11 -04:00
Tim Ledbetter
df796fef1a LibWeb: Pass the old attribute value to Element::attribute_changed()
(cherry picked from commit a552bda8d96d3c8a16f02dca5d1b37483dd5a634)
2024-07-14 14:01:11 -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
Jamie Mansfield
9d7267ba76 LibWeb: Add missing edge visit for TextTrack in HTMLTrackElement
(cherry picked from commit 0a3082ef05e8e7a963d3a208acd6efee0ff5c848)
2024-07-14 06:57:14 -04:00
Jamie Mansfield
0a1146c67a LibWeb/HTML: Stub TextTrack IDL interface
(cherry picked from commit 67e3ac8916d7354c8485b4bbe9c4162392e0e99c)
2024-07-14 06:57:14 -04:00
rmg-x
435bbb53f8 LibWeb: Ensure normal line-height on HTMLInputElement
Previously, setting CSS `line-height: 0` on an `input` element would
result in no text being displayed.

Other browsers handle this by setting the minimum height to the
"normal" value for single line inputs.

(cherry picked from commit 629068c2a7eb02db37ffb4fe8d536306ee71e156)
2024-07-14 06:56:56 -04:00
rmg-x
7507357496 LibWeb: Add method HTMLInputElement::is_single_line()
(cherry picked from commit b36a78a798bf9cac60ff13e003b0a1c94a716817)
2024-07-14 06:56:56 -04:00
simonkrauter
8884386b4e LibWeb: Harmonize look of range input element
Previously the entire slider track was colored.
Now only the lower part of the slider track (left side of the thumb) is
colored.
Chrome and Firefox do the same.

(cherry picked from commit 7766909415312b971252f8c7750b0a1873fd5ba0)
2024-07-14 06:56:43 -04:00
Maciej
1e41585416 LibWeb: Implement HTML DragEvent class
This just defines the class, drag events aren't actually fired yet.

(cherry picked from commit 65d8d205ee5d7ef356da58f8238e610949773683)
2024-07-13 22:52:06 -04:00