Commit graph

49071 commits

Author SHA1 Message Date
Matthew Olsson
48b67e41f0 LibWeb: Accept a JS::Value for size in enqueue_value instead of a double
This matches what the spec does, and consolidates all of the size-
related errors in one spot instead of distributing them throughout the
various uses of enqueue_value_with_size()
2023-04-10 00:45:03 +02:00
Matthew Olsson
1f7f63ae5a LibWeb: Move Streams/QueueOperations.h to Streams/AbstractOperations.h
This made more sense in the beginning, but now AbstractOperations.h is
so large that there isn't much benefit. This will resolve some ugly
include order issues in the coming commits.
2023-04-10 00:45:03 +02:00
Timothy Flynn
edf85d39c6 LibWeb: Port HTMLVideoElement to play videos with Video::PlaybackManager
This has several advantages over the current manual demuxing currently
being performed. PlaybackManager hides the specific demuxer being used,
which will allow more codecs to be added transparently to LibWeb. It
also provides buffering and controls playback rate for us.

Further, it will allow us to much more easily implement the "media
timeline" to render a timestamp and implement seeking.
2023-04-09 23:55:05 +02:00
Timothy Flynn
7132047c92 LibVideo: Add a forwarding header
And change some non-plain structs to classes for consistency.
2023-04-09 23:55:05 +02:00
Timothy Flynn
918ed5c920 LibVideo: Add a getter for the PlaybackManager's selected track 2023-04-09 23:55:05 +02:00
Timothy Flynn
519b79abde LibVideo: Add a factory to create a PlaybackManager from in-memory data
The demuxer already has such a factory, so this just exposes the same
factory in the PlaybackManager.
2023-04-09 23:55:05 +02:00
Timothy Flynn
3591a13e85 LibVideo+VideoPlayer: Convert playback event handler to callbacks
To pass events from LibVideo's PlaybackManager to interested parties, we
currently dispatch Core::Event objects that outside callers listen for.
Dispatching events in this manner rely on a Core::EventLoop. In order to
use PlaybackManager from LibWeb, change this mechanism to instead use a
set of callbacks to inform callers of events.
2023-04-09 23:55:05 +02:00
Timothy Flynn
0f2b863c01 LibVideo: Initialize primitive member variables in PlaybackManager
Using uninitialized primitives is undefined behavior. In this case, all
videos would autoplay on Serenity, but not play at all on Lagom, due to
some m_playing booleans being uninitialized.
2023-04-09 23:55:05 +02:00
Ben Wiederhake
560133a0c6 Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
Matthew Olsson
6bbd920008 LibWeb: Implement WritableStreamDefaultWriter.releaseLock() 2023-04-09 21:45:39 +02:00
Matthew Olsson
5f4da20a56 LibWeb: Implement WritableStreamDefaultWriter.close() 2023-04-09 21:45:39 +02:00
Matthew Olsson
0c441fa7af LibWeb: Implement WritableStreamDefaultWriter.abort() 2023-04-09 21:45:39 +02:00
Matthew Olsson
c421b6113c LibWeb: Implement WritableStream.abort() 2023-04-09 21:45:39 +02:00
Matthew Olsson
ae2d67c28b LibWeb: Implement WritableStream.getWriter() 2023-04-09 21:45:39 +02:00
Matthew Olsson
f358ae1b13 LibWeb: Remove duplicate declaration in Streams/AbstractOperations.h 2023-04-09 21:45:39 +02:00
Aliaksandr Kalenik
47f03c3a9a LibWeb/Fetch: Use a basic filtered response for redirect navigations
Match following change in the spec:
8f109835dc
2023-04-09 19:10:45 +02:00
Ben Wiederhake
c94924691d Ports: Make libksba/libassuan/ntbtls use Serenity's gpg-error-config
This is likely because we usually used the host's version of the file.
I happen to use a newer libgpg-error (which is relevant because that
particular executable has been renamed, so my system no longer contains
a file of the name gpg-error-config), which revealed this latent bug.
2023-04-09 18:57:49 +02:00
Liav A
5a94e8dfd0 Kernel: Ensure jailed processes can be reaped by a jailed parent process
We were detaching from the jail process list too early. To ensure we
detach properly, leverage the remove_from_secondary_lists method
so the possibly jailed parent process can still see the dying process
and therefore clean it properly.
2023-04-09 18:49:01 +02:00
MacDue
67aceb6c67 Base: Add canvas clip path test page 2023-04-09 18:42:45 +02:00
MacDue
20e9213cc4 LibWeb: Add initial implementation of CRC2D.clip()
This allows clipping your drawing by any path you like! To do this
all painting has been wrapped around a new draw_clipped() helper
method, which handles the clipping before/after painting.

