Commit graph

68644 commits

Author SHA1 Message Date
Andreas Kling
267b84ebb6 LibWeb: Skip flex/grid layout when doing intrinsic sizing for ancestor
We don't need to perform inside layout of flex and grid formatting
contexts when one of their ancestors is undergoing intrinsic size
measurement. This is because the parent formatting context will have
already sized the flex/grid container, and thus inside layout is
completely redundant work.
2025-03-08 03:37:38 +01:00
Andreas Kling
6444fdf5ae LibWeb: Remove unnecessary full layout tree drop in SVGUseElement
This full invalidation was just papering over earlier bugs in the
partial layout tree update code. The DOM mutations that happen here
should be enough to drive the necessary invalidation now.

Note that this is covered by a regression test added with the
invalidation.
2025-03-08 03:37:38 +01:00
Andreas Kling
2abbf99a95 LibWeb: Add opt-in tracing of set_needs_layout() calls with reason 2025-03-08 03:37:38 +01:00
Andreas Kling
415079bc11 LibWeb: Add opt-in tracing of invalidate_layout_tree() calls with reason 2025-03-08 03:37:38 +01:00
Andreas Kling
c333042e63 LibWeb: Add opt-in tracing of update_layout() calls with reason 2025-03-08 03:37:38 +01:00
Timothy Flynn
c4b1d2382a LibDevTools+LibWebView: Implement requests to clone DOM nodes 2025-03-08 01:25:55 +01:00
Timothy Flynn
ffd48e1d45 LibDevTools+LibWebView: Implement requests to create DOM nodes
This requires a couple of amendments to the DOM node serialization.
Namely, we need to include the HTML namespace, otherwise the context
menu item to create a new node is disabled.
2025-03-08 01:25:55 +01:00
Timothy Flynn
29122786b9 LibDevTools+LibWebView: Implement requests to delete DOM nodes 2025-03-08 01:25:55 +01:00
Timothy Flynn
bdb31b029a LibDevTools+LibWebView: Implement requests to edit DOM node tags 2025-03-08 01:25:55 +01:00
Timothy Flynn
17fb21169f LibDevTools+LibWebView: Implement requests to edit DOM node attributes 2025-03-08 01:25:55 +01:00
Timothy Flynn
57e0a3f8b5 LibDevTools+LibWebView: Implement requests to edit DOM node text 2025-03-08 01:25:55 +01:00
Timothy Flynn
8bcc3d3797 LibDevTools+LibWebView: Inform the DevTools client about DOM mutations 2025-03-08 01:25:55 +01:00
Timothy Flynn
2c4b420acc LibWeb+LibWebView+WebContent: Inform the UI about DOM mutations
This will allow our DevTools server to inform the Firefox DevTools
client about DOM mutations.
2025-03-08 01:25:55 +01:00
Timothy Flynn
bf723aad98 LibWeb: Correctly set mutation record attribute namespace values
Here, we were setting the attribute_name string to the namespace string.
2025-03-08 01:25:55 +01:00
Timothy Flynn
3847d64542 LibWeb: Slightly delay queueing a character data mutation event
For DevTools, we will want to forward mutation events to the UI in order
to inform the DevTools client about changed DOM nodes. The API for this
requires the new values associated with the events; for example, for
character data events, this will be the node's new text data.

This patch moves the queueing of the mutation record until after we have
the new character data stored. This is not observable.
2025-03-08 01:25:55 +01:00
Timothy Flynn
ddea67034f LibDevTools: Associate node actors with a DOM node identifier
This is a prepatory commit to be able to handle DOM mutations. Once a
node actor is created, the DOM node it is created for must continue to
be associated with the same actor even after DOM mutations. This change
stores an identifier on the node actor, and only creates new actors when
an actor for a node does not exist.
2025-03-08 01:25:55 +01:00
Timothy Flynn
ee88edc750 LibDevTools: Add a helper to extract a DOM node JSON object more easily
The pattern of:

    auto tab = get_tab();
    auto walker = get_walker();

    if (tab && walker) {
        if (auto node = walker->dom_node(node_id)) {
            delegate().do_something(tab->description(), node);
        }
    }

Is getting a bit unergonomic and is often repeated. This patch just adds
a helper to WalkerActor to do most of this work, so now we have:

    if (auto node = WalkerActor::dom_node_for(get_walker(), node_id)) {
        delegate().do_something(node->tab->description(), node);
    }
