Commit Graph

60189 Commits

Author SHA1 Message Date
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
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