Commit graph

60412 commits

Author SHA1 Message Date
Timothy Flynn 0234add5fa Ladybird/Qt: Replace the default tab close icon with a vector icon
The default icon used by Qt is a bit jarring. Replace it with an icon
that resembles our other homemade icons.
2024-04-03 20:56:04 +02:00
Timothy Flynn b577782247 Ladybird/Qt: Move the TVG icon loader to a utility file
It will be needed outside of Tab.
2024-04-03 20:56:04 +02:00
Timothy Flynn 1fc995d4aa Ladybird/Qt: Add a hover effect to the audio play state button
By default, a flat QPushButton does not have a hover effect. Add a small
subclass to provide such an effect to make it clearer it is a button.
2024-04-03 20:56:04 +02:00
Timothy Flynn 22ab12e4a1 Meta: Port recent changes to the GN build
ccebc7a905
2024-04-03 20:56:04 +02:00
Andreas Kling fb263e232a LibWeb: Fix typo: covert_number_to_string => convert_number_to_string 2024-04-03 18:17:24 +02:00
Andreas Kling ffac32d20e LibWeb: Use JS::HeapFunction for WebIDL promise reaction steps
Switching away from SafeFunction immediately backfired here, as we're
dealing with two layers of captures, not one.

Let's do the correct fix, which is to use HeapFunction. This makes the
API and its behavior explicit, and keeps captures alive as long as the
HeapFunction is alive.

Fixes #23819.
2024-04-03 18:14:33 +02:00
Andreas Kling f1eb837c3d LibWeb: Remove unnecessary JS::Handle in AbortSignal::timeout()
This fixes yet another GC reference cycle.
2024-04-03 18:14:33 +02:00
Andreas Kling 32d065011b LibWeb: Use Core::Timer in AnimationFrameCallbackDriver
There was no need to use a Platform::Timer here since we're not making
use of the automatic SafeFunction behavior anyway.
2024-04-03 18:14:33 +02:00
Andreas Kling 518cedc8f3 LibWeb: Don't store root as JS::Handle in IntersectionObserver
Instead, use a JS::GCPtr and visit it, to prevent GC reference cycles.
2024-04-03 18:14:33 +02:00
Andreas Kling 52fa415779 LibWeb: Use JS::SafeFunction for ResourceLoader callbacks
This is one of the cases where SafeFunction actually makes sense.
Since every resource load will always either succeed, fail, or time out,
it's okay to use a SafeFunction since we know it will eventually get
destroyed.

Until it does, this allows it to keep any captures alive.
2024-04-03 18:14:33 +02:00
Andreas Kling a9842ebe48 LibWeb: Use JS::HeapFunction in Fetch::Fetching::PendingResponse
This fixes a long-standing realm leak.
2024-04-03 18:14:33 +02:00
Andreas Kling 338dde70a1 LibJS: Don't create Handles in Promise.finally()
Capturing Handles like this was creating unbreakable GC reference cycles
and causing us to leak entire realms.
2024-04-03 18:14:33 +02:00
Andrew Kaster 12fce55caf LibWeb: Don't load favicons twice for non-SVG documents
This seems to be a rebase mishap in bdb8af94ee.
2024-04-03 09:56:53 -06:00
Stanisław Wiśniewski 5f7745641d LibC: Precompute directory_name length in ttyname_r_for_directory() 2024-04-03 09:48:05 -06:00
Stanisław Wiśniewski 72911cd006 LibC: Verify pointer returned by malloc() 2024-04-03 09:48:05 -06:00
mobounya bdb8af94ee LibWeb: Don't load fallback icon for SVG documents
Skip loading a fallback favicon if Document represents a decoded SVG.

Issue: #23405
2024-04-03 09:45:31 -06:00
Nico Weber 44d3fd0546 Tests/JBIG2: Add tests for transposed non-topleft text reference corners
This needed the same `jbig2` changes as for the non-transposed ones,
and the changes to it mentioned on #23780.

I used the same .ini files as for the non-transposed ones, except
that I added `-txt -Param -Transposed 1` as last line to each of them.

All three new files display fine in Chrome.
They all look busted in Firefox.
I think this is likey a bug in pdf.js that I'll report upstream.
(Reportedly they look fine in Acrobat on Android.)
2024-04-03 11:40:25 -04:00
Nico Weber 7b5852bf91 LibGfx/JBIG2: Fix rendering of transposed text
The current code was incorrect for non-TopRight reference corners.
Fixes rendering of ghostpdl/tests/jbig2/042_19.jb2.
2024-04-03 11:40:25 -04:00
Nico Weber 67875ecb6f Tests/JBIG2: Add tests for non-topleft text segment reference corners
This already worked fine. Now it's tested.

