Commit graph

60179 commits

Author SHA1 Message Date
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
Shannon Booth 28307d0db6 LibCore: Add modified time to Resource
For now, all Resources are implemented with a modification time, but the
public API has been left as an Optional since abstractly, not all
resources will have a modification time.
2024-04-02 07:51:02 +02:00
Timothy Flynn e3ef849838 LibJS: Support string literal expressions in nullish object exceptions 2024-04-02 07:50:17 +02:00
Timothy Flynn e7f2af6ff4 LibJS: Return a ByteString from StringLiteral::value
No need to force a re-allocation for the literal value.
2024-04-02 07:50:17 +02:00
Timothy Flynn bfcfe6ce35 LibJS: Support numeric literal expressions in nullish object exceptions 2024-04-02 07:50:17 +02:00
Timothy Flynn 2d603c7c3f LibJS: Support computed member expressions in nullish object exceptions 2024-04-02 07:50:17 +02:00
Timothy Flynn 51f5fa1437 Meta: Port recent changes to the GN build
3bab4fbae9
a6a40a5bc6
6d72f40d8d
1f59e21829
2024-04-02 07:50:17 +02:00
Tim Ledbetter 3876875bd8 LibWeb: Stub out missing cross origin properties on the window object
Previously, trying to access the `close`, `closed` or `blur` properties
on a cross origin window would cause a crash.
2024-04-02 07:46:16 +02:00
Tim Ledbetter 558fef237c LibWeb: Use the global object to access the performance object
Previously, we were accessing the performance through the current
window object. Thus caused a crash when `animate()` was called on an
element within a document with no associated window object. The global
object is now used to access the performance object in places where
a window object is not guaranteed to exist.
2024-04-02 07:46:16 +02:00
Tim Ledbetter eebdc7bc88 LibWeb: Allow the Performance object to be used by workers 2024-04-02 07:46:16 +02:00
Shannon Booth adf061a29c LibWeb: Avoid copying cached elements in HTMLCollection
Once we have built up a cache, we can use that internally for operations
on the collection, instead of copying over the list of elements every
time.

On a synthentic benchmark of a page with ~500 link elements, this
results in a 45% percent speedup on my machine.

```html
<body>
    <ul>
        <li><a href="#">Link 1</a></li>
        ...
        <li><a href="#">Link N</a></li>
    </ul>

    <script>
        window.onload = function() {
            const startTime = performance.now();
            for (let i = 0; i < 1_000_000; ++i) {
                const numLinks = document.links.length;
            }
            const endTime = performance.now();
            const timeTaken = endTime - startTime;
            console.log(timeTaken);
        };
    </script>
</body>
</html>
```
2024-04-02 07:33:40 +02:00
Shannon Booth 094ab8b4d2 LibWeb: Remove some uneeded const_casts from HTMLCollection
Correcting a variable name while we're at it.
2024-04-02 07:33:40 +02:00
Shannon Booth b1be8bd826 LibWeb: Implement is_supported_property_index in terms of length() 2024-04-02 07:33:40 +02:00
Shannon Booth b9b264e97a LibWeb: Remove redundant is_empty check from is_supported_property_index
An empty list of elements will not return true for any unsigned number,
so we can simply remove this check.
2024-04-02 07:33:40 +02:00
Shannon Booth cdd0038c9e LibWeb: Factor out a method to update the cached elements
This is useful for any function which is needing to read the from the
cache, instead of onl using `collect_matching_elements`.
2024-04-02 07:33:40 +02:00
Timothy Flynn b6501adef8 LibWeb: Use the proper in-flight request to check if a stream is closing 2024-04-01 21:11:01 +02:00
MacDue 59cd086199 LibWeb: Stub (and implement) SVGSVGElement methods and attributes
This implements trivial functions and stubs out the rest.

Implemented:

```
[SameObject] readonly attribute SVGAnimatedLength x;
[SameObject] readonly attribute SVGAnimatedLength y;
[SameObject] readonly attribute SVGAnimatedLength width;
[SameObject] readonly attribute SVGAnimatedLength height;

undefined deselectAll();

SVGLength createSVGLength();
DOMPoint createSVGPoint();
DOMMatrix createSVGMatrix();
DOMRect createSVGRect();
SVGTransform createSVGTransform();

Element getElementById(DOMString elementId);

unsigned long suspendRedraw(unsigned long maxWaitMilliseconds);
undefined unsuspendRedraw(unsigned long suspendHandleID);
undefined unsuspendRedrawAll();
undefined forceRedraw();
```

Stubbed:

