Commit graph

59324 commits

Author SHA1 Message Date
Kenneth Myhra 27445f3132 LibWeb: Add ability to {,de}serialize platform objects
This adds the ability to serialize and deserialize serializable platform
object in structured_serialize() and structured_deserialize().
2024-02-26 16:10:20 -07:00
Kenneth Myhra 394c38729f LibWeb: Make Blob a Serializable object 2024-02-26 16:10:20 -07:00
Kenneth Myhra fc12402b49 LibWeb: Add abstract class Serializable
This adds the abstract class Serializable which platform objects defined
as Serializable objects can implement to support their appropriate
serialization and deserialization steps.
2024-02-26 16:10:20 -07:00
Kenneth Myhra dcf5ff5178 LibWeb: Move serialize_* methods outside scope of Serializer class
These methods are useful independent of the class Serializer, so let's
move their declarations to the header file and and outside the scope of
the Serializer class.
2024-02-26 16:10:20 -07:00
Kenneth Myhra 985d0dd270 LibWeb: Move deserialize_* methods outside scope of Deserializer class
These methods are useful independent of the class Deserializer, so let's
move their declarations to the header file and and outside the scope of
the Deserializer class.
2024-02-26 16:10:20 -07:00
Andrew Kaster 5a1944ce64 Meta: Link AK to libexecinfo on BSDs and Haiku
This requirement was missed when AK was split into its own library
in 5945cdc054
2024-02-26 16:04:39 -07:00
Andrew Kaster a8a1d8746e Meta: Add implicitfield to the contributors list :^) 2024-02-26 13:51:40 -07:00
Andrew Kaster 5aac6e64e6 Meta: Add Sönke Holz to the contributors list :^) 2024-02-26 13:51:04 -07:00
Andrew Kaster 4654c2e107 Meta: Add Julian Offenhäuser to the contributors list :^) 2024-02-26 13:50:51 -07:00
implicitfield 414bfed6fe mkfs.fat: Add support for autodetecting FAT type based on file size 2024-02-26 13:26:47 -07:00
implicitfield f4112a0f65 mkfs.fat: Prefer using AK::Array over C-style arrays 2024-02-26 13:26:47 -07:00
implicitfield 012f2fd712 mkfs.fat: Fill in the last known free cluster count hint
This allows generated FAT32 file systems to pass fsck.fat without
tripping any warnings.
2024-02-26 13:26:47 -07:00
implicitfield e91f60e0f5 CMake: Replace bespoke utility name mangling logic
Instead of manually removing the '.cpp' extension, we can simply ask
CMake to give us the file name without the last extension.
2024-02-26 13:26:47 -07:00
Sönke Holz 0dca6990b3 Meta: Disable network hardware in run.py for RISC-V
The e1000 driver tries to use interrupt handling functions, which
aren't implemented on RISC-V yet.
2024-02-26 13:22:27 -07:00
Aarushi Chauhan 564e619f57 AboutDialog: Port to GML Complier 2024-02-26 13:20:42 -07:00
Andrew Kaster ea59bfaae7 Ladybird: Move helper processes to CMAKE_INSTALL_LIBEXECDIR
It aligns better with the Filesystem Heirarchy Standard[1] to put our
program-specific helper programs that are not intended to be executed by
the user of the application in $prefix/libexec or in whatever the
packager sets as the CMake equivalent. Namely, on Debian systems this
should be /usr/lib/Ladybird or similar.

