Commit graph

56951 commits

Author SHA1 Message Date
Timothy Flynn
d8a700d9be LibWebView: Implement a JavaScript console tab in the Inspector
This adds a JS console to the bottom section of the Inspector WebView.
Much of this code is based on the existing WebView::ConsoleClient, but
ported to fit the inspector model. That is, much of the code from that
class is now handled in the Inspector's JS.
2023-12-02 10:34:22 +01:00
Timothy Flynn
9f374a5d2a LibWeb+LibWebView+WebContent: Add an Inspector IPC to execute JavaScript
The Inspector will have an <input> element to execute user-provided JS.
This adds an IDL method and IPC to forward that JS from the Inspector
WebView to the Inspector client.
2023-12-02 10:34:22 +01:00
Timothy Flynn
060807e3da LibWeb: Set correct keyCode for number keys and optional virtual keys
The spec states that if an input key would insert a numerical character
if it were pressed without a modifier, then the keyCode should be that
of the numerical character. For example, the keyCode for a dollar sign
should be that of the number 4.

Further, we should implement the optional fixed virtual key codes.
Otherwise, our implementation would give e.g. the double quote a keyCode
value of 38, which is the same as the up arrow key.
2023-12-02 10:34:22 +01:00
Timothy Flynn
7e92ff062e LibWeb: Update the document's cursor after setting an <input>'s value
The spec step here explicitly says to "move the text entry cursor
position to the end of the text control".
2023-12-02 10:34:22 +01:00
Timothy Flynn
d5d6f9bc92 LibWeb: Dispatch keydown events before invoking special handlers
We need to give pages the opportunity to intercept keydown events and
potentially stop them from propagating. Otherwise, for example, pressing
an arrow key in an <input> element is not observable via script.
2023-12-02 10:34:22 +01:00
Timothy Flynn
27d40bafc9 LibWeb: Do not invert the dispatch_event result in fire_keyboard_event
The return value of fire_keyboard_event is meant to indicate whether the
event should continue propagating (true) or halt (false). This exactly
matches the return value of dispatch_event, so by negating the result,
we are propagating events we shouldn't, and not propagating events we
should.
2023-12-02 10:34:22 +01:00
Timothy Flynn
7edfeb7056 LibWeb: Support committing changes to <input> elements
We currently fire the change event on <input> elements when they lose
focus. The spec allows for us to also fire the event when changes are
"committed", so long as such an action makes sense for the input type.