```
attribute float currentScale;
[SameObject] readonly attribute DOMPointReadOnly currentTranslate;

NodeList getIntersectionList(
  DOMRectReadOnly rect, SVGElement? referenceElement);
NodeList getEnclosureList(
  DOMRectReadOnly rect, SVGElement? referenceElement);
boolean checkIntersection(SVGElement element, DOMRectReadOnly rect);
boolean checkEnclosure(SVGElement element, DOMRectReadOnly rect);
```
2024-04-01 21:10:35 +02:00
MacDue 5739ea9ba1 LibWeb: Stub SVGGraphicsElement methods/attributes
This stubs the `SVGGraphicsElement.getBBox()` method and the
`.transform` attribute.
2024-04-01 21:10:35 +02:00
MacDue 329262d54f LibWeb: Stub SVGTextContentElement.getStartPositionOfChar() 2024-04-01 21:10:35 +02:00
MacDue bafb6bd059 LibWeb: Move SVGLength unit constants to header
No behaviour change.
2024-04-01 21:10:35 +02:00
MacDue d2918b8204 LibWeb: Add (and use) CSS property to SVGAnimatedLength helper
No behaviour change.
2024-04-01 21:10:35 +02:00
MacDue 6d72f40d8d LibWeb: Stub out SVGAnimatedTransformList 2024-04-01 21:10:35 +02:00
MacDue 3bab4fbae9 LibWeb: Stub out SVGTransformList 2024-04-01 21:10:35 +02:00
MacDue a6a40a5bc6 LibWeb: Stub out SVGTransform 2024-04-01 21:10:35 +02:00
Nico Weber ce11a34fc6 Tests/LibGfx: Add a jbig2 test for transposed text segments
See the PR adding this test for local changes to `jbig2`.
I used the shell script mentioned in #23659, except I added the line
`-txt -Param -Transposed 1` at the very end of the .ini file.

As with all the symbol test cases, after running

    Meta/jbig2_to_pdf.py -o foo.pdf foo.jb2 399 400

the file opens up ok in Chrome and Firefox (but not Safari), so
maybe it's not completely broken.
2024-04-01 14:41:17 +02:00
Nico Weber b04569c1da LibGfx/JBIG2: Implement support for transposed text regions
Only the coordinates get transposed -- the bitmaps apparently don't.
And all the prose amounts to "if the transposed bit is set, swap
instance s and t coordinates before painting", as far as I can tell.

Makes pages 3/4 and 7/8 in 0001346.pdf render. (But here the feature
isn't used to render transposed text -- it just has stripes that keep s
roughy constant, which would normally produce vertical runs but here
produces regular horizontal runs. It's not clear to me why this feature
is used for these pages!)
2024-04-01 14:41:17 +02:00
Nico Weber ca6ebedf58 LibGfx/JBIG2: Simplify non-transposed text region coordinate math
If the origin is on the right, we need to subtract width - 1 from s,
if it's on top bottom, we need to subtract height - 1 from t.

No behavior change.
2024-04-01 14:41:17 +02:00
Shannon Booth 851114e462 LibWeb/Tests: Add a basic set of tests for document.all 2024-04-01 14:41:00 +02:00
Shannon Booth 249ee0a30e LbiWeb: Return an HTMLAllCollection from document.all 2024-04-01 14:41:00 +02:00
Shannon Booth 1f59e21829 LibWeb: Implement HTMLAllCollection
This collection has some pretty strange behaviour, particularly with the
IsHTMLDDA slot which is defined in the javascript spec specifically for
this object.

This commit implements pretty much all of this interface, besides from
the custom [[Call]].

There is also no caching over this collection. Since it is a live
collection over the entire document, the performance is never going to
be great, and I am not convinced any speedup for this legacy interface
is worth a massive cache.
2024-04-01 14:41:00 +02:00
Shannon Booth 897f55ca8a LibWeb: Use NonnullGCPtr for HTMLCollection::collect_matching_elements
The pointers here can never be null, so lets engrain that into the type
for clarity.
2024-04-01 14:41:00 +02:00
Shannon Booth e590e92399 LibWeb: Add HTMLCollection as a platform object
It is returned by the IDL of HTMLAllCollection.
2024-04-01 14:41:00 +02:00
Shannon Booth 713d8dc0f8 LibJS: Add support for constructing a PropertyKey from a FlyString 2024-04-01 14:41:00 +02:00
Shannon Booth 8fa0730b84 LibWeb: Remove resolved FIXME about caching in HTMLCollection 2024-04-01 14:41:00 +02:00