[1] https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrlibexec
2024-02-26 13:16:27 -07:00
Andrew Kaster c83e50af0b Documentation: Update for the removal of SERENITY_SOURCE_DIR requirement 2024-02-26 13:16:27 -07:00
Andrew Kaster 68402bec12 Ladybird: Remove $SERENITY_SOURCE_DIR from resource root candidates
Now we will only load resources from $build/share/Lagom. On macOS, we
load from the bundle directory Contents/Resources instead. This
simplifies the commands and environment variables needed to execute
Ladybird from the build directory, and makes our install setup less
awkward for distributions and packagers.
2024-02-26 13:16:27 -07:00
Andrew Kaster 21ac431fac AK: Allow reading from EOF buffered streams better in read_line()
If the BufferedStream is able to fill its entire circular buffer in
populate_read_buffer() and is later asked to read a line or read until
a delimiter, it could erroneously return EMSGSIZE if the caller's buffer
was smaller than the internal buffer. In this case, all we really care
about is whether the caller's buffer is big enough for however much data
we're going to copy into it. Which needs to take into account the
candidate.
2024-02-26 13:16:27 -07:00
Andrew Kaster 0a55749a39 Ladybird+Userland: Use ByteString for candidate server paths
We've adopted a stance that paths should be ByteStrings rather than
UTF-8 strings, so apply that to the Ladybird helpers.
2024-02-26 13:16:27 -07:00
Andrew Kaster 1e0dd9aa8c Ladybird: Copy resources into the build directory
This will let us remove the dependence on SERENITY_SOURCE_DIR
2024-02-26 13:16:27 -07:00
Andrew Kaster 86c1d97e3c Ladybird: Always place helper processes in bundle directory on macOS
Don't put them in bin/ and then copy them to the bundle dir later, as
this means that they only get updated in the bundle directory if the
Ladybird binary itself needs updated. Which is not a fun workflow if you
are working on WPT and want to hack on the WebDriver binary.
2024-02-26 13:16:27 -07:00
Andrew Kaster 9918dcd4d5 LibWebView: Extend GENERATED_SOURCES list instead of replacing 2024-02-26 13:16:27 -07:00
Andrew Kaster 1f8a7db6db Meta: Port recent changes to the gn build
daaaaec2d0
5824916f8c
3a87c000c4
45a47cb32b
11d746a67f
cb97eef2cf
fb8edcea00
2024-02-26 13:16:27 -07:00
Lucas CHOLLET fb81668d8f LibGfx/JPEGLoader: Check earlier for quantization tables presence
This patch brings few small QoL improvements:
 - We don't need to read the Huffman stream before returning an error
   due to a missing quantization table.
 - We check the table presence only once per scan instead of once per
   MCU.
 - `dequantize()` is now infallible.
2024-02-26 20:13:25 +00:00
Bastiaan van der Plaat c41b359ca5 LibWeb: Use WebIDL types where possible instead of C types 2024-02-26 19:26:13 +00:00
Timothy Flynn f1d6693990 LibWebView: Reduce overhead of updating a cookie's last access time
Getting a document's cookie value currently involves:

1. Doing a large SELECT statement and filtering the results to match
   the document and some query parameters based on the cookie RFC.
2. For every cookie selected this way, doing an UPDATE to set its last
   access time.
3. For every UPDATE, do a DELETE to remove all expired cookies.

There's no need to perform cookie expiration for every UPDATE. Instead,
we can do the expiration once after all the UPDATEs are complete.

This reduces time spent waiting for cookies on https://twinings.co.uk
from ~1.9s to ~1.3s on my machine.
2024-02-26 19:59:09 +01:00
Timothy Flynn a346f14fb4 Ladybird/AppKit: Implement the <input type=file> UI 2024-02-26 14:18:49 +01:00
Timothy Flynn 834f76ef24 Ladybird/Qt: Implement the <input type=file> UI 2024-02-26 14:18:49 +01:00
Timothy Flynn ab4d4f0711 Browser: Implement the <input type=file> UI 2024-02-26 14:18:49 +01:00
Timothy Flynn 108521a566 LibWeb+LibWebView+WebContent: Implement more <input type=file> behavior
We had previous implemented some plumbing for file input elements in
commit 636602a54e.

This implements the return path for chromes to inform WebContent of the
file(s) the user selected. This patch includes a dummy implementation
for headless-browser to enable testing.
2024-02-26 14:18:49 +01:00
Timothy Flynn 435c2c24d1 LibWeb: Create a shadow tree for <input type=file> elements
This creates a button to prompt users to select a file, and a label to
show information about the selected file(s). Clicking either shadow
element will activate the input element.
2024-02-26 14:18:49 +01:00
Timothy Flynn 8319c7cfb8 LibWeb: Move code to update HTMLInputElement's shadow tree to a helper
We currently copy-paste a series of if statements to selectively update
the shadow tree elements for some <input> types. This will soon become
longer as more shadow trees are implemented for other types.

This patch just moves those checks to a single location to make adding
more shadow trees easier.
2024-02-26 14:18:49 +01:00
Ali Mohammad Pur 5232afa13d RequestServer+LibProtocol: Make starting requests fully async
This makes it so the clients don't have to wait for RS to become
responsive, potentially allowing them to do other things while RS
handles the connections.
Fixes #23306.
2024-02-26 14:13:37 +01:00
Aliaksandr Kalenik 18d26142f0 LibWeb: Skip StackingContext with erroneously large rect in GPU painter
If the GPU painter encounters a stacking context that requires the
allocation of a framebuffer so large, it is likely due to a layout
mistake, for now, we can skip it instead of crashing because of a
failed allocation.

Fixes https://github.com/SerenityOS/serenity/issues/22608
2024-02-26 07:40:42 +01:00
Sönke Holz 6d48b6724d LibELF: Ignore mapping symbols when symbolicating RISC-V ELFs 2024-02-25 17:33:39 -07:00
Dan Klishch 120d6b2f21 LibCore: Decouple handling of timers and waiting for events
This introduces a new TimeoutSet class for use in
EventLoopImplementationUnix. It is responsible for finding a timer that
expires the soonest and for firing expired timers. TimeoutSet expects
timeouts to be subclasses of EventLoopTimeout, of which EventLoopTimer
is now a subclass, obviously.