This patch detects when the return key is entered in an <input> element
and uses that as the commit action for text-related types. If no change
has occurred since the last commit, no change event is fired.
2023-12-02 10:34:22 +01:00
Timothy Flynn
97665fa92f Meta: Port recent changes to the GN build
fbfb70f81a
2023-12-02 10:34:22 +01:00
Lucas CHOLLET
e6fc18d96a LibGfx/TIFF: Support TIFF 5.0 LZW images
This makes us decode `quad-lzw.tif` from libtiff's test suite:
https://libtiff.gitlab.io/libtiff/images.html
2023-12-02 08:04:44 +01:00
Timothy Flynn
4c145fdb12 Ladybird/AppKit: Support enabling the GPU painter 2023-12-01 20:07:27 -05:00
Timothy Flynn
07e9a8f79b Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
2023-12-01 20:07:27 -05:00
Timothy Flynn
8504d8f588 Meta: Support GPU painting in the GN build 2023-12-01 20:07:27 -05:00
Timothy Flynn
8fc5c8b7df WebContent: Print a warning if GPU painting is enabled but not supported 2023-12-01 20:07:27 -05:00
Timothy Flynn
ea81470fc0 WebContent: Remove a bunch of unused includes from PageHost
Mostly just to narrow down where HAS_ACCELERATED_GRAPHICS is used, to
make it easier to see where it needs to be defined by the build system.
2023-12-01 20:07:27 -05:00
Sam Atkins
4ced88b4e5 LibWeb: Make create_a_css_style_sheet() take String arguments 2023-12-01 20:48:13 +01:00
Sam Atkins
d344c50663 LibWeb: Return String from CSSStyleRule::selector_text() 2023-12-01 20:48:13 +01:00
Sam Atkins
374b6cdffd LibWeb: Return String from CSSImportRule::href() 2023-12-01 20:48:13 +01:00
Sam Atkins
ef1e942f3e LibWeb: Use String for getting/setting MediaQueryList media 2023-12-01 20:48:13 +01:00
Sam Atkins
6dbc3044bd LibWeb: Remove some to_deprecated_string() calls in the CSS code 2023-12-01 20:48:13 +01:00
Sam Atkins
9c1c7720c5 LibWeb: Use serialize_a_url() to serialize @import url(...) 2023-12-01 20:48:13 +01:00
Andrew Kaster
fbfb70f81a LibWeb+WebContent: Plumb ability for WebContent process to hold N pages
In order for same-origin NavigableContainers (iframe, frame, embed, ...)
and window.open() WindowProxies to have the proper JS access to their
embedder/opener, we need to host multiple top level traversables in the
same WebContent process. As a first step, make WebContent::PageHost hold
a HashMap of PageClient objects, each holding their own Web::Page that
represents a TraversableNavigable's API surface with the UI process.
2023-12-01 20:47:44 +01:00
Andreas Kling
34ae39478a Kernel/SysFS: Fix bizarre mode bits for directories in SysFS
Not sure what led to 0445 being used here, but let's use 0755.
2023-12-01 20:46:21 +01:00
Ali Mohammad Pur
7edc69dc94 LibCore: Ignore non-S_IFMT bits in directory_entry_type_from_stat
The st_mode field in struct stat is a bitfield of more than just the
file type, this commit masks off the non-filetype bits to ensure no
unrelated bits are checked.
2023-12-01 20:46:16 +01:00
Ali Mohammad Pur
b545427d53 Kernel: Make RAMFS pass along the inode type when traversing as a dir
RAMFS was passing 0, which lead to the userspace seeing all entries as
DT_UNKNOWN when iterating over the directory contents.
To repro prior to this commit, simply check `echo /tmp/*/`.
2023-12-01 20:46:16 +01:00
Ali Mohammad Pur
24a7df9b09 LibLine: Move the cursor to the beginning of the final line after ^C
We previously left it at the end of the final line, which caused the
next prompt to start offset to the right:
    |$ foo^C
    |  $
This commit makes LibLine move to the beginning of that line,
making it so the next prompt shows up at the beginning of the line:
    |$ foo^C
    |$
2023-12-01 20:18:50 +03:30
Ali Mohammad Pur
fde174645a Shell: Accept empty set of completions from program completer
Falling back to default completions goes directly against the users'
wishes :P
2023-12-01 19:24:57 +03:30
Andreas Kling
189d1e8291 LibWeb: Port CSSNamespaceRule to FlyString
This removes a performance problem where we'd convert the style sheet's
default namespace from DeprecatedFlyString to FlyString once per rule
during selector matching.

The conversion now happens once, during CSS parse. It should eventually
be removed from there as well, but one step at a time. :^)
2023-12-01 16:03:58 +01:00
Timothy Flynn
d8f84ef76c CI: Disable running aarch64 tests in CI for now
These tests almost always fail, and all we do is try to boot. Disable it
for now until it can pass more reliably. Note we still compile aarch64,
so the build shouldn't break unnoticed.
2023-12-01 09:35:54 -05:00
Bastiaan van der Plaat
b21ec0afac Ladybird/AppKit: Select all text of location search field on focus 2023-12-01 09:26:37 -05:00
Todderod
e335354b30 LibJS: Call builtins directly in the bytecode interpreter
Allows the bytecode interpreter to call the builtins c++
implementation directly without making a javascript call
just as the JIT.

Kraken test speedups: imaging-gaussian-blur.js (1.5x) and
audio-oscillator.js (1.2x)
2023-12-01 13:01:26 +01:00
Lucas CHOLLET
ce6cd4f45f LibGfx/GIF: Use LZWDecoder::decode_all() 2023-12-01 12:58:14 +01:00
Lucas CHOLLET
cc816b486c LibGfx/TIFF: Use LZWDecoder::decode_all() 2023-12-01 12:58:14 +01:00
Lucas CHOLLET
2a5cb5becb LibCompress: Add LZWDecoder::decode_all()
This method takes bytes as input and decompress everything to a
ByteBuffer. It uses two control codes (clear and end of data) as
described in the GIF, TIFF and PDF specifications.
2023-12-01 12:58:14 +01:00
Tim Schumacher
e9e89d7e4e AK: Optimize BitStream refilling a bit further
This tries to optimize the refill code by making it easier to digest for
the branch predictor. This includes not looping as much across function
calls and marking our EOF case to be unlikely.

