Commit Graph

59623 Commits

Author SHA1 Message Date
Timothy Flynn
ed13793110 LibWeb: Update the stored textarea value upon change
And fire the "input" event upon change. This is needed to submit a
comment on GitHub; otherwise, GitHub thinks the textarea value is empty.
2024-03-07 00:38:33 +01:00
Timothy Flynn
50d3f85f75 LibWeb: Stub out a few HTMLTextArea validity IDL methods
These are invoked by GitHub when submitting a comment. Stub them out for
now, as this is enough to let GitHub proceed with (attempting) to submit
the comment.
2024-03-07 00:38:33 +01:00
Bastiaan van der Plaat
76f767c867 LibWeb: Apply transform origin in Element::get_client_rects() 2024-03-07 00:28:29 +01:00
Timothy Flynn
5a20353bc4 LibWebView: Ensure we resolve cookie promises upon early returns
Note no test here, because this early return involves HTTP-only cookies,
which we don't have the infrastructure to test (we would need to support
custom HTTP headers in tests).
2024-03-06 14:38:49 -05:00
Timothy Flynn
18b71a363a WebContent: Update mouse event data when coalescing consecutive events
When we coalesce mouse wheel events, we need to be sure to include the
previous event's wheel deltas. This was errantly excluded in commit
baf359354b.
2024-03-06 11:20:44 -05:00
Timothy Flynn
33640c38d6 Meta: Port recent changes to the GN build
6dfb2f9dc8
2024-03-06 11:20:44 -05:00
Timothy Flynn
8a602876d7 Ladybird/Qt: Explicitly ignore wheel events with the ctrl key pressed
This allows ctrl+wheel events to zoom in and out of the page. This was
ported incorrectly in commit c1476c3405.
2024-03-06 11:20:38 -05:00
Ali Mohammad Pur
6dfb2f9dc8 Everywhere: Merge the WebSocket service into RequestServer
This keeps the APIs separate as they are wildly different, a future
improvement could be to somehow unify the APIs (if possible).

Closes #23080.
2024-03-06 10:07:27 +01:00
Andreas Kling
daf5484d6b Revert "Meta: Port recent changes to the GN build"
This reverts commit 285df77fb8.
2024-03-06 09:39:05 +01:00
Andrew Kaster
4dd2ec68fc RequestServer: Transfer ownership of Protocols to all_protocols map
It's no change in application behavior to have these objects owned by
the function-scope static map in Protocol.cpp, while allowing us to
remove some ugly FIXMEs from time immemorial.
2024-03-06 08:15:03 +00:00
Andreas Kling
5b69413c4b Revert "LibJS/Bytecode: Bring back the bytecode optimization pipeline"
This reverts commit 5b29974bfa.
2024-03-06 08:39:29 +01:00
Andreas Kling
b37d84be58 Revert "LibJS/Bytecode: Don't replace the entry block in MergeBlocks"
This reverts commit acd29e064c.
2024-03-06 08:39:29 +01:00
Andreas Kling
cf81bf48c6 Revert "LibJS/Bytecode: Add peephole optimization pass and fuse compare+jump"
This reverts commit 4438ec481c.

Fixes #23480.
2024-03-06 08:39:29 +01:00
Andreas Kling
c4a0afbe28 Revert "LibJS/Bytecode: Fuse [Not, JumpIf] instructions into JumpIfNot"
This reverts commit 795149e585.
2024-03-06 08:39:29 +01:00
Andreas Kling
ea0b7192fa Revert "LibJS/Bytecode: Don't fuse unrelated compare and jump in peephole pass"
This reverts commit c1dbde72e9.
2024-03-06 08:39:29 +01:00
Timothy Flynn
baf359354b LibWebView+WebContent: Use Web::InputEvent for WebContent input IPC
Now that all input events are handled by LibWebView, replace the IPCs
which send the fields of Web::KeyEvent / Web::MouseEvent individually
with one IPC per event type (key or mouse).