TimeoutSet stores timeouts in a binary heap, so
EventLoopImplementationUnix should handle large amounts of timers a lot
better now.

TimeoutSet also supports scheduling of timeouts whose fire time is
relative to the start of the next event loop iteration (i. e. ones
that directly bound polling time). This functionality will reveal its
full potential later with the implementation of asynchronous sockets but
it is currently used to implement zero-timeout timers that are an analog
of Core::deferred_invoke with slightly different semantics.
2024-02-25 17:24:36 -07:00
Dan Klishch ba24e86fdd AK: Introduce IntrusiveBinaryHeap and reimplement BinaryHeap using it
The main difference between them is that IntrusiveBinaryHeap can
optionally maintain an index inside every stored node that allows
arbitrary nodes to be deleted.
2024-02-25 17:24:36 -07:00
Dan Klishch b77996884e LibCore+Ladybird: Don't force timer ids to be integer just to remap them
If we don't force event loop to fit timer id into integer, we can
eliminate awkward IDAllocator inside EventLoopImplementations.
2024-02-25 17:24:36 -07:00
Dan Klishch bed4af6fef LibCore+Ladybird: Make unregistering timer infallible
Let's force calling code to provide valid timer ids. No code changes are
required since, surprise, nobody used this obscure functionality.
2024-02-25 17:24:36 -07:00
Dan Klishch 21097d1c9e LibCore+Ladybird: Don't store timer_id in Core::TimerEvent 2024-02-25 17:24:36 -07:00
Sönke Holz cdc0c9f094 Kernel/Storage: Don't allocate IRQs in NVMeCntlr when nvme_poll passed 2024-02-25 17:20:40 -07:00
Matthew Olsson 0f54d797d2 LibWeb: Handle pre-existing animations when considering animation-name
If a DOM::Element has an animation-name property, then in addition to
remembering where it came from, it will also remember the
Animations::Animation object that was created for it. This allows
StyleComputer to cancel that animation if the animation-name property
changes as well as to apply any changes required (for example, if
animation-play-state changes from "running" to "paused", it needs to
call .pause() on the animation).
2024-02-25 21:12:42 +00:00
Matthew Olsson b235620315 LibWeb: Pause keyframe animations during creation when necessary 2024-02-25 21:12:42 +00:00
Matthew Olsson 2ee022dead LibWeb: Set KeyframeEffect's pseudo-element if applicable 2024-02-25 21:12:42 +00:00
Matthew Olsson 921f6c1e78 LibWeb: Run play tasks before pause tasks
The logic of play() and pause() assumes this to be the case
2024-02-25 21:12:42 +00:00
Timothy Flynn 090dbac5a3 Revert "LibWeb: Allow bypassing transient activation checks for tests"
This reverts commit e52c30cbd5.

It's highly possible that this test was flaky on CI due to mixing units
of seconds and milliseconds in the transient activation calculation.
Revert the workaround for that commit in an attempt to avoid needless
ad-hoc behavior.
2024-02-25 12:35:49 -05:00
Timothy Flynn 8d7a5afe58 LibWeb: Increase the transient activation duration from 5ms to 5s
It seems we were errantly mixing seconds and milliseconds in this
transient activation timeout. Increase it to 5 seconds, and be explicit
about its type - DOMHighResTimeStamp is by definition milliseconds.
2024-02-25 12:35:49 -05:00
Nico Weber 83128d093e LibPDF: Implement most of the spec algorithm for picking TrueType glyphs
Non-CID-keyed fonts in PDFs have 8-bit codepoints which are mapped from
bytes to character names via encoding.

TrueType fonts don't index glyphs by name (Type1 fonts do), so the fix
(codified in the spec) was to make a list of all possible glyph names
and map those to (16-bit) unicode values, and then pass those into the
truetype cmap.

(As a fallback, we're supposed to look at the optional names in the
font's "post" table. That part isn't implemented here yet.)

(Note that this affects the behavior of fallback fonts for TrueType
fonts, but not yet fallback fonts for Type1 fonts, and neither the
behavior of the 14 built-in Type1 fonts (which we implement as
fallback fonts), since the TrueType fallback in Type1Font.cpp does
not use this algorithm yet. This will be fixed in a future patch.)
2024-02-25 15:15:20 +01:00
Nico Weber 207717982c LibPDF: Read /Flags off font descriptors 2024-02-25 15:15:20 +01:00