Commit graph

24344 commits

Author SHA1 Message Date
Tim Ledbetter 84193f2746 LibWeb: Align StyleSheet title getter with the specification
The CSSOM specification says that StyleSheet.title should return null
if the title field is empty.
2024-04-29 08:10:38 +02:00
Aliaksandr Kalenik 7bea2b68f4 LibWeb: Paint non-positioned SC with z-index=0 in paint_descendants()
Fixes the bug when non-positioned boxes that establish a stacking
context and have z-index=0 are ignored during paint commands recording.
2024-04-28 22:28:18 +02:00
Aliaksandr Kalenik 15f69ffbba LibWeb: Use cached absolute rect and transform in refresh_clip_state()
Changes compute_absolute_padding_rect_with_css_transform_applied() to
use cached absolute rect and CSS transform instead of doing expensive
containing block chain traversal.

Reduces refresh_clip_state() from 4% to 2% in Discord profiles.
2024-04-28 17:47:03 +02:00
Timothy Flynn 34b446ab34 LibWeb: Assign the Content-Type fetch response header as appropriate
The condition here was inverted.
2024-04-28 12:32:04 +02:00
Timothy Flynn b04ef436fa LibWeb: Remove OOM propagation from Fetch::Response 2024-04-28 12:32:04 +02:00
Timothy Flynn 790589ceb0 LibWeb: Remove OOM propagation from Fetch::Request 2024-04-28 12:32:04 +02:00
Timothy Flynn d12c560859 LibWeb: Remove OOM propagation from Fetch::Headers 2024-04-28 12:32:04 +02:00
Timothy Flynn d327fa8135 LibWeb: Remove OOM propagation from Fetch::BodyInit 2024-04-28 12:32:04 +02:00
Timothy Flynn 3e991a55fa LibWeb: Remove OOM propagation from Fetch::Body 2024-04-28 12:32:04 +02:00
Andrew Kaster bc976fe7e1 LibWebView: Create plumbing for a single UI process
This allows main UI processes created while there is a currently
running one to request a new tab or a new window with the initial urls
provided on the command line. This matches (almost) the behavior of
Chromium and Firefox.

Add a new IPC protocol between two UI processes. The main UI process
will create an IPC server socket, while secondary UI processes will
connect to that socket and send over the URLs and action it wants the
main process to take.
2024-04-27 20:32:12 -04:00
Andrew Kaster 12a9702acb LibCore: Make singleton process helpers public 2024-04-27 20:32:12 -04:00
Andrew Kaster 70149079e4 LibCore: Add initializer for LocalServer from already connected socket 2024-04-27 20:32:12 -04:00
Andrew Kaster 4db0ec86c0 LibIPC: Allow creating MultiServer from an already existing LocalServer 2024-04-27 20:32:12 -04:00
Nico Weber f8362c8abf LibGfx/JPEG2000: Remove an incorrect VERIFY in TagTree construction
...and add a test case that shows why it's incorrect.

If one dimension is 2^n + 1 and the other side is just 1, then the
topmost node will have 2^n x 1 and 1 x 1 children. The first child will
have n levels of children. The 1 x 1 child could end immediately, or it
could require that it also has n levels of (all 1 x 1) children. The
spec isn't clear on which of the two alternatives should happen. We
currently have n levels of 1 x 1 blocks.

This test case shows that a VERIFY we had was incorrect, so remove it.

The alternative implementation is to keep the VERIFY and to add a

    if (x_count == 1 && y_count == 1)
        level = 0;

to the top of TagTreeNode::create(). Then we don't have multiple levels
of 1 x 1 nodes, and we need to read fewer bits.

The images in the spec suggest that all nodes should have the same
number of levels, so go with that interpretation for now. Once we can
actually decode images, we'll hopefully see which of the two
interpretations is correct.

(The removed VERIFY() is hit when decoding
Tests/LibGfx/test-inputs/jpeg2000/buggie-gray.jpf in a local branch that
has some image decoding implemented. That file contains a packet with
1x3 code-blocks, which hits this case.)
2024-04-28 01:12:20 +02:00
Shannon Booth bad44f8fc9 LibWeb: Remove Bindings/Forward.h from LibWeb/Forward.h
This was resulting in a whole lot of rebuilding whenever a new IDL
interface was added.

Instead, just directly include the prototype in every C++ file which
needs it. While we only really need a forward declaration in each cpp
file; including the full prototype header (which itself only includes
LibJS/Object.h, which is already transitively brought in by
PlatformObject) - it seems like a small price to pay compared to what
feels like a full rebuild of LibWeb whenever a new IDL file is added.