We can also replace the ad-hoc queued input structure with a smaller
struct that simply holds the tranferred Web::KeyEvent / Web::MouseEvent.

In the future, we can also adapt Web::EventHandler to use these structs.
2024-03-06 07:46:18 +01:00
Timothy Flynn
2c31ef11bc Ladybird/AppKit: Handle input events through LibWebView
The AppKit chrome currently handles all input events before selectively
forwarding those events to WebContent. This means that WebContent does
not see events like cmd+c.

Here, we make use of LibWebView's input handling and wait for LibWebView
to inform the chrome that it should handle the event itself.
2024-03-06 07:46:18 +01:00
Timothy Flynn
c1476c3405 Ladybird/Qt: Handle input events through LibWebView
The Qt chrome currently handles all input events before selectively
forwarding those events to WebContent. This means that WebContent does
not see events like ctrl+c.

Here, we make use of LibWebView's input handling and wait for LibWebView
to inform the chrome that it should handle the event itself.
2024-03-06 07:46:18 +01:00
Timothy Flynn
ea682207d0 LibWeb+LibWebView: Migrate Browser's input event handling to LibWebView
The Serenity chrome is the only chrome thus far that sends all input key
and mouse events to WebContent, including shortcut activations. This is
necessary for all chromes - we must give web pages a chance to intercept
input events before handling them ourselves.

To make this easier for other chromes, this patch moves Serenity's input
event handling to LibWebView. To do so, we add the Web::InputEvent type,
which models the event data we need within LibWeb. Chromes will then be
responsible for converting between this type and their native events.

This class lives in LibWeb (rather than LibWebView) because the plan is
to use it wholesale throughout the Page's event handler and across IPC.
Right now, we still send the individual fields of the event over IPC,
but it will be an easy refactor to send the event itself. We just can't
do this until all chromes have been ported to this event queueing.

Also note that we now only handle key input events back in the chrome.
WebContent handles all mouse events that it possibly can. If it was not
able to handle a mouse event, there's nothing for the chrome to do (i.e.
there is no clicking, scrolling, etc. the chrome is able to do if the
WebContent couldn't).
2024-03-06 07:46:18 +01:00
Timothy Flynn
f2204e2b3a LibGUI: Define bitwise operations for GUI::MouseButton
This type is designed to be use as a flag. Define bitwise operations for
convenience.

(clang-format-17 caught an east-const conversion here as well).
2024-03-06 07:46:18 +01:00
Timothy Flynn
4b777397b5 Kernel: Define bitwise operations for KeyModifier
This type is designed to be use as a flag. Define bitwise operations for
convenience.
2024-03-06 07:46:18 +01:00
Matthew Olsson
8f3b97e095 LibWeb: Don't render elements with invalid interpolated transform values 2024-03-06 07:45:56 +01:00
Matthew Olsson
e6aef49ef3 LibWeb: Consider fill state before calling Animation::play()
Animation::play_state() does not consider the fill state, and thus will
not return "Playing" for a fill-forward animation in the after phase.
It is still valid for paused, as pausing is not affected by the fill
mode.
2024-03-06 07:45:56 +01:00
Matthew Olsson
5dfe99e247 LibWeb: Do not assert the type of transformation style values
In this case, the StyleValue may be "unresolved", however let's just
avoid the assert altogether and treat all non-transform values as
"none".
2024-03-06 07:45:56 +01:00
Matthew Olsson
1ca31e0dc1 LibWeb: Remove unnecessary ErrorOr<> from StyleComputer
All of this error propogation came from a single call to
HashMap::try_ensure_capacity! As part of the ongoing effort to ignore
small allocation failures, lets just assert this works. This has the
nice side-effect of propogating out to a few other classes.
2024-03-06 07:45:56 +01:00
Matthew Olsson
a511f1ef85 AK: Add HashMap::ensure_capacity 2024-03-06 07:45:56 +01:00
Matthew Olsson
8bb635bd33 LibWeb: Prevent transform interpolations from failing
Style computation should never fail. Instead, we just ignore the
transformation that led to the invalid matrix.
2024-03-06 07:45:56 +01:00
Aliaksandr Kalenik
4d8bc16812 LibWeb: Respect "auto flow" property in grid layout
Before this change, we only considering `grid-auto-flow` to determine
whether a row or column should be added when there was not enough space
in the implicit grid to fit the next unplaced item.

