Commit graph

60865 commits

Author SHA1 Message Date
Tim Ledbetter 8b01abf9f7 AK: Don't move trivially copyable types in BufferedStream methods 2024-04-30 13:22:56 +02:00
Timothy Flynn 2d4d16ac37 LibWeb: Remove exceptional return types from infallible stream IDL 2024-04-30 08:14:12 +02:00
Timothy Flynn 572a7bb313 LibWeb: Remove exceptional return types from infallible stream AOs 2024-04-30 08:14:12 +02:00
Timothy Flynn c29916775e LibWeb: Mark stream AOs as infallible as required by the spec
There were several instances where the spec marks an AO invocation as
infallible, but we were propagating WebIDL::ExceptionOr. These mostly
cannot throw due to knowledge about the values they are provided. By
unwinding these, we can remove a decent amount of exception handling.
2024-04-30 08:14:12 +02:00
Timothy Flynn 3aa6ef8ac0 LibWeb: Use LibJS's is-infinity helper in the enqueue-value-with-size AO 2024-04-30 08:14:12 +02:00
Timothy Flynn 9d5e538247 LibWeb: Mark writable stream abort steps as infallible
These don't throw. We can remove a decent amount of exception handling
by marking them infallible.
2024-04-30 08:14:12 +02:00
Timothy Flynn fc070c8cbd LibWeb: Mark readable stream cancel/pull/release steps as infallible
These don't throw. We can remove a decent amount of exception handling
by marking them infallible.
2024-04-30 08:14:12 +02:00
Timothy Flynn 13021a0fb9 LibWeb: Remove small OOM error propagation from stream AOs 2024-04-30 08:14:12 +02:00
Timothy Flynn bbe6b84bd6 LibWeb: Mark most stream callbacks as infallible
There are a number of script-provided stream callbacks for various
stream operations, such as `start`, `pull`, `cancel`, etc. Out of all of
these, only the `start` callback can actually throw. And when it does,
the exception is realized immediately in the corresponding stream
constructor.

All other callbacks have spec text of the form:

    Throwing an exception is treated the same as returning a rejected
    promise.

And indeed this is internally handled by the streams spec. Thus all of
those callbacks can be specified as returning only a promise, rather
than a WebIDL::ExceptionOr<Promise>.
2024-04-30 08:14:12 +02:00
Timothy Flynn ffb48ccd81 LibWeb: Ensure TransformStream's transform/flush callbacks do not throw
Unlike what the comments here currently indicate, these callbacks do
only return a Promise, and thus cannot throw.
2024-04-30 08:14:12 +02:00
Timothy Flynn 60ea803b2a LibWeb: Fix typo in mass copy-pasted comment in stream AOs 2024-04-30 08:14:12 +02:00
Timothy Flynn 9e8ff45962 LibWeb: Fix invalid spec link on the TransformStream constructor 2024-04-30 08:14:12 +02:00
Liav A. 37d62c16f8 Utilities: Initialize raw variables to default values in some utilities 2024-04-30 01:30:38 +02:00
Aliaksandr Kalenik 9275743626 LibWeb: Verify in runtime that stacking context is not painted twice
Duplicated stacking context painting is easy to introduce because of
a bit complicated traversal order and very painful to debug.
2024-04-29 20:32:14 +02:00
Aliaksandr Kalenik 9bc0552a80 LibWeb: Fix paint recording to stop visiting stacking context twice
...if its box is positioned and has z-index=0.
2024-04-29 17:26:13 +02:00
Andreas Kling 1db1ef9ea9 LibGfx: Make non-shared Bitmap used malloc() instead of mmap()
This drastically reduces the cost (in time AND space) of allocating
a Gfx::Bitmap.

Anything that needs to be shared is already using Core::AnonymousBuffer
anyway, so this shouldn't break anything important.