I did have to teach `jbig2` to correctly generate test files for this.
See the PR adding these tests for local changes.

I used the script from #23659 to create these images, but I replaced
these lines:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `bottomleft`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 137 50 -ID 3 294 60 -ID 1 199 135 -ID 0 319 232
-txt -Param -RefCorner 0
```

For `bottomright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `topright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 79 -ID 3 265 89 -ID 1 100 234 -ID 0 70 351
-txt -Param -RefCorner 3
```

All three new files display fine in Chrome.
The bottomleft one displays fine in Firefox, while the other two
look compressed in X. I think this is a bug in pdf.js that I'll
report upstream.
(Reportedly they look fine in Acrobat on Android.)
2024-04-03 11:40:25 -04:00
Nico Weber b31e3fe573 LibGfx/JBIG2: Add some debug logging for text segments 2024-04-03 11:40:25 -04:00
Nico Weber b130e36330 LibGfx/JBIG2: Add spaces to some spec comments 2024-04-03 11:40:25 -04:00
Andreas Kling c10f9856a4 LibWeb: Don't use JS::SafeFunction for WebIDL promise reaction steps
SafeFunction was causing massive GC reference cycles here and leaking
entire realms as a result.

Since we end up storing these reaction steps in a JS::NativeFunction
(which uses JS::HeapFunction internally) there should be no need to
protect the captures with SafeFunction.

This dramatically shrinks our memory footprint while running tests.
2024-04-03 12:41:59 +02:00
Andreas Kling 3881717103 LibJS+AK: Register GC memory as root regions for LeakSanitizer
This should fix the gigantic list of false positives dumped by
LeakSanitizer on exit .
2024-04-03 12:41:02 +02:00
Shannon Booth ccebc7a905 LibWeb: Add stubs for the Screen Orientation API
As defined in: https://w3c.github.io/screen-orientation
2024-04-03 10:09:58 +01:00
Aliaksandr Kalenik 7fb09bf95b LibWeb: Skip not runnable in spin_processing_tasks_with_source_until()
Fixes https://github.com/SerenityOS/serenity/issues/23801
2024-04-03 10:25:38 +02:00
Aliaksandr Kalenik f66d33423b LibWeb: Fix spec bug in "destroy child navigable"
See for more details:
https://github.com/whatwg/html/issues/10242

Before this change it only worked because of another bug in
`EventLoop::spin_processing_tasks_with_source_until()`
where we execute tasks regardless of whether they are runnable or not.
2024-04-03 10:25:38 +02:00
Luke Wilde facece1a2a LibWeb: Implement PerformanceObserver.supportedEntryTypes 2024-04-03 07:55:51 +02:00
Luke Wilde 316814988f LibIDL+LibWeb: Add support for static readonly attributes
Support for settable attributes is a FIXME.
2024-04-03 07:55:51 +02:00
Nico Weber 7fc4ea5495 Meta/jbig2_to_pdf.py: Read jbig2 dimensions from file
Since we're parsing segment headers for random-access jbig2 inputs
already, just always do that and get the image dimensions from the
PageInformation segment data. Not all that much more code, and it
makes this script much more pleasant to use.
2024-04-02 15:00:23 -04:00
Nico Weber 05844141bf Meta/jbig2_to_pdf.py: Write correct page contents stream length
The previoulsy hardcoded `25` worked only if the image had width and
height with three digits each (e.g. 399x400).
2024-04-02 15:00:23 -04:00
Nico Weber 2872c37993 Meta/jbig2_to_pdf.py: Allow jbig2 files with random-access organization
jbig2 data in PDFs is in the embedded organization, which is like the
sequential organization with the file header removed.

That means jbig2 files using the random-access organization need to
be transformed to be supported. A random-access jbig2 has all segment
headers at the start, followed by the data of all segments. Decode
all headers and rewrite them to the sequential organization, where
each segment header is followed by that segment's data.