Now, we also choose the direction in which the "auto placement cursor"
is moved, based on the auto flow property.
2024-03-06 07:23:27 +01:00
Andrew Kaster
f9f98016e2 Tests: Add test for loading module scripts in Workers 2024-03-06 07:19:10 +01:00
Andrew Kaster
f67bc591a0 LibWeb: Implement and use the fetch a module worker script graph AO
This involves plumbing the perform the fetch hook argument throughout
all of the module fetch implementation AOs, where it was left as a FIXME
before.

With this change we can load module scripts in DedicatedWorkers.
2024-03-06 07:19:10 +01:00
Andrew Kaster
b5acc5f2df LibWeb: Serialize and pass to the WebWorker the current ESO
This allows the initial fetch() in the run a worker AO to use the proper
values from the outside settings.
2024-03-06 07:19:10 +01:00
Andrew Kaster
4d22358e05 LibWeb: Add facilities to serialize EnvironmentSettingsObjects
This will be used to transfer information about the parent context to
DedicatedWorkers and future out-of-process Worker/Worklet
implementations for fetching purposes. In order to properly check
same-origin and other policies, we need to know more about the outside
settings than we were previously passing to the WebWorker process.
2024-03-06 07:19:10 +01:00
Andrew Kaster
c79bac70f4 LibWeb: Consistently use the EmptyString state of ReferrerPolicy
We previously used an empty optional to denote that a ReferrerPolicy is
in the default empty string state. However, later additions added an
explicit EmptyString state. This patch moves all users to the explicit
state, and stops using `Optional<ReferrerPolicy>` everywhere except for
when an option not being passed from JavaScript has meaning.
2024-03-06 07:19:10 +01:00
Andrew Kaster
637f2f2ed6 LibProtocol: Keep reading until an error occurs for buffered reads
When buffering is enabled for the entire protocol request, it's possible
that the entirety of the file data might be available on the first read
of the pipe passed from RequestServer. If the file is then closed on the
RequestServer end, the client would never realize that the file is EOF
and call the user-provided on_finish callback.

By reading until there's an error, we expect to get an EAGAIN or similar
non-blocking pipe error message if there is still more data.
2024-03-06 07:19:10 +01:00
Andrew Kaster
7e6918e14a LibIPC: Add support for encoding and decoding Array<T, N>
Also add a note to the Concepts header that the reason we have all the
strange concepts in place for container types is to work around the
language limitation that we cannot partially specialize function
templates.
2024-03-06 07:19:10 +01:00
Andrew Kaster
e09bfc1a8c LibCore: Recognize .mjs as a common extension for application/javascript 2024-03-06 07:19:10 +01:00
Andrew Kaster
285df77fb8 Meta: Port recent changes to the GN build
5b29974bfa
c5860d1d706897f1534266c96ccd401c6376e0a4
2024-03-06 07:19:10 +01:00
Nico Weber
ab143e9b0e LibGfx/BMP: Clear alpha in palette entries
The semantics of BGRx8888 aren't super clear and it means different
things for different parts of the codebase. In particular, the PNG
writer still writes the x channel to the alpha channel of its output.

In BMPs, the 4th palette byte is usually 0, which means after #21412 we
started writing all .bmp files with <= 8bpp as completely transparent
to PNGs.

This works around that.

