Commit graph

5926 commits

Author SHA1 Message Date
Sam Atkins
315ffb91af LibWeb/CSS: Dump more information about CSSImportRules
Specifically, we now dump the conditions, and the imported style sheet -
these sheets were previously skipped entirely when dumping everything
out.
2025-12-04 16:24:04 +00:00
Sam Atkins
2a716eaf48 LibWeb: Make dump_sheet() indentable
Not all style sheets are top-level, so this will help make that
hierarchy clearer.
2025-12-04 16:24:04 +00:00
Sam Atkins
5343c9bd2e LibWeb/CSS: Dump out media queries in more detail
Instead of just serializing them, dump out the query condition as a
tree, taking advantage of the existing dump code for
BooleanExpressions.
2025-12-04 16:24:04 +00:00
Sam Atkins
1db13c52be LibWeb/CSS: Make Supports responsible for dumping itself entirely
This will reduce the boilerplate for other things that want to dump a
Supports, such as `@import`.
2025-12-04 16:24:04 +00:00
Sam Atkins
180cd4b799 LibWeb: Move CSSRule dumping code into CSSRule classes
Having the dumping code in a separate Dump.cpp meant that it was often
overlooked when the rules gained new features, and also limits dumping
to publicly-accessible information.
2025-12-04 16:24:04 +00:00
Sam Atkins
285892b5dd LibWeb: Expose dump_indent() function
Preparation for moving some dump code out of Dump.cpp. Also switch to
using append_repeated() instead of a looped append().
2025-12-04 16:24:04 +00:00
Timothy Flynn
674075f79e Everywhere: Remove LibCore/System.h includes from header files
This reduces the number of compilation jobs when System.h changes from
about 750 to 60. (There are still a large number of linker jobs.)
2025-12-04 15:40:46 +00:00
Sam Atkins
58b32814e0 LibWeb/HTML: Bring HTMLDialogElement up to spec
I missed when these changes actually happened, but the big differences
here are that a few steps got extracted into their own algorithms; and
the dialog now only does things when it's attached to a fully-active
document, instead of immediately.

I've imported a WPT test that exercises this by calling show() on an
unattached dialog.
2025-12-04 14:47:16 +00:00
Sam Atkins
a1fbcfb4c6 LibWeb/HTML: Implement CloseWatcher::getEnabledState closer to spec
We previously had this implemented in an ad-hoc way, where we used a
boolean on the CloseWatcher instead of a proper function with steps.
This worked at the time, but causes problems with the current version
of the spec, so let's just implement it properly.

This commit consciously does not update the spec text, because it's
diverted quite a lot. That will happen in a subsequent commit.
2025-12-04 14:47:16 +00:00
Sam Atkins
c541d14232 LibWeb/HTML: Add spec asserts to HTMLDialogElement::set_close_watcher()
Not sure when this change happened. This does include the fixed assert
from here though:
71e70e9006
2025-12-04 14:47:16 +00:00
Sam Atkins
6b46bed970 LibWeb/CSS: Update syntax comments for a couple of properties
Corresponds to:
3a2ac8d75c
fdc08f79a2

No code changes.
2025-12-04 08:37:39 -05:00
Sam Atkins
ed7a86b8cc LibWeb/DOM: Set the pseudo_element on created Animation/TransitionEvents
Also import a couple of WPT tests that now pass.
2025-12-03 13:29:51 +01:00
Sam Atkins
d717dd64b3 LibWeb: Make Animation's owning element an AbstractElement
From the spec:
> The owning element of a transition refers to the element or
  pseudo-element to which the transition-property property was applied
  that generated the animation.

https://drafts.csswg.org/css-transitions-2/#owning-element

