Commit graph

34859 commits

Author SHA1 Message Date
Aliaksandr Kalenik
7ddb94c4d6 LibWeb: Rename offset to cumulative_offset in ScrollFrame
New name reflects that offset is not just a frame's own offset but a sum
of offsets from containing block chain.
2024-08-19 18:57:20 +02:00
Aliaksandr Kalenik
a59a839df8 LibWeb: Assign "own scroll frame" to a viewport 2024-08-19 18:57:20 +02:00
Timothy Flynn
948b6de3b1 LibWeb+LibWebView+WebContent: Add IPC to send drag-and-drop events
This adds the IPC and related hooks to allow the UI to send drag-and-
drop events from the UI process to the WebContent process.
2024-08-19 13:29:19 +02:00
Timothy Flynn
4bb9168712 LibWeb: Implement the DataTransfer files attribute 2024-08-19 13:29:19 +02:00
Timothy Flynn
8b4d28b5fd LibWeb: Disallow creating a FileAPI::FileList with a vector of files
This factory forced callers to make a list of GC-allocated FileAPI::File
objects. This isn't safe - this opens a window for these files to be
garbage collected before the FileList object stores / visits the list.

Instead, only allow creating an empty FileList and incrementally adding
files to that list.
2024-08-19 13:29:19 +02:00
Timothy Flynn
a3a69b8ad2 LibWeb: Add a forward declaration of FileAPI::FileList 2024-08-19 13:29:19 +02:00
Timothy Flynn
9f4e3c7e25 LibWeb: Implement the DataTransfer types attribute 2024-08-19 13:29:19 +02:00
Timothy Flynn
e8a1b89447 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.
2024-08-19 13:29:19 +02:00
Timothy Flynn
3674e037f3 LibWeb: Implement the DataTransfer effect attributes 2024-08-19 13:29:19 +02:00
Timothy Flynn
9e98e63559 LibWeb: Begin implementing the drag data store 2024-08-19 13:29:19 +02:00
Timothy Flynn
dcb76572e4 LibWeb: Add an empty DataTransferItemList IDL implementation 2024-08-19 13:29:19 +02:00
Timothy Flynn
9e3c6921ab LibWeb: Add an empty DataTransferItem IDL implementation 2024-08-19 13:29:19 +02:00
Timothy Flynn
b6c99c27af LibWeb: Move EditEventHandler's inclusion to EventHandler.cpp
We can get away with using the forward declaration of EditEventHandler
in the header file (and avoid ~1k rebuilt files when EditEventHandler is
modified).

There will be an upcoming DragAndDropEventHandler class, so this patch
just sets things up so that the edit and drag-and-drop event handlers
are stored the same way in EventHandler.
2024-08-19 13:29:19 +02:00
Timothy Flynn
4727ee0139 LibWeb: Remove needless public specifiers from event structs 2024-08-19 13:29:19 +02:00
Andrew Kaster
b03b13b720 AK+LibGfx+LibWebView: Add wrapper header around swift/bridging
When using a configuration without a swift compiler, we need to no-op
the swift annotations. Other, cleverer solutions beyond the has include
all fell flat in the face of the clang modules implementation used by
swift to parse-once use-everywhere each module.
2024-08-19 12:56:55 +02:00
Andrew Kaster
d105b1d4f8 LibWeb: Generate a clang module map file, including generated headers 2024-08-19 12:56:55 +02:00
Andrew Kaster
e45b7b0a86 LibWeb: Add missing Page.h include to SVGDecodedImageData
The PageClient for SVGDecodedImageData needs to actually have the
definition of PageClient available in order to inherit from it. This
fixes importing this header from Objective-C or Swift.
2024-08-19 12:56:55 +02:00
Andrew Kaster
35f4b8bb5c LibWeb: Remove circular include NavigatorBeacon.h <-> Navigator.h
NavigatorBeaconMixin doesn't even need to know about Navigator
2024-08-19 12:56:55 +02:00
Andrew Kaster
422f1ed8de LibCore: Don't wrap <mach/mach.h> in extern "C" on Darwin
This causes issues when loading the file into a clang module, such as
when using Core::MachPort from Objective-C or Swift.
2024-08-19 12:56:55 +02:00
Andrew Kaster
804729fe37 Libraries+Ladybird: Rename LibProtocol -> LibRequests
The identifier "Protocol" is claimed by Objective-C and Swift for use
by the language's built-in protocol conformance feature, which is
similar to Rust traits or Java interfaces.

Rename LibProtocol -> LibRequests, and its namespace from Protocol to
Requests to accomodate this.
2024-08-19 12:56:55 +02:00
Jamie Mansfield
bb95a48035 LibWeb/WebGL: Stub missing includes for WebGLRenderingContext 2024-08-19 09:04:50 +02:00
Jamie Mansfield
b0fd4aff1a LibWeb/Canvas: Stub missing includes for CanvasRenderingContext2D 2024-08-19 09:04:50 +02:00
Aliaksandr Kalenik
3edd22143d LibWeb: Remove set_needs_display() from PageClient::ready_to_paint()
There is no need to force repaint when client is ready for the next
frame. We simply need to make sure HTML event loop processing is
scheduled.
2024-08-19 09:03:33 +02:00
Aliaksandr Kalenik
c87214d79c 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.
2024-08-19 09:03:33 +02:00
Tim Ledbetter
00f03f3e90 LibWeb: Match attribute selectors case insensitively in XML documents
The values of attribute selectors are now compared case insensitively
by default if the attribute's document is not a HTML document, or the
element is not in the HTML namespace.
2024-08-19 09:03:22 +02:00
Tim Ledbetter
c422518792 LibWeb: Add the scope attribute 2024-08-19 09:03:22 +02:00
Tim Ledbetter
353e3e75dc LibWeb: Limit HTMLProgressElement.max to positive values
Previously, 0 was returned if `HTMLProgressElement.max` was set to a
negative value.
2024-08-19 09:02:21 +02:00
Braydn
8d336d2a25 LibThreading: Adjust ThreadPoolLooper m_busy_count sections
The `ThreadPoolLooper` should increment `m_busy_count` before attempting
to access the global queue. Otherwise, there exists a possible race
condition where `wait_for_all` checks the exit conditions before the
looper increments `m_busy_count` but after it empties the `ThreadPool`
queue.