(See also #19464 for previous similar workarounds.)

The added `bitmap.bmp` is a 1bpp file I drew in Photoshop and saved
using its "Save as..." saving path.
2024-03-05 21:27:41 +00:00
Tim Schumacher
b9a5442b59 Ports/zlib: Switch to tarball copies hosted on GitHub
zlib.net uses DDoS protection, which results in broken downloads
whenever a browser validation page is served instead. The tarballs that
are uploaded to GitHub releases are identical with the ones that are
served on zlib.net.
2024-03-05 18:16:09 +01:00
Aliaksandr Kalenik
16f33aafda LibWeb: Always check paintable boxes children during hit-testing
Children of a paintable box are not guaranteed to be contained within
its border box. Therefore, during hit-testing, we must always check
them.

Fixes https://github.com/SerenityOS/serenity/issues/23219
2024-03-05 15:43:17 +01:00
Andreas Kling
c1dbde72e9 LibJS/Bytecode: Don't fuse unrelated compare and jump in peephole pass
Fixes an issue where https://x.com/awesomekling crashed on load. :^)
2024-03-05 13:39:25 +01:00
Andreas Kling
0f8c6dc9ad LibJS/Bytecode: Always evaluate LHS first in assignment expressions
This fixes an issue where expressions like `a[i] = a[++i]` could
evaluate `++i` before `a[i]`.
2024-03-05 10:19:38 +01:00
ddorando
1986693edc Ports: Fix libjodycode and jdupes download
The author unpublished everything on github and moved to codeberg.
The different hashes come from the new platform packaging the
tarfiles differently than before.
2024-03-05 03:24:16 +01:00
Andreas Kling
17c1f742a9 LibJS/Bytecode: Increase coverage of left/shift expression fast paths
As long as the inputs are Int32, we can convert them to UInt32 in a
spec-compliant way with a simple static_cast<u32>.

This allows calculations like `-3 >>> 2` to take the fast path as well,
which is extremely valuable for stuff like crypto code.

While we're doing this, also remove the fast paths from the generic
shift functions in Value.cpp, since we only end up there if we *didn't*
take the same fast path in the interpreter.
2024-03-04 20:54:51 +01:00
Andreas Kling
a5e1e66abc LibJS/Bytecode: Add fast path for LeftShift with Int32 operands 2024-03-04 20:54:51 +01:00
Andreas Kling
8e04791480 LibJS/Bytecode: Combine has_index() and get() in GetByVal and PutByVal
Since get() returns an empty Optional if the index is not present, we
can combine these two into a single get() operation and save the cost of
a virtual call.
2024-03-04 20:54:51 +01:00
Andreas Kling
55e9df4954 LibJS/Bytecode: Add fast paths for equality checks with same-tag values 2024-03-04 20:54:51 +01:00
Andreas Kling
795149e585 LibJS/Bytecode: Fuse [Not, JumpIf] instructions into JumpIfNot 2024-03-04 20:54:51 +01:00
Andreas Kling
4438ec481c LibJS/Bytecode: Add peephole optimization pass and fuse compare+jump
This patch adds a new "Peephole" pass for performing small, local
optimizations to bytecode.

We also introduce the first such optimization, fusing a sequence of
some comparison instruction FooCompare followed by a JumpIf into a
new set of JumpFooCompare instructions.

This gives a ~50% speed-up on the following microbenchmark:

    for (let i = 0; i < 10_000_000; ++i) {
    }

But more traditional benchmarks see a pretty sizable speed-up as well,
for example 15% on Kraken/ai-astar.js and 16% on Kraken/audio-dft.js :^)
2024-03-04 20:54:51 +01:00
Andreas Kling
acd29e064c LibJS/Bytecode: Don't replace the entry block in MergeBlocks
The entry block must stay in place, although it's okay to merge stuff
into it.

This fixes 4 test262 tests and brings us to parity with optimization
disabled. :^)
2024-03-04 20:54:51 +01:00