Commit graph

71639 commits

Author SHA1 Message Date
Sam Atkins
916e24de30 LibWeb/CSS: Take AbstractElement in resolve_unresolved_properties() 2025-09-11 18:45:35 +02:00
Sam Atkins
83aee2c7fc LibWeb: Take AbstractElement in resolve_unresolved_style_value() 2025-09-11 18:45:35 +02:00
Sam Atkins
40ab71e41e LibWeb/DOM: Expose AbstractElement outside of LibWeb
This ends up used by the WebContent service's ConnectionFromClient in a
later commit.
2025-09-11 18:45:35 +02:00
Sam Atkins
583d74e3a9 LibWeb/DOM: Reduce AbstractElement.h's includes
This doesn't need all of Selector.h and its various includes, it just
needs the PseudoElement enum.

StringStyleValue.h was transitively including ComponentValue.h through
this, so it now includes it directly.
2025-09-11 18:45:35 +02:00
Sam Atkins
5534ed6715 LibWeb/CSS: Use generated code to convert between dimension units 2025-09-11 17:06:44 +01:00
Sam Atkins
82f5be871a LibWeb: Generate the "Numeric Factory" OM methods on the CSS namespace
Generating boilerplate is nice! This also has the bonus that we're more
correct: I included all the units listed in the spec before,
(see https://drafts.css-houdini.org/css-typed-om-1/#numeric-factory )
but we're supposed to exactly include ones for the units we support:

> If an implementation supports additional CSS units that do not have a
  corresponding method in the above list, but that do correspond to one
  of the existing CSSNumericType values, it must additionally support
  such a method, named after the unit in its defined canonical casing,
  using the generic behavior defined above.

> If an implementation does not support a given unit, it must not
  implement its corresponding method from the list above.

Now, our factory functions will exactly match the units we support.

The changed test result is partly the order being different, and partly
that the container-query units are no longer included as we don't
actually support them.
2025-09-11 17:06:44 +01:00
Sam Atkins
66710f0065 LibIDL: Support extended attributes on namespace members
Specifically, this is so that ImplementedAs can be used on them.
2025-09-11 17:06:44 +01:00
Sam Atkins
6e3cd7dd06 LibIDL: Support partial namespaces 2025-09-11 17:06:44 +01:00
Sam Atkins
b3c099bd68 LibWeb/CSS: Use dimension_for_unit() when we don't need the exact unit
A small code reduction, and means that NumericType will catch if new
dimensions are added, and attr() will just work in that case.
2025-09-11 17:06:44 +01:00
Sam Atkins
b3e32445d3 LibWeb/CSS: Use generated FooUnit types instead of Foo::Type
I've also renamed the `m_type` and `type()` members to be `m_unit` and
`unit()` instead, to match what they actually are.
2025-09-11 17:06:44 +01:00
Sam Atkins
bda4f8cbe8 LibWeb/CSS: Use raw_value() to bounds-check all dimension types
This avoids constructing temporary objects to compare against, and
reduces the amount of code. Also, a few of these were actually wrong!
2025-09-11 17:06:44 +01:00
Sam Atkins
cbc019350b LibWeb/CSS: Generate code for CSS dimension units 2025-09-11 17:06:44 +01:00
Veeti Paananen
5e23df7d8a LibWeb: Fix case insensitivity for HTMLElement "hidden" attribute 2025-09-11 15:20:18 +02:00
Tim Ledbetter
bf8b8c260a LibWeb: Simplify interpolation of mixed percentage-dimension values
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-09-11 06:10:23 +01:00
Callum Law
a46453f234 LibWeb: Map logical alias transition properties to physical counterparts
Transitions apply after logical properties are mapped to their physical
counterparts so we should apply this mapping to `transition` properties

Gains us 20 WPT tests.
2025-09-11 06:08:07 +01:00
Callum Law
62176391dd LibWeb: Include z-index in transition: all
Gains us 37 WPT tests.
2025-09-11 06:08:07 +01:00
Callum Law
0209e502cf LibWeb: Use expanded longhands when computing transition properties
Using longhands rather than expanded longhands meant for instance that
we wouldn't transition `border-top-width` if we had `border` as the
transition property.
2025-09-11 06:08:07 +01:00
Callum Law
af431d800b Tests: Import/create tests related to transition property handling
Done in a distinct commit to see progress over following commits
2025-09-11 06:08:07 +01:00
Callum Law
6453c2cf71 LibWeb: Use correct animation type for fill property
This was incorrectly marked as `none` when it should be
`by-computed-value`.

Gains us 103 WPT tests.
2025-09-11 05:31:27 +01:00
Psychpsyo
c04f83f5f4 LibWeb: Add view transition related user relevancy
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-09-10 17:37:41 +01:00
Tim Ledbetter
9c062d9d4e LibWeb: Improve interpolation of mixed percentage-dimension values
If we are interpolating between a dimension and a percentage value and
the dimension component is 0, we now return a percentage value rather
than a `calc()` value.
2025-09-10 17:00:20 +01:00
Pratyush Nair
01be928a16 LibWeb: Avoid dereferencing a null pointer to document 2025-09-10 16:57:36 +01:00
Feng Yu
66d18170c6 LibWeb: Add activeElement attribute in ShadowRoot 2025-09-10 16:52:39 +01:00
Psychpsyo
0989c3cdaf LibWeb: Keep view transition pseudo styles in sync with new element
This makes it so that view-transition pseudo-element styles are
updated before returning them from window.getComputedStyle(). This
is necessary because they could be outdated, in case JS has
modified the styles of the elements they are trying to stay in sync
with since last frame.

The corresponding WPT test has not been imported, since it still
fails for unrelated reasons.
2025-09-10 16:39:43 +01:00
Timothy Flynn
98c7a011d4 test-web: Wait for crash tests with a test-wait attribute
Similar to ref tests, we don't want to incorrectly pass a test that did
not remove this attribute.
2025-09-10 16:38:24 +01:00
Timothy Flynn
467c58eaf3 Tests/LibWeb: Disable css-view-transitions/first-line-reparent-crash 2025-09-10 16:38:24 +01:00
Tim Ledbetter
bd7348949a LibWeb: Make word-spacing and letter-spacing default value compute to 0 2025-09-10 16:12:29 +01:00
Tim Ledbetter
112a45bdf2 LibWeb: Return resolved value of normal if letter-spacing value is 0 2025-09-10 16:12:29 +01:00
Tim Ledbetter
831088939a LibWeb: Return word-spacing computed value as CSSPixels 2025-09-10 16:12:29 +01:00
Tim Ledbetter
099247d502 LibWeb: Return letter-spacing computed value as CSSPixels 2025-09-10 16:12:29 +01:00
Callum Law
c677b64773 LibWeb: Update animation type of compositing properties
This updates `background-blend-mode`, `mix-blend-mode`, and `isolation`
to be animation type `discrete` rather than `none`. This reflects
169b0e1 but isn't reflected
on the published spec as the published spec is out of date - see
https://github.com/w3c/fxtf-drafts/issues/547

Gains us 26 WPT tests.
2025-09-10 15:02:20 +01:00
Callum Law
b6ec5bfb7e LibWeb: Resolve border-image-width percentages as lengths
All remaining failing subtests in border-image-width-interpolation.html
are related to incorrect handling of mixed dimension and percentage
interpolation and are fixed by #6142.
2025-09-10 14:58:59 +01:00
Psychpsyo
fa3c45d0b4 LibWeb: Implement optional function IDL arguments
This allows us to run some more view transitions WPT tests, one of
which has been imported.
2025-09-10 09:49:14 -04:00
Tim Ledbetter
4559d5f6f6 LibWeb: Always round text-decoration-thickness value up to 1px 2025-09-10 15:36:12 +02:00
Callum Law
405c5ffa60 LibWeb: Propagate border-box dimensions when getting max content width
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This means that we now calculate the inner width correctly for `display:
inline-block` nodes when we have `box-sizing: border-box` and
`min-width`, as we would previously assume these dimensions were all `0`
2025-09-10 11:41:30 +02:00
Tim Ledbetter
551c7f966b LibWeb: Use correct root element when resolving paint properties
Previously, the first `HTMLHtmlELement` in the given document would
always be  used when determining whether to propagate background
properties to the body element. This meant the wrong root element was
used for SVG `foreignObject` elements, which could lead to a crash.
2025-09-10 11:35:02 +02:00
me-it-is
62fe795c9b LibWeb: Throw range error when initial is greater than maximum
Some checks are pending
Push notes / build (push) Waiting to run
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
When constructing WebAssembly.Memory if initial is greater than maximum
a range error will be thrown.

Fixes "Initial value exceeds maximum" in
https://wpt.fyi/results/wasm/jsapi/memory/constructor.any.worker.html?product=ladybird
2025-09-10 05:23:07 +02:00
Luke Wilde
6d3fd2b543 LibWeb: Implement cookie fetching for Workers
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Allows formulas to update on Google Sheets, which uses a Worker to
update them and makes cookie authenticated requests, which was failing
before this commit.

This has the limitation that it has to proxy through the WebContent
process, but that's how the current infrastructure is, which is outside
the scope of this commit.
2025-09-09 15:28:38 +02:00
Luke Wilde
05438e70f1 LibWeb: Receive cookies through principal_host_defined_page
Previously we depended on an associated document on the ESO to get to
the page, but Workers do not have documents. However, we can simply get
to the page with `principal_host_defined_page`, removing the issue.
2025-09-09 15:28:38 +02:00
Psychpsyo
905e749575 LibWeb: Use correct style rule index in view transitions
This used to crash a lot of attempted view transitions, now it
doesn't anymore.
2025-09-09 12:50:09 +01:00
dependabot[bot]
5d9e51d675 CI: Bump actions/github-script from 7 to 8
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-09 12:32:16 +02:00
Callum Law
1c2c77b441 LibWeb: Remove unnecessary handling of StyleValueList border longhands
This is no longer needed as we parse border longhands directly to
ShorthandStyleValues
2025-09-09 11:45:47 +02:00
Callum Law
a7e5ded188 LibWeb: Add generic logic for parsing "positional-value-list-shorthands"
Continues the work started in #5386 to simplify handling of positional
value list shorthand properties.

Previously we would parse these as `StyleValueList`s and then rely on
`StyleComputer::for_each_property_expanding_shorthands` to expand them
into longhands.

This required a bit of work to handle `ShorthandStyleValue`s for the
`@page` `margin` descriptor.
2025-09-09 11:45:47 +02:00
Callum Law
b1e77b3522 LibWeb: Parse longhands of border as ShorthandStyleValues
Previously we would instead parse these as single values and rely on
ad-hoc functionality in `for_each_property_expanding_shorthands` to
expand them to longhands.

This gets us a step closer to removing that ad-hoc functionality.
2025-09-09 11:45:47 +02:00
Psychpsyo
17e5289524 LibWeb: Suppress rendering due to view transitions
This also fixes a bug in the view transitions code that was
required to get the imported test to pass. The code for setting
the initial containing block size just did not set the right thing,
since doing so would trigger an error later on.

That later error resulted from walking up the tree, without
considering that the document element has a parent that is not
itself an element. (and then doing element things to it)
2025-09-09 10:25:17 +02:00
Aliaksandr Kalenik
18cf540bfb LibWeb: Fix crashing in LengthOrAutoOrCalculated::without_auto()
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
...when `LengthOrAutoOrCalculated` holds calculated value. We were
incorrectly assuming that if contained value is not auto, then it must
be a length.

Fixes crashing on https://hollowknightsilksong.com/
2025-09-08 19:35:31 +01:00
Zaggy1024
cae14c763d LibMedia: Convert FFmpeg time units to AK::Duration with integer math
The existing conversion was rounding to the nearest millisecond, which
is much less precision than most videos will want. Instead, use only
integer math to directly convert the presentation time to seconds and
nanoseconds for our AK::Duration to represent accurately.
2025-09-08 13:29:04 -05:00
Aliaksandr Kalenik
98c00f4b45 Tests: Import resize-observer/observe.html WPT test 2025-09-08 18:39:54 +02:00
Aliaksandr Kalenik
ad15edf2ff LibWeb: Pass ResizeObserver instance as a second argument to callback 2025-09-08 18:39:54 +02:00
Aliaksandr Kalenik
1cc9fb6135 LibWeb: Use ResizeObserver instance as this in callback function 2025-09-08 18:39:54 +02:00