Previously we only stored the element.
2025-12-03 13:29:51 +01:00
Sam Atkins
b61c857c64 LibWeb/CSS: Use AbstractElement animation helpers 2025-12-03 13:29:51 +01:00
Sam Atkins
dacc64cb8b LibWeb/DOM: Add animation helpers to AbstractElement 2025-12-03 13:29:51 +01:00
Sam Atkins
ba86b81c1a LibWeb/Animations: Make KeyframeEffect work with AbstractElements 2025-12-03 13:29:51 +01:00
Timothy Flynn
96806a3f90 LibWeb: Update cursor and tooltip UI state regardless of event handlers
If a script on the page cancels a mousemove event, we would return early
and neglect to update the cursor. This is seen regularly on "Diablo Web"
where they set the cursor to "none" on the main canvas, and also cancel
mousemove events.
2025-12-03 12:23:56 +01:00
Callum Law
e935dfbf5b LibWeb: Simplify compute_style_value_list 2025-12-02 12:47:10 +00:00
Callum Law
38efc39e17 LibWeb: Simplify assemble_coordinated_value_list
We know that all coordinated value list longhands are parsed as
`StyleValueList`s
2025-12-02 12:47:10 +00:00
Callum Law
74e6c5074f LibWeb: Store list-valued properties as lists in StylePropertyMap::set()
This matches the behavior of parsed values
2025-12-02 12:47:10 +00:00
Callum Law
953f9775a4 LibWeb: Mark animation-* properties as list-valued 2025-12-02 12:47:10 +00:00
Callum Law
758432c1cd LibWeb: Don't mark mask-type as list-valued
This is distinct from the other `mask-*` properties and is not a
longhand of `mask`, and is thus not a coordinating value list longhand
2025-12-02 12:14:27 +00:00
Callum Law
4034ce995a LibWeb: Account for transition-{delay,duration} always being a list
This fixes the optimization implemented in 46acdbd that was no longer
working after e937f5d
2025-12-02 11:45:46 +00:00
Callum Law
d7d4f90a2c LibWeb: Update style attribute when calling attributeStyleMap.set()
We also now invalidate the element
2025-12-02 11:37:11 +00:00
Timothy Flynn
adcf5462af LibWeb+WebContent: Rename the http-cache flag to http-memory-cache
Rather than having http-cache and http-disk-cache, let's rename the
former to http-memory-cache to be extra clear what we are talking about.
2025-12-02 12:19:42 +01:00
Sam Atkins
b376ab4e81 LibWeb/CSS: Serialize Supports::Declaration as original representation
Fixes some WPT tests that expected `supports(foo:bar)` to serialize as
`supports(foo:bar)`, instead of `supports(foo: bar)` with a space
between.

Reading the original_full_text directly also lets us delete
Declaration::to_string(), which was only used here.
2025-12-02 09:49:23 +00:00
Sam Atkins
db910c68a3 LibWeb/CSS: Add option to retain a Declaration's full source text
This will be needed by Supports, which expects declarations to serialize
verbatim.
2025-12-02 09:49:23 +00:00
Sam Atkins
a8d0be4382 LibWeb/CSS: Expose consumed tokens from TokenStream
In some situations we want to examine a sequence of tokens that have
been already consumed from a TokenStream. These methods let us do so:
- current_index() provides the current internal token index
- tokens_since() provides a span from the given index to the current one
2025-12-02 09:49:23 +00:00
Sam Atkins
8d5eac28a4 LibWeb/CSS: Rename Declaration.original_text -> original_value_text
Otherwise this will conflict with a different original text that I'm
about to add.
2025-12-02 09:49:23 +00:00
Sam Atkins
faba11f33c LibWeb/CSS: Pull out Supports::Declaration parsing
Avoid repeating this in two places.
2025-12-02 09:49:23 +00:00
Sam Atkins
4ed1c56267 LibWeb/CSS: Parse all supports features in @import supports()
The previous implementation assumed that the contents of `supports()`
was either a raw declaration, or a block containing some number of them.
This meant we wouldn't parse things like `supports(not (a:b))` or
`supports(selector(*))`.

`parse_a_supports()` actually does what we want in every case except for
raw declarations (`supports(a: b)`), so let's always call it first, and
then fall back to parsing a single declaration.
2025-12-02 09:49:23 +00:00
Sam Atkins
d9abfdf2ab LibWeb/CSS: Allow non-StyleValueLists in animation properties
Reverts 51f694c6af and
b52beb5105.

The animation-* properties are in an awkward place currently, where
they *should* be lists, and a lot of our code acts as if they are, but
actually we parse them as single values. The above commits caused a few
WPT tests to crash - see link below. I've imported one of them to
prevent future regressions.
https://wpt.fyi/results/css/css-typed-om/the-stylepropertymap/properties?diff&filter=ADC&run_id=6293362870321152&run_id=5123272984494080
2025-12-02 09:48:32 +00:00
Andreas Kling
4d27e9aa5e LibWeb: Make setInterval() reuse the timer to reduce drift
Instead of creating a new single-shot timer every time a setInterval
timer reschedules itself, we now use a repeating Core::Timer internally.

This dramatically reduces timer drift, since the next timeout is now
based on when the timer fired, rather than when the timer callback
completed (which could take arbitrarily long since we run JS).

It's not perfect, but it's a huge improvement and allows us to play
DiabloWeb at full framerate (20 fps).
2025-12-01 19:58:47 +01:00
InvalidUsernameException
fb9286eccb LibWeb: Apply clip frames even when transformation is identity
Clip frames for overflow were applied based on whether the box in
question had a non-identity matrix transformation associated with it.
That however is not correct, since specifying a no-op transform like
`scale(1)` still needs to apply clip overflow rectangles. So instead we
need to check whether the element associated with the box in question
has any CSS transforms.