2025-03-08 01:25:55 +01:00
Totto16
1fc5744aa4 Meta: Make gn linter actually fail
Without the `--dry-run` flag, the gn linter just formats the files in
place and reports no failure
2025-03-07 09:44:42 +01:00
Totto16
4c24e0f63d Meta: Format gn files 2025-03-07 09:44:42 +01:00
sideshowbarker
cf1425d09e LibWeb: Implement “suffering from overflow/underflow” for inputs
This change implements the requirements for the “suffering from an
overflow” and “suffering from an underflow” algorithms for
HTMLInputElement constraint validation.
2025-03-07 08:32:18 +00:00
Feng Yu
ad9f70dff9 LibWeb: Clean up unused module script fetching algorithms
This patch removes those unused 2 algorithms:
1. `fetch_internal_module_script_graph`
2. `fetch_descendants_of_a_module_script`

Those 2 algorithms were removed in spec and are not used in our
codebase.
2025-03-07 02:25:31 +01:00
Aliaksandr Kalenik
9b26f7eb0f LibWeb: Use partial layout tree rebuild in element's style invalidation
This allows us to avoid a full layout tree rebuild after change of
"display" property, which happens frequently in practice. It also
allows us to avoid a full rebuild after DOM node insertion, since
previously, computing styles for newly inserted nodes would trigger a
complete layout tree rebuild.
2025-03-06 23:48:34 +01:00
Andrew Kaster
00c9031304 RequestServer: Remove dead code from ConnectionFromClient 2025-03-06 14:43:02 -05:00
Luke Wilde
6d1f78198d LibWeb: Implement Resource Timing 2025-03-06 09:00:53 -07:00
Luke Wilde
23c84e62a5 LibWeb/Fetch: Update timing info with the timings received from RS 2025-03-06 09:00:53 -07:00
Luke Wilde
618697ef13 LibWeb: Make reference to global in report timing steps non-const
Marking a resource timing entry requires calling non-const methods on
the global object to append to the performance buffer.
2025-03-06 09:00:53 -07:00
Luke Wilde
67cfb64d07 LibWeb: Separate adding to performance buffers and queueing to observers
The User Timing, Resource Timing and Navigation Timing specifications
have not been updated to account for the queue method to also append to
the underlying performance buffer and it's method of checking it's
full.

This separates the functionality into a different function, with a flag
to indicate whether to use the custom full buffer logic or not.
2025-03-06 09:00:53 -07:00
Luke Wilde
209b10e53e RequestServer: Retrieve timing info from curl and pipe it to LibWeb
This timing info will be used to create a PerformanceResourceTiming
entry.
2025-03-06 09:00:53 -07:00
Shannon Booth
21d26c5c3e LibWeb/HTML: Implement valueAsNumber for 'time' input type 2025-03-06 09:01:18 -05:00
Shannon Booth
4bd4d777eb LibWeb/HTML: Use a helper for converting 'time' value to string
This will make it trivial to implement valueAsNumber for 'time' input
type.
2025-03-06 09:01:18 -05:00
Shannon Booth
f344eca39d LibWeb/HTML: Reuse number to date string conversion helper
This shares the code to convert to a date string for this algorithm
and the valueAsNumber implementation.
2025-03-06 09:01:18 -05:00
sideshowbarker
13f9670f20 LibWeb: Fix “step base” computation for HTMLInputElement
This change fixes a bug in our implementation of the “step base”
algorithm at https://html.spec.whatwg.org/#concept-input-min-zero. We
were using the “value” IDL/DOM attribute in a particular step, where the
spec instead actually requires using the “value” content attribute.
2025-03-06 09:00:22 -05:00
Luke Wilde
9ca25eed7f LibWeb/WebGL2: Implement EXT_color_buffer_float extension
This makes the Point Of Sale model on https://www.shopify.com/ have
colour instead of being completely black.
2025-03-06 12:59:28 +01:00
Gingeh
31853c13d3 LibWeb: Implement css gradient-interpolation-method 2025-03-06 11:33:12 +00:00
Andreas Kling
02a642b87b LibWeb: Prevent infinitely growing font size due to rem units in root
A font-size with rem units need to resolve against the default font
metrics for the root element, otherwise every time we compute style,
the reference value for rem units grows.