Note: This clipping is currently missing support for intersecting
clip paths.
2023-04-09 18:42:45 +02:00
MacDue
92d9b6edb8 LibWeb: Add simple canvas path clipper
This adds CanvasPathClipper and ScopedCanvasPathClip. These allow
clipping the canvas by some arbitrary path.

This initial implementation is fairly naive, with a good few
allocations, though this can probably be improved in future.
2023-04-09 18:42:45 +02:00
MacDue
ef58062f71 LibGfx: Floor draw origin in fill path implementation
This is done to be consistent with enclosing_int_rect() which is
used elsewhere to work out offsets in PaintStyles. Without this, you
can get an off-by-one in painting.
2023-04-09 18:42:45 +02:00
MacDue
78aad28dba LibGfx: Add Point::to_floored<T>() 2023-04-09 18:42:45 +02:00
MacDue
26e56bdd08 LibGfx: Fix crash due to vector resize in close_all_subpaths()
Since close_all_subpaths() appends while iterating, the vector can
end up being resized and the iterator invalidated. Previously, this
led to a crash/UAF in some cases.
2023-04-09 18:42:45 +02:00
MacDue
064ca625df LibGfx: Add BitmapPaintStyle
This is a simple paint style for filling a path with a bitmap.
2023-04-09 18:42:45 +02:00
Matthew Olsson
5faa0014f2 LibWeb: Implement WritableStream.close() 2023-04-09 18:37:34 +02:00
Tim Schumacher
d4e48db1e1 Tests: Convert LZMA and XZ tests to TRY_OR_FAIL
This is very useful for tracking down a breakage without having to add
temporary dbgln manually.
2023-04-09 18:27:06 +02:00
Tim Schumacher
5f806ec53a LibTest: Add a TRY_OR_FAIL macro
This macro has the usual `TRY` semantics, but instead of returning the
error, it will let the test fail with the formatted error as the fail
message.
2023-04-09 18:27:06 +02:00
Liav A
bfffe88de5 Kernel/HID: Untie the PS2 protocol, i8042 hardware and generic devices
For a very long time, the kernel had only support for basic PS/2 devices
such as the PS2 AT keyboard and regular PS2 mouse (with a scroll wheel).

To adapt to this, we had very simple abstractions in place, essentially,
the PS2 devices were registered as IRQ handlers (IRQ 1 and 12), and when
an interrupt was triggered, we simply had to tell the I8042Controller to
fetch a byte for us, then send it back to the appropriate device for
further processing and queueing of either a key event, or a mouse packet
so userspace can do something meaningful about it.

When we added the VMWare mouse integration feature it was easily adapted
to this paradigm, requiring small changes across the handling code for
these devices.

This patch is a major cleanup for any future advancements in the HID
subsystem.
It ensures we do things in a much more sane manner:
- We stop using LockRefPtrs. Currently, after the initialization of the
  i8042 controller, we never have to change RefPtrs in that class, as we
  simply don't support PS2 hotplugging currently.
  Also, we remove the unnecessary getters for keyboard and mouse devices
  which also returned a LockRefPtr.
- There's a clear separation between PS2 devices and the actual device
  nodes that normally exist in /dev. PS2 devices are not polled, because
  when the user uses these devices, they will trigger an IRQ which when
  is handled, could produce either a MousePacket or KeyEvent, depending
  on the device state.
  The separation is crucial for buses that are polled, for example - USB
  is a polled bus and will not generate an IRQ for HID devices.
- There's a clear separation in roles of each structure. The PS2 devices
  which are attached to a I8042Controller object are managing the device
  state, while the generic MouseDevice and KeyboardDevice manage all
  related tasks of a CharacterDevice, as well as interpreting scan code
  events and mouse relative/absolute coordinates.