Given all of these includes are only needed for the ::initialize
method, there is probably a smart way of avoiding this problem
altogether. I've considered both using some macro trickery or generating
these functions somehow instead.
2024-04-27 18:29:35 -04:00
Aliaksandr Kalenik b1205f0aa1 LibWeb: Skip unnecessary sample corner and blit corner commands
Before this change we were recording and executing sample/blit commands
for each painting phase, even if there are no painting commands
in-between sample and blit that produce result visible on a canvas.

This change adds an optimization pass that goes through recorded
painting commands list and marks sample and blit commands that could
be skipped.

Reduces sample and blit corners executing from 17% to 8% on Discord.
2024-04-27 21:06:16 +02:00
Andreas Kling b92839fad9 LibJS: Fix bug where argument++ happened before call
For this case to work correctly in the current bytecode world:

    func(a, a++)

We have to put the function arguments in temporaries instead of allowing
the postfix increment to modify `a` in place.

This fixes a problem where jQuery.each() would skip over items.
2024-04-27 17:24:29 +02:00
Aliaksandr Kalenik 776951b7ff LibWeb: Cache combined CSS transform on pre-paint phase
Makes 5% of `compute_combined_css_transform()` in Discord profiles gone.
2024-04-27 16:00:26 +02:00
Aliaksandr Kalenik cd07249482 LibWeb/Painting: Add ClippableAndScrollable mixin
Moves code that was duplicated across PaintableBox and InlinePaintable
into separate class.
2024-04-27 16:00:26 +02:00
Timothy Flynn 207f3f1cb4 LibCore: Remove unnecessary lifetime extension from ProcessSpawnOptions
We don't need `file_actions` to be a constant-reference. It's created
in-place by its one user (HackStudio). Because it is currently a const-
ref, if we try to create a ProcessSpawnOptions like so:

    Core::ProcessSpawnOptions options { .name = "foo"sv };

We get the following error with clang 18:

    lifetime extension of temporary created by aggregate initialization
    using a default member initializer is not yet supported; lifetime of
    temporary will end at the end of the full-expression
2024-04-27 15:17:31 +02:00
Shannon Booth 91efa1d568 LibWeb: Add skeleton for OfflineAudioContext
Implement enough to construct the object itself, with most parts stubbed
out.
2024-04-27 07:11:02 +02:00
Shannon Booth d27b70ae24 LibWeb: Add HTML event 'complete' 2024-04-27 07:11:02 +02:00
Aliaksandr Kalenik 613cd6104d LibWeb: Support masking of SVGForeignObjectPaintable 2024-04-27 07:10:20 +02:00
Aliaksandr Kalenik 7d05fe84bc LibWeb: Add layout node and paintable for SVGForeignObjectElement
Introduces separate layout and paintable type for foreign element.
It is necessary to inherit SVGForeignObjectPaintable from SVGMaskable
in upcoming changes.
2024-04-27 07:10:20 +02:00
Aliaksandr Kalenik acd5369774 LibWeb: Separate svg mask calculation into SVGMaskable
Preparation work before adding support for SVGForeignObjectElement
masking.

Having a mixin makes possible sharing mask calculation between
SVGForeignObjectElement's paintable and SVGGraphicsPaintable.

Both has to support masking:
- PaintableWithLines (from SVGForeignObjectElement) -> PaintableBox
- SVGGraphicsPaintable -> SVGPaintable -> PaintableBox

After this change it will be possible to introduce a new paintable type
for foreignObject that inherits from both PaintableWithLines and
SVGMaskable.
2024-04-27 07:10:20 +02:00
Timothy Flynn c9a461ee75 LibWeb: Remove OOM propagation from Fetch::Infrastructure::HTTP 2024-04-27 07:08:14 +02:00
Timothy Flynn 1ffda6a805 LibWeb: Propagate OOM in Body::fully_read() through its error callback
Fetched bodies can be on the order of gigabytes, so rather than crashing
when we hit OOM here, we can simply invoke the error callback with a DOM
exception. We use "UnknownError" here as the spec directly supports this
for OOM errors:

    UnknownError: The operation failed for an unknown transient reason
                  (e.g. out of memory).