This fixes an issue where text on some web pages would grow every time
there was a relayout. This was very noticeable on https://proton.me/

Fixes #339
2025-03-05 22:46:06 +01:00
Aliaksandr Kalenik
dd78d5d50e LibWeb: Don't layout grid descendants in intrinsic layout mode
We already have a check to skip the layout of descendants if the
available size is intrinsic, but this is not sufficient in nested
intrinsic layout cases, where the available size might be definite even
though we are in intrinsic layout mode.
2025-03-05 21:40:59 +01:00
Aliaksandr Kalenik
b51c026f3d LibWeb: Don't layout flex descendants in intrinsic layout mode
We already have a check to skip the layout of descendants if the
available size is intrinsic, but this is not sufficient in nested
intrinsic layout cases, where the available size might be definite even
though we are in intrinsic layout mode.
2025-03-05 21:40:59 +01:00
Timothy Flynn
292b566b9f Tests: Disable flaky css-mask-longhand test 2025-03-05 14:45:56 -05:00
Aliaksandr Kalenik
16b14273d1 Revert "LibWeb: Do not deform bitmaps partially outside the img-box"
This change broken image rendering.

This reverts commit e055927ead.
2025-03-05 19:44:49 +01:00
R-Goc
fe26c3145d AK: Add stacktrace support using the standard lib
This commit adds support for using the standard library implementation
of <stacktrace> if libbacktrace is not found. This can also be
explicitly enabled through ENABLE_STD_STACKTRACE for platforms that have
libbacktrace available.

Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
2025-03-05 10:25:12 -07:00
Lukas Scheller
ce93088a81 LibWeb: Respect margin boxes when center-aligning flex items 2025-03-05 18:07:10 +01:00
InvalidUsernameException
495b3169e0 Tests: Mark existing workarounds consistently 2025-03-05 16:32:47 +01:00
InvalidUsernameException
e055927ead LibWeb: Do not deform bitmaps partially outside the img-box
Instead of trying to manually determine which parts of a bitmap fall
within the box of the `<img>` element, just draw the whole bitmap and
let Skia clip the draw-area to the correct rectangle.

This fixes a bug where the entire bitmap was squashed into the rectangle
of the image box instead of being clipped.

With this change, image rendering is now correct enough to import some
of the WPT tests for object-fit and object-position. To get some good
coverage I have imported all tests for the `<img>` tag. I also wanted to
import a subset of the tests for the `<object>` tag, since those are
passing as well now. Unfortunately, they are flaky for unknown reasons.
2025-03-05 16:32:47 +01:00
aplefull
389a63d6bf LibRegex: Allow duplicate named capture groups in separate alternatives 2025-03-05 14:36:09 +01:00
sideshowbarker
7df9e00650 LibWeb: Implement HTMLInputElement type=email constraint validation
This change implements HTMLInputElement type=email constraint validation
in conformance with the current spec requirements (which happens to also
produce behavior that’s interoperable with other existing engines).
2025-03-05 13:20:08 +00:00
Tommy van der Vorst
056205aa76 LibWeb/CSS: Treat 'mask' as a longhand property
Before this change, an element masked with 'mask-image: url(...)' would
show the mask, but 'mask: url(...)' would not. On e.g. dialogic.nl it
would show white boxes instead of the actual images in the top
navigation bar. We still do not support many of the other mask
properties, but with this change at least the masks show up in both
cases.
2025-03-05 12:10:02 +00:00
Lucas CHOLLET
4bf197872b LibWeb/CSS: Remove an ad-hoc simplification step in calc() parsing 2025-03-05 12:05:45 +00:00
Lucas CHOLLET
715bf0de2c LibWeb/HTML: Implement ImageData initialization closer to spec 2025-03-05 11:35:27 +00:00
Shannon Booth
569ebeb6a4 LibWeb/URLPattern: Implement IDL interface for URLPattern test and exec
There is further work needed to complete the implementation of
URL::Pattern::Pattern, but this implements the remaining URLPattern
exec and test IDL interfaces, leaving all remaining work to LibURL.
2025-03-04 16:32:09 -05:00
Shannon Booth
10b32a8dd8 LibURL/Pattern: Stub out URL::Pattern::match
This will allow us to complete the IDL interface, which will leave
remaining work to implement the URL pattern specification within
LibURL.
2025-03-04 16:32:09 -05:00