This appears to have been a regression from
9bbc1cd618 and effectively reverts that
commit, but keeps its effect by unifying on the check for CSS transforms
instead.

This fixes some background boxes being rendered for the invisible items
of the carousels on https://computerbase.de/.
2025-12-01 17:46:44 +01:00
InvalidUsernameException
a08c175da2 LibWeb: Display clip rectangles when dumping display list 2025-12-01 17:46:44 +01:00
Sam Atkins
e5ea4f9bdf LibWeb/HTML: Add source field to ToggleEventInit
Corresponds to:
95131eec8f

As we now have a field in that dictionary, I removed the separate
`source` parameter from ToggleEvent::create(). Also updated the
relevant test.
2025-12-01 14:58:20 +00:00
Andreas Kling
1c45930767 LibWeb+LibWebView+LibRequests: Reduce dependency on LibIPC includes
Let's try to include the IPC encoder/decoder stuff in fewer headers
to make rebuilds more pleasant when editing these files.
2025-12-01 15:12:52 +01:00
Sam Atkins
62d7011f45 LibWeb/HTML: Update worker construction spec steps
This is largely editorial. One behaviour change is that events are now
sent from a global task on the DOMManipulation task source.

Somewhat awkwardly, the spec refers to `this` before the Worker exists.
As it's for getting the relevant global object / settings object, I've
had to work around that.

Corresponds to:
917c2f6a73
2025-12-01 15:02:27 +01:00
Sam Atkins
cdc81e8921 LibWeb/CSS: Add -moz-appearance property alias 2025-12-01 11:10:13 +00:00
Sam Atkins
d5d1b5351e LibWeb: Hide stepper buttons on appearance: textfield number inputs
The spec says:

> For the purpose of this specification, they all have the same effect
  as auto. However, the host language may also take these values into
  account when defining the native appearance of the element.

https://drafts.csswg.org/css-ui/#typedef-appearance-compat-special

Firefox at least hides the stepper buttons when this is set.
2025-12-01 11:10:13 +00:00
Sam Atkins
c3d23a2487 LibWeb/HTML: Clone integrity policy when cloning policy container
Corresponds to:
3c6cb6c0c5
2025-12-01 11:07:16 +00:00
Sam Atkins
b3d9ffdfce LibWeb/HTML: Update ImageRequest::prepare_for_presentation spec steps
Corresponds to:
ad281924e2

We don't implement this at all yet, it's still just FIXMEs.
2025-12-01 11:07:16 +00:00
Sam Atkins
573d5362f4 LibWeb/HTML: Add FIXMEs to honor WebDriver BiDi emulated language
Corresponds to:
547f8044b0

We currently don't follow the spec for these language getters, and the
BiDi changes are still ongoing, so it seems better to leave a FIXME for
them rather than try to make any changes right now.
2025-12-01 11:07:16 +00:00
Sam Atkins
c8990697d1 LibWeb: Add FIXME for moving "stop parsing" step for error documents
Corresponds to:
48cd393d1e

Actually doing so was causing crashes and other issues, so I'll leave it
as a FIXME for later.
2025-12-01 11:07:16 +00:00
Sam Atkins
2feff2b519 LibWeb/HTML: Capitalize autocorrection and autocapitalization states
Only comment changes.

Corresponds to:
ea29ce1963
2025-12-01 11:07:16 +00:00
Sam Atkins
c0b8f47a76 LibWeb/HTML: Move connectedness check for script post_connection()
Corresponds to:
905384d140

Also import the test added along with that change.
2025-12-01 11:07:16 +00:00
Sam Atkins
5179c57ca0 LibWeb/DOM: Use Document::make_unsalvageable()
Noticed because of this spec change:
e2974bd884

I then went and updated the other places it should be used.
2025-12-01 11:07:16 +00:00
Sam Atkins
04f1dbce2e LibWeb/HTML: Update BroadcastChannel::is_eligible_for_messaging() spec
Corresponds to part of:
e9ccb97eb1

The majority of that spec change is in algorithms that we don't yet
implement. So this is just a small text change and an update to use
as_if() instead of static_cast().
2025-12-01 11:07:16 +00:00
Sam Atkins
ed5169af8d LibWeb/HTML: Make command events not composed
Also re-import the affected button-event-dispatch test.

Corresponds to:
787316d519
2025-12-01 11:07:16 +00:00
Sam Atkins
d2b261d28e LibWeb/DOM: Update references to ancestor revealing algorithms
No behaviour changes, because we don't yet implement the actual
algorithm.

Corresponds to:
55baf054d2
2025-12-01 11:07:16 +00:00