Next, incrementing / decrementing `m_busy_count` is moved to be the
responsibility of `ThreadPoolLooper`. Otherwise, it is possible that
decrementing `m_busy_count` in the caller of `Looper::next` causes
`m_busy_count` to underflow if the call to `Looper::next` returns
before incrementing `m_busy_count`.
2024-08-19 03:08:04 +02:00
Braydn
a0fd7cf371 LibThreading: Fix deadlocks in ThreadPool
When adding tests for `ThreadPool` a handful of deadlocks can be
observed when worker threads wait on `m_work_available`.

The first deadlock is in the destruction of `ThreadPool` where it
is possible for a worker thread to be in the process of acquiring
`m_mutex` when the  broadcast to `m_work_available` in the
destructor happens. This causes the destructor to hang on joining the
thread which is now perpetually waiting on `m_work_available`. This is
solved by repeatedly broadcasting on `m_work_available` until the thread
to join exits.

The second deadlock occurs when the final signal to `m_work_done` is
missed by the wait in `wait_for_all`. At this point all workers are in
the hot loop of attempting to get work from the work queue, however
since there is no work remaining all workers end up waiting on
`m_work_available`. At this point the `wait_for_all` call is also
waiting on `m_work_done`, which will never be signalled again as all
workers are waiting on `m_work_available`.

This requires 2 changes to fix, the first is that workers will signal
`m_done_work` before waiting on `m_work_available`. The second change is
to acquire `m_mutex` before checking the wait conditions as done when
using `wait_while`.
2024-08-19 03:08:04 +02:00
Diego Frias
ed153a1720 LibWasm: Grow table type in table.grow 2024-08-18 23:35:02 +02:00
Diego Frias
0aa76b5f67 LibWeb/WebAssembly: Throw when a table type's max > initial 2024-08-18 23:35:02 +02:00
Diego Frias
80434fa516 LibWeb/WebAssembly: Change behavior of explicit undefined in tables 2024-08-18 23:35:02 +02:00
Diego Frias
3be7e88903 LibWeb/WebIDL: Throw correct error when converting integers
When an integer doesn't fit within the range of an integral type
defined by WebIDL, the spec says to throw a `TypeError`, not a
`RangeError`.
2024-08-18 23:35:02 +02:00
Diego Frias
4e7d3026d2 LibWasm+LibWeb: Allow tables to have externrefs in the JS API 2024-08-18 23:35:02 +02:00
Shannon Booth
fc83653f3c 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.
2024-08-18 11:15:08 +02:00
Shannon Booth
b6d2ab2332 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.
2024-08-18 11:15:08 +02:00
Shannon Booth
3a7ccf8c25 LibWeb: Convert create_new_child_navigable to HeapFunction 2024-08-18 11:15:08 +02:00
Shannon Booth
b86ddac11a LibWeb: Port HTMLImageElement BatchingDispatcher to HeapFunction 2024-08-18 11:15:08 +02:00
Shannon Booth
a622abde77 LibWeb: Port ReadLoopReadRequest to JS::HeapFunction 2024-08-18 11:15:08 +02:00
Shannon Booth
87d964b2f5 LibJS: Use HeapFunction for IteratorHelper 2024-08-18 11:15:08 +02:00
Colin Reeder
347928b950 LibWeb: Fix handling of SSEs split across chunks 2024-08-17 12:54:28 -04:00
Bastiaan van der Plaat
f2034270f1 LibWeb: Add URL reflection to obsolete HTMLImageElement lowsrc property 2024-08-17 17:31:14 +01:00
Tim Ledbetter
1369fc5069 LibWeb: Change attribute type to USVString where applicable
Also mark USVString attributes as containing a URL, where applicable.
2024-08-17 07:45:00 +02:00
Shannon Booth
d56da8cf9a LibWeb: Sort URLSearchParams using UTF-16 code units
We were previously sorting using code points which could give the wrong
result for certain inputs.

Fixes the last two failing tests on:

https://wpt.live/url/urlsearchparams-sort.any.html
2024-08-17 07:44:13 +02:00
Shannon Booth
cff3e78a14 LibWeb: Strip trailing spaces from opaque URL path on query change
This was added in https://github.com/whatwg/url/commit/fdaa0e5a
to fix a case where roundtrips could fail. We had already partially
implemented these steps - but it seems this was missed in the update of
URLSearchParams.

Fixes the last failing WPT test for:

https://wpt.live/url/urlsearchparams-delete.any.html
2024-08-17 07:44:13 +02:00
Jamie Mansfield
ea61e189eb LibWeb/SVG: Add missing SVGGElement IDL file 2024-08-17 07:41:04 +02:00
Jamie Mansfield
e2f599ebee LibWeb/SVG: Implement <metadata> element 2024-08-17 07:40:45 +02:00
Jamie Mansfield
b3fa8f0ce2 LibWeb/HTML: MathML's <ms> is a special tag
This is an omission I noticed while browsing some code :^)
2024-08-17 07:40:10 +02:00
Tim Ledbetter
1365289d98 LibWeb: Implement the setter for location.protocol 2024-08-17 07:39:58 +02:00
Shannon Booth
07940a89ca 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
2024-08-16 22:38:18 +01:00