The motivation is that almost all of the jbig2 files in
ghostpdl/test/jbig2 use the random-access organization.
2024-04-02 15:00:23 -04:00
Timothy Flynn c1c1ad8678 Ladybird/Qt: Prevent adding multiple audio state buttons
If the left-hand side of the tab is already occupied with an audio state
button, we would add a second button to the right-hand side. Prevent
that by checking if the occupant is our audio state button.
2024-04-02 15:00:15 -04:00
Timothy Flynn de97497d26 Meta: Port recent changes to the GN build
31c0d00ab1
2024-04-02 15:00:15 -04:00
Andrew Kaster fa8b64d59a LibWebView+WebContent: Notify UI process about WebContent PID explicitly
On Serenity, it's not trivial to extract the peer pid from a socket that
is created by SystemServer and then passed to a forked service process.
This patch adds an API to let the WebContent process notify the UI
directly, which makes the WebContent process show up in the Serenity
port's TaskManagerWidget. It seems that we will need to do something of
this sort in order to properly gather metrics on macOS as well, due to
the way that self mach ports work.
2024-04-02 09:52:34 -06:00
Andrew Kaster a6220501ab Browser: Add a simple TaskManager window for tracking helper proccesses 2024-04-02 09:52:34 -06:00
Andrew Kaster 31c0d00ab1 Ladybird: Add a simple TaskManager window for tracking child processes
This implementation uses a really basic WebView to update stats once
a second. In the future it might make more sense to both move the
details into LibWebView, and to create a native widget for each platform
to remove the overhead of having an extra WebView.
2024-04-02 09:52:34 -06:00
Andrew Kaster 096feaaeb8 Ladybird+LibWebView: Add ProcessManager to track live processes
This model will be used to add a Processes tab to the inspector.
2024-04-02 09:52:34 -06:00
Andreas Kling e66a4668f9 LibWeb: Use plain Vector for HTMLMediaElement::m_pending_play_promises
These are now covered by visit_edges() instead of being strong GC roots.
2024-04-02 15:56:05 +02:00
Andreas Kling 08e62f883d LibWeb: Add missing visits in ResizeObserverEntry
Both m_device_pixel_content_box_size and m_content_rect were missing.
2024-04-02 15:56:05 +02:00
Andreas Kling c409a7cdfd LibWeb: Add missing visit of ResizeObservation::m_realm 2024-04-02 15:56:05 +02:00
Andreas Kling d8b7341050 LibJS: Add missing visit of ECMAScriptFunctionObject::m_name_string 2024-04-02 15:56:05 +02:00
Andreas Kling 44819419ab LibJS: Add missing Base::visit_edges() in JobCallback 2024-04-02 15:56:05 +02:00
Andrew Kaster 44671d7d37 LibJS: Mark GCPtr's operator bool as explicit
This avoids the potential for unwanted implicit conversions to bool.
It doesn't prevent if (m_ptr) checks though, as that invokes an explicit
conversion to bool. This is how std::unique_ptr and std::optional work.
2024-04-02 06:40:08 -04:00
Nico Weber 40780304b8 LibPDF: Add a fastpath for 1bpp grayscale to load_image()
We used to expand every bit in an 1bpp image to a 0 or 255 byte,
then map that to a float that's either 0.0f or 1.0f (or whatever's
in /DecodeArray), then multiply that by 255.0f to convert it to a
u8 and put that in the rgb channels of a Color.

Now we precompute the two possible outcomes (almost always Black
and White) and do a per-bit lookup.

Reduces time for

    Build/lagom/bin/pdf --render-bench --render-repeats 20 --page 36 \
        ~/Downloads/Flatland.pdf

(the "decoded data cached" case) from 3.3s to 1.1s on my system.

Reduces time for

    Build/lagom/bin/pdf --debugging-stats ~/Downloads/0000/0000231.pdf

(the "need to decode each page" case) from 52s to 43s on my machine.

Also makes paging through PDFs that contain a 1700x2200 pixel CCITT
or JBIG2 bitmap on each page noticeably snappier.
2024-04-02 08:07:46 +02:00
Nico Weber c01acdd733 LibPDF: Move decode_array up a bit
No behavior change.
2024-04-02 08:07:46 +02:00
Nico Weber 81ff9f45d9 LibPDF: Move image mask inversion from load_image() to show_image()
No behavior change.
2024-04-02 08:07:46 +02:00
Shannon Booth ce341c0230 LibWeb: Add support for document.lastModified 2024-04-02 07:51:02 +02:00
Shannon Booth d200704b6d LibWeb: Add Last-Modified header to file and resource requests 2024-04-02 07:51:02 +02:00
Shannon Booth b169ffd1cf LibCore: Allow formatting a DateTime in GMT
HTTP dates are always expressed in GMT, so add an API to support that
behaviour.
2024-04-02 07:51:02 +02:00
Shannon Booth 86d29bd775 LibCore: Avoid narrowing conversion in DateTime::to_string 2024-04-02 07:51:02 +02:00