2023-04-09 18:11:37 +02:00
Liav A
3a261f5ee8 Kernel: Stop lock & unlock repeatedly while reading from a mouse device
This was a thing we needed to do in the days where we didn't have
safe_memcpy and some wrappers around it to handle possible page faults
safely.
2023-04-09 18:11:37 +02:00
Liav A
d8cbda6950 Kernel: Move HIDDevice::enable_interrupts method to I8042Device class
It happens to be that only PS/2 devices that are connected via the i8042
controller can generate interrupt events, so it makes much more sense to
have those devices to implement the enable_interrupts method because of
the I8042Device class and not the HIDDevice class.
2023-04-09 18:11:37 +02:00
Liav A
d76c08c9b0 Kernel: Introduce a new super class called HIDController
Use the new class in HID code, because all other HID device controllers
will be using this class as their parent class.

Hence, we no longer keep a reference to any PS/2 device in HIDManagement
and rely on HIDController derived classes to do this for us.

It also means that we removed another instance of a LockRefPtr, which
is designated to be removed and is replaced by the better pattern of
SpinlockProtected<RefPtr<>> instead.
2023-04-09 18:11:37 +02:00
Liav A
6c4a47d916 Kernel: Remove redundant HID name from all associated files 2023-04-09 18:11:37 +02:00
Linus Groh
b3cc320718 LibWeb/HTML: Use correct spec link for multipart/form-data encoding 2023-04-09 17:59:36 +02:00
Kenneth Myhra
d39ac0a0ed LibWeb: Port fire_webgl_context_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
fb96966f1e LibWeb: Add WebGL::EventNames 2023-04-09 17:27:27 +02:00
Kenneth Myhra
f9d50e6eca LibWeb: Port fire_keyboard_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
8f4d7f2854 LibWeb: Port fire_a_synthetic_pointer_event() to new FlySring 2023-04-09 17:27:27 +02:00
Kenneth Myhra
cbefab21be LibWeb: Port fire_a_page_transition_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
bf048da8cb LibWeb: Port fire_progress_event() + request_error_steps() to new String
This ports XHR's fire_progress_event() and request_error_steps() to new
FlyString.

Signature of fire_progress_event() parameter event_name  was changed
from 'String const&' to 'FlyString const&'.
2023-04-09 17:27:27 +02:00
Kenneth Myhra
fdd33d818c LibWeb: Port DOMEventListener to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
2091a11488 LibWeb: Port EventTarget to new {Fly}String 2023-04-09 17:27:27 +02:00
Matthew Olsson
868cd95069 LibWeb: Add the WritableStreamDefaultController 2023-04-09 17:14:48 +02:00
Tim Schumacher
83701ec54b Meta+Toolchain: Redirect GDB error output to stdout before grepping 2023-04-09 16:51:11 +02:00
Tim Schumacher
022a55e825 Meta: Add a missing dash to the GDB detection code 2023-04-09 16:51:11 +02:00
Ben Wiederhake
86b83d5823 Ports: Repair the launcher icons of 'stpuzzles' 2023-04-09 16:50:35 +02:00
Nico Weber
1f0b54c857 LibGfx: Limit ICC-size-is-multiple-of-4 check to v4 files
The v2 spec doesn't require it, and it's not true in practice
(e.g. Compact-ICC-Profiles/profiles/sRGB-v2-nano.icc has size 410).
2023-04-09 16:49:49 +02:00
Nico Weber
bed86fb578 LibGfx: Remove some of the noisier logging from webp lossless decoder
Prefix code decoding seems to work fairly well and produces a ton of
log output with `#define WEBP_DEBUG 1`, so remove the log lines.

(If needed it's always possible to just locally revert this commit.)

No behavior change, since WEBP_DEBUG isn't usually defined.
2023-04-09 16:49:38 +02:00
Ben Wiederhake
4107ae1dea Ports: Remove abandoned port 'fheroes2' which was never playable 2023-04-09 11:39:31 +01:00
Liav A
9f217222b7 Meta: Run the QEMU ISA-PC machine with a 64-bit capable CPU
When we had 32 bit support in the OS kernel and userland, the very bare
minimum CPU we supported was Pentium 3, but now the CPU is just required
to support x86-64 long mode to be supported, so the exact model is not
very important.

I chose the QEMU64 virtual CPU model, because the whole concept of the
QEMU ISA-PC machine is that it checks how the kernel handles arbitrarily
old hardware setup.
2023-04-09 10:25:20 +02:00