This is still an ad-hoc implementation. We should be using streams, and
we do have the AOs available to do so. But they need to be massaged to
be compatible with callers of Body::fully_read. And once we do use
streams, this function will become infallible - so making it infallible
here is at least a step in the right direction.
2024-04-27 07:08:14 +02:00
Timothy Flynn ec5988d56b LibWeb: Mark the task in the success steps of reading a body as mutable
Otherwise, the `move(bytes_copy)` in the body of the steps does not
actually act as a `move`.
2024-04-27 07:08:14 +02:00
Timothy Flynn 5f51a11618 LibWeb: Remove OOM propagation from Fetch::Infrastructure::Responses 2024-04-27 07:08:14 +02:00
Timothy Flynn 5a4f13dcd4 LibWeb: Remove OOM propagation from Fetch::Infrastructure::Requests 2024-04-27 07:08:14 +02:00
Timothy Flynn b3032befe0 LibWeb: Remove OOM propagation from Fetch::Infrastructure::Methods 2024-04-27 07:08:14 +02:00
Timothy Flynn c79f46fe6f LibWeb: Remove OOM propagation from Fetch::Infrastructure::Headers 2024-04-27 07:08:14 +02:00
Dan Klishch 2925fcd4bc Userland: Compile a special version of LibELF for DynamicLoader
... instead of shamelessly stealing its sources.
2024-04-26 19:08:13 -06:00
Dan Klishch be9ca65179 Meta: Use stripped-down version of LibELF on Lagom 2024-04-26 19:08:13 -06:00
Dan Klishch 7b88363490 Meta+Userland: Make LibELF a proper library on Serenity
Dynamically loaded LibC doesn't need LibELF definitions, so let's not
put them there.
2024-04-26 19:08:13 -06:00
Tim Ledbetter dda730c46b LibWeb: Exclude [Global] interfaces from legacy platform object method
Previously, [Global] interfaces were not excluded from the
`internal_own_property_keys()` call. This caused a crash when iterating
over the properties of the Window object.
2024-04-26 20:02:21 +02:00
Andreas Kling ff9ae5ff40 LibWeb: Bring document & browsing context creation in line with spec
We had drifted away from the spec steps a little bit here. This patch
brings us back in line and knocks off some FIXMEs in the process.
2024-04-26 20:01:58 +02:00
Andreas Kling a5c62b953f LibWeb: Take care of some FIXMEs in auxiliary browsing context creation 2024-04-26 20:01:58 +02:00
Andreas Kling 0ebfc0a4c4 LibWeb: Move event handling & cursor from BrowsingContext to Navigable
This was a long standing FIXME since the introduction of navigables.
2024-04-26 20:01:58 +02:00
Andreas Kling 9cd4a65071 LibWeb: Move TraversableNavigable::m_page up to Navigable
This will allow anyone who has a Navigable to reach the Page.
2024-04-26 20:01:58 +02:00
Aliaksandr Kalenik dc4192c149 LibWeb: Remove CSS transform from InlinePaintable's clip rectangle
Fixes bug when CSS transform is applied twice to clip rect:
- While calculating absolute clip rectangles in `refresh_clip_state()`
- While executing `PushStackingContext` painting command.

Duplicated transform is already removed for PaintableBox and this change
adds this for InlinePaintable.
2024-04-26 18:40:45 +02:00
Timothy Flynn 13422b5116 LibWeb: Remove OOM error propagation from HTMLMediaElement (and friends) 2024-04-26 12:21:57 -04:00
Timothy Flynn dd16ea87c3 LibWeb: Make HTMLMediaElement::set_decoder_error infallible
This used to propagate an OOM error, but that was removed, and this
method can no longer throw.
2024-04-26 12:21:57 -04:00
MINAqwq 7c54a32870 LibWeb: Set decoder error when decoding fails 2024-04-26 11:48:48 -04:00
Ali Mohammad Pur 2f10243fa2 LibTLS: Ignore empty reads from underlying socket while connecting
We should not expect the server to respond immediately after connecting,
this can manifest as random requests failing (e.g. on https://null.com).
2024-04-26 15:53:00 +02:00
Tim Ledbetter 4d9b6645d7 LibIDL: Remove unused required_imported_paths field from Interface 2024-04-26 08:00:32 -04:00
Tim Ledbetter fcf1a2a287 LibWeb: Remove data from WebAssembly cache when namespace is finalized
Previously, the cache held on to data for objects that had already been
garbage collected.
2024-04-26 13:56:39 +02:00
Tim Ledbetter 6d4b8bde55 LibWeb: Isolate WebAssembly cache by global object
This change moves WebAssembly related data that was previously globally
accessible into the `WebAssemblyCache` object and creates one of these
per global object. This ensures that WebAssembly data cannot be
accessed across realms.
2024-04-26 13:56:39 +02:00
Tim Ledbetter 5e75afd549 LibWeb: Fix typo in extended WithGCVisitor extended attribute name 2024-04-26 13:56:39 +02:00
Shannon Booth baaaa0008e LibWeb: Look for first ID _or_ name in HTMLCollection::named_item
Previously we would look for a matching ID, and then for a matching
name. If there was an element in the collection which had a matching ID
as well as an element with a matching name, we would always return the
element with a matching ID irrespective of what order that element was
in.
2024-04-26 07:44:01 -04:00