Do note that this makes it an error to create an empty (0x0) Bitmap,
which was previously allowed for some reason. Some small tweaks are
included to bail gracefully in such scenarios.
2024-04-29 09:49:28 +02:00
Andreas Kling db335f5f40 LibGfx+LibGUI: Move Bitmap volatility stuff to GUI::WindowBackingStore
This is only used by LibGUI to manage the volatility of window backing
stores, so let's move it out of Gfx::Bitmap.
2024-04-29 09:49:28 +02:00
Andreas Kling 0967bdad02 LibGfx: Remove the unused Bitmap::set_mmap_name() 2024-04-29 09:49:28 +02:00
Jamie Mansfield 17fc995ee4 Ladybird: Add a context menu to the tab bar
This shows the following actions:

* Reload Tab
* Duplicate Tab
* Move Tab
  * Move to Start
  * Move to End
* Close Tab
* Close Other Tabs
  * Close Tabs to Left
  * Close Tabs to Right
  * Close Other Tabs
2024-04-29 08:11:21 +02:00
Jamie Mansfield 56ed3d5e21 Ladybird: Increase minimum tab width to 128
This is double what the previous minimum is, and is more helpful when
lots of tabs are open.
2024-04-29 08:11:21 +02:00
Tim Ledbetter b9f0ea2178 LibWeb: Evaluate media rules for adopted style sheets
Previously, media rules were not evaluated for adopted style sheets.
2024-04-29 08:10:38 +02:00
Tim Ledbetter f4e0c5395a LibWeb: Don't apply disabled adopted style sheets to the document
Previously, we would apply any adopted style sheet to the document if
its alternate flag was not set. This meant that all adopted style
sheets would be applied, since constructed style sheets never have this
flag set.
2024-04-29 08:10:38 +02:00
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
Liav A. b9df8deba2 Kernel/USB: Don't include UHCIController.h in USBPipe.h
The USB::Pipe is abstracted from the actual USB host controller
implementation, so don't include the UHCIController.h file.
Also, we missed an include to UserOrKernelBuffer.h, so this is added to
ensure the code can still compile.
2024-04-28 22:30:48 +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
Liav A. 872b6f626e Toolchain/Stubs: Fix small typo in README.md 2024-04-28 07:25:41 -06: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 6b5deb2259 Ladybird: Support multiple browser windows in Qt chrome
This also moves the ownership of the TaskManger to the Application.
2024-04-27 20:32:12 -04:00
Andrew Kaster 2bb0f65309 Ladybird: Add singleton process logic for Qt chrome
This only adds the new tab behavior, as handling multiple windows in
the same process needs some extra help.
2024-04-27 20:32:12 -04: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
dgaston 342b358341 Utilities: Make uniq behavior consistent with coreutils
The main difference was that our implementation was writing
the final line of a series of repeated lines, whereas the
spec says "The second and succeeding copies of repeated adjacent
input lines shall not be written."

Additionally, there was a mistake in the -f flag implementation
causing the number of fields skipped to be one greater than
required.
2024-04-27 16:33:27 -06:00
dgaston 1d932d3ebf Utilities: Fix off by one error in uniq
Flags that rely on counting lines (-c and -d) were
producing results that were off by one. This is fixed
by initializing the `count` variable to 1, which is
consistent with behavior in the main loop, where it
is reset to 1 when lines don't match.
2024-04-27 16:33:27 -06:00
dgaston 82887473d2 Utilities: Allow uniq to work on lines of arbitrary length
Calls to `read_line` are replaced with `read_line_with_resize`
and `swap`s of StringViews, which assume a consistent location
of the underlying ByteBuffers, are replaced. A test file has
been added for uniq, which includes a test case for long lines.
2024-04-27 16:33:27 -06:00
Shannon Booth 22705e3065 LibWeb: Don't generate Bindings/Forward.h
This is no longer used.
2024-04-27 18:29:35 -04: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
Jamie Mansfield c2829ce2a0 Ladybird: Retreive the tab title from the underlying Tab
Rather than getting the tab name from the tab container. This resolves
an issue where ampersands were being introduced to the window title
when changing tabs.
2024-04-27 13:39:47 -04: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