Co-Authored-By: Lucas Chollet <lucas.chollet@free.fr>
2023-12-01 12:48:18 +01:00
Tim Schumacher
197331c922 AK: Reject BitStream reads beyond EOF by default
The only exception to this is the lossless WebP decoder, which
legitimately relies on this behavior, even upstream.
2023-12-01 12:48:18 +01:00
Tim Schumacher
cb03d3d78f AK: Allow rejecting BitStream reads beyond EOF 2023-12-01 12:48:18 +01:00
Tim Schumacher
270b1176de Tests: Add a test to codify BitStream behavior beyond stream limits 2023-12-01 12:48:18 +01:00
Tim Schumacher
de49413bdf AK: Don't slice off the first byte of a BitStream read 2023-12-01 12:48:18 +01:00
Lucas CHOLLET
4280f4d2c7 LibGfx/TIFF: Automatically export all enums associated with tags 2023-12-01 12:45:03 +01:00
Sam Atkins
9c12112916 LibWeb: Re-enable the css-background-repeat.html ref test
Assuming that my changes to make iframes delay the load event are
correct, and that nothing else was causing the flakiness, this test
should be OK now! (Famous last words.)
2023-12-01 10:28:02 +01:00
Sam Atkins
2805e16c1c LibWeb: Let NavigableContainers delay the document load event 2023-12-01 10:28:02 +01:00
Sam Atkins
72376ad15a LibWeb: Add special "potentially delay the load event" logic for iframes
`<iframe>`s only potentially delay the load event when their
`current_navigation_was_lazy_loaded` flag is false, so let's wire that
up to the flag's setter, and actually call it!
2023-12-01 10:28:02 +01:00
Sam Atkins
7f509317fd LibWeb: Allow NavigableContainers to report whether to delay load event
Four elements match the "potentially delay the load event" check in the
spec: `<embed>`, `<frame>`, `<iframe>`, and `<object>`. These four are
the same set of elements that are NavigableContainers (or will be once
we implement them) so let's put this logic there.

Note that other things can delay the load event, this is just the name
the spec gives to this particular behaviour.
2023-12-01 10:28:02 +01:00
Sam Atkins
6c5450f9ce LibWeb: Report if anything is delaying load event, not the count
Some elements that delay the load event are more complicated than a
simple count will allow for. We'll implement those in a bit!
2023-12-01 10:28:02 +01:00
Sam Atkins
6154681718 LibWeb: Flesh out some of process_the_iframe_attributes() 2023-12-01 10:28:02 +01:00
Sam Atkins
1d6f06b203 LibWeb: Make HTMLIFrameElement a LazyLoadingElement
This replaces its previous partial implementation of the lazy loading
scaffolding. It still doesn't actually load lazily yet.
2023-12-01 10:28:02 +01:00
Sam Atkins
cc633123ca LibWeb: Extract shared lazy-loading behavior into a base class
`<iframe>` and `<img>` tags share the same spec for several aspects of
lazy-loading: how the `loading` attribute works, the "will lazy load
element" steps, and a member for storing the lazy-load resumption
steps. So let's share the implementation by using a base class.

This mostly involves moving things around. However, we also change the
`start_intersection_observing_a_lazy_loading_element()` method to take
a LazyLoadingElement, and operate on one, instead of always casting to
HTMLImageElement.

We do unfortunately have to do some shenanigans to make the cast work,
by adding a virtual function stub in DOM::Element.
2023-12-01 10:28:02 +01:00
Aliaksandr Kalenik
cc2008ea0d LibWeb: Skip painting of empty stacking contexts in GPU painter
Fixes crashing on https://twinings.co.uk/ that was happening because
of 0 size texture allocation.
2023-12-01 09:28:10 +01:00
Aliaksandr Kalenik
c28f6828c9 LibAccelGfx+LibWeb: Support non-translation transforms in GPU painter
This change introduces GPU painter support for rotate(), skew(),
scale(), and other transformations that could be applied to stacking
context.
2023-12-01 09:28:10 +01:00
Daniel Bertalan
45d81dceed Everywhere: Replace ElfW(type) macro usage with Elf_type
This works around a `clang-format-17` bug which caused certain usages to
be misformatted and fail to compile.

Fixes #8315
2023-12-01 10:02:39 +02:00