Commit Graph

71854 Commits

Author SHA1 Message Date
Sam Atkins
0ff012d3f3 LibWeb/CSS: Replace resolve_time_deprecated() with resolve_time() 2025-09-24 16:33:53 +01:00
Sam Atkins
7428a8eb40 LibWeb/CSS: Replace resolve_resolution_deprecated() with undeprecated 2025-09-24 16:33:53 +01:00
Sam Atkins
7f237b3e62 LibWeb/CSS: Replace resolve_frequency_deprecated() with undeprecated 2025-09-24 16:33:53 +01:00
Sam Atkins
cd29111b36 LibWeb/CSS: Replace resolve_flex_deprecated() with resolve_flex() 2025-09-24 16:33:53 +01:00
Sam Atkins
375e32c523 LibWeb/CSS: Replace resolve_angle_deprecated() with resolve_angle()
Gets us some WPT passes. 🎉
2025-09-24 16:33:53 +01:00
Sam Atkins
525b5bf623 Tests: Update empty-editable-shows-cursor expectation file
Somehow this went out of sync between it running on CI and getting
merged.
2025-09-24 13:45:59 +01:00
zac
8c29b0a848 LibWeb/Tests: Add empty text chunk in empty editables
Otherwise the cursor won't get rendered in empty input fields.
2025-09-24 12:33:17 +01:00
zac
152711958e LibWeb: Add const where possible in InlineLevelIterator 2025-09-24 12:33:17 +01:00
zac
fca2d71b16 LibWeb: Set is_first_chunk to false as needed in InlineLevelIterator
`m_text_node_context->is_first_chunk` was always true because
`InlineLevelIterator::next_without_lookahead` never set it to false.
2025-09-24 12:33:17 +01:00
zac
191b026c9f LibWeb: Rename is_generated to is_generated_for_pseudo_element
While much longer, this better conveys the intent. Since this method
isn't used too often, I think the extra length is worth it.
2025-09-24 12:33:17 +01:00
zac
e96122a58c LibWeb: Remove redundant for_each_fragment method in PaintableBox 2025-09-24 12:33:17 +01:00
Sam Atkins
b24b00fb7d LibWeb/CSS: Reify CSSTransformValues
We have a slightly odd setup here. TransformationStyleValue reifies as a
single CSSTransformComponent. It's StyleValueList that actually reifies
as a CSSTransformValue - but only if it only contains
TransformationStyleValues.

+79 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
d5977b9f74 LibWeb/CSS: Implement CSSTransformValue
This is the final CSSStyleValue class used by the per-property test
harness, so those now actually run instead of throwing an exception on
load. 🎉

+39 WPT subtests. (Plus however many from the per-property tests finally
running.)

The two failing serialization tests are also failed by Safari in exactly
the same way, so that seems more like a spec issue. (The spec is
incomplete in quite a few places.) The failing subtest for toMatrix() is
also a spec issue: is2D is handled oddly by CSSMatrixComponent and this
subtest fails because of the `matrix` getter, which is unspecified. See
https://github.com/w3c/css-houdini-drafts/issues/1155 for details.
2025-09-24 12:27:05 +01:00
Sam Atkins
3269937e6d LibWeb/Geometry: Add a method to multiply a DOMMatrix by a DOMMatrix
This will be needed by CSSTransformValue.
2025-09-24 12:27:05 +01:00
Sam Atkins
d3d695e9d2 LibWeb/CSS: Make CSSStyleValue.to_string() return ExceptionOr
DOMMatrix.to_string() throws exceptions if any of its values are
non-finite. This ends up affecting CSSStyleValue because its subclass
CSSTransformValue (which is about to be added) serializes
CSSTransformComponents, and one of those is CSSMatrixComponent, which
calls DOMMatrix.to_string().

This is all quite unfortunate, and because at the time the spec for
DOMMatrix was written, CSS couldn't represent NaN or infinity. That's
no longer true, so I'm hoping the spec can be updated and this can be
reverted. https://github.com/w3c/fxtf-drafts/issues/611
2025-09-24 12:27:05 +01:00
Sam Atkins
a1db5e7789 LibWeb/CSS: Implement CSSMatrixComponent
Equivalent to the matrix() and matrix3d() transform functions.

+19 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
2ffbb284f2 LibWeb/CSS: Implement CSSPerspective
Equivalent to the perspective() transform function.

+34 WPT subtests, and the transformvalue-normalization test now runs to
completion instead of throwing an error - though its cases still fail
until CSSTransformValue is implemented.
2025-09-24 12:27:05 +01:00
Sam Atkins
68ceacb0c5 LibWeb/CSS: Implement CSSKeywordish type 2025-09-24 12:27:05 +01:00
Sam Atkins
da883877f5 LibWeb/CSS: Implement CSSSkewY
Equivalent to the skewY() transform function.

+27 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
b0cc1c6406 LibWeb/CSS: Implement CSSSkewX
Equivalent to the skewX() transform function.

+27 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
161e384521 LibWeb/CSS: Implement CSSSkew
Equivalent to the skew() transform function.

+39 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
456946368e LibWeb/CSS: Implement CSSScale
Equivalent to the scale() transform functions.

+33 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
d348d8d9b8 LibWeb/CSS: Implement CSSRotate
Equivalent to the rotate() transform functions.

+39 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
c7d22d8cfd LibWeb/CSS: Implement CSSTranslate
Equivalent to the translate() transform functions.

+34 WPT subtests.
2025-09-24 12:27:05 +01:00
Sam Atkins
8e86bf2dd0 LibWeb/CSS: Implement CSSTransformComponent
This is a base type for the various transform functions.

CSSMatrixComponent's to_string() can throw exceptions, so to_string() is
implemented that way. https://github.com/w3c/fxtf-drafts/issues/611

+9 WPT subtests.
2025-09-24 12:27:05 +01:00
Callum Law
43dd0f2dda LibWeb: Properly clamp interpolated opacity values
Opacity values are unique in that the range which calculated and
interpolated values should be clamped to [0,1] is different from the
range of allowed values [-∞,∞].

This fixes 28 WPT tests that were regressed in #6112
2025-09-24 12:01:52 +01:00
Callum Law
517e3f5f1d LibWeb: Serialize animation according to spec
We now:
 - Serialize longhands in the correct order
 - Support serializing multiple values
 - Include default longhands where required (to distinguish
   animation-name from that longhand).
2025-09-24 11:58:20 +01:00
Callum Law
869442c206 LibWeb: Parse animation shorthand as comma separated list
We now parse (but don't yet trigger animations for) multiple definitions
within a single animation property.
2025-09-24 11:58:20 +01:00
Callum Law
2ff1ae6155 LibWeb: Escape serialized custom idents 2025-09-24 11:58:20 +01:00
Callum Law
c5e6e4fd95 LibWeb: Use custom_ident method for getting @font-face font-family
`CustomIdentStyleValue::to_string` will be updated to return the escaped
value in a future commit but we want to use the unescaped value here.
2025-09-24 11:58:20 +01:00
Callum Law
ce4a24eec5 LibWeb: Store animation-name in ComputedProperties in computed form 2025-09-24 11:58:20 +01:00
Callum Law
030e6d7c9b LibWeb: Parse animation-* properties as comma separated lists
We are yet to actually support having more than one value but this gets
us closer and gains us some WPT tests in the process.
2025-09-24 11:58:20 +01:00
Callum Law
4fd57f90b3 LibWeb: Apply animations after computing property values
We were unnecessarily computing property values within
`collect_animation_into` which we can avoid by ensuring that all calls
to `collect_animation_into` happen after property values are computed.
2025-09-24 11:58:20 +01:00
Callum Law
4f5feaf3b6 Tests: Import a bunch of animation property parsing tests
Done in a distinct commit to show progress over following commits
2025-09-24 11:58:20 +01:00
Shivendra Kumar
4221a18974 LibWeb: Fix typo "folowing" → "following" 2025-09-24 11:54:42 +01:00
Niccolo Antonelli Dziri
a72b0c29bb LibWeb: Add a simplified Notification constructor
This allows the Notification object to be created in javascript without
any additional functionalities.

It passes two wpt tests which require a call to the notification
constructor with no arguments.

https://wpt.live/notifications/constructor-basic.https.html

https://wpt.live/notifications/constructor-invalid.https.html
2025-09-24 11:53:14 +01:00
Tim Ledbetter
0aec8912c9 LibWeb: Remove special casing for font oblique angle from CSS parser 2025-09-24 11:40:38 +01:00
Tim Ledbetter
27de4fdcea LibWeb: Clamp interpolated font-style angle
This change adds the allowed angle range to the `font-style` property
definition. This allows these angles to be clamped after interpolation.

Ideally, the generator should be updated so that we can specify the
angle is in degrees. This would allow us to make use of this
information during parsing, which we can't do currently because we
don't know what the unit is. Using this value for interpolation
purposes is fine because the angle has been converted to its canonical
unit by this point.
2025-09-24 11:40:38 +01:00
InvalidUsernameException
9d7689ecd8 LibWeb: Do not stomp over content size of SVGs
When displaying SVGs inside a navigable directly, we want to display
them in the size specified by their width and height attributes instead
of stretching them to the viewport as layout normally would.

However, when doing so, we need to actually check that the SVG we are
laying out is indeed directly inside the navigable. Otherwise we just
blindly overwrite whatever content sizes have been calculated by layout
code for e.g. SVG elements inlined somewhere in an HTML document.

Due to the way this was written originally, the bug was not very
noticable. The code overwrote the content width/height with the computed
width/height, which was often still correct in the sense that those two
had the same value. However, content size may also be the result of
{min,max}-{width,height} constraints, which can make it differ from the
computed values.

This bug was likely a regression introduced in
f5e01192cc.
2025-09-24 11:25:43 +01:00
me-it-is
b76f1fb011 AK: Fix is_within_range when converting from float
Within range now uses the max capacity of a type rather than its size.
This fixes some subtests in
https://wpt.fyi/results/wasm/core/conversions.wast.js.html?product=ladybird
2025-09-24 10:40:24 +01:00
Julian Dominguez-Schatz
193163be2f Tests: Add test for credentials flag in fetch 2025-09-24 10:12:56 +01:00
Julian Dominguez-Schatz
36bfee7f1b Tests: Add 'reflect' option to http-test-server.py
Add an option to http-test-server.py to return received headers as the
response body. This is useful for checking that outgoing headers are
correct, for example in cookie tests.
2025-09-24 10:12:56 +01:00
Julian Dominguez-Schatz
4e3387778e LibWeb: Respect IncludeCredentials for Set-Cookie during fetch
Per https://fetch.spec.whatwg.org/#http-network-fetch, Set-Cookie should
only store a cookie if IncludeCredentials::Yes is set. Fixes 1 web
platform test.
2025-09-24 10:12:56 +01:00
Pavel Shliak
a7f85e1349 Meta: Use StringView consistently in IDL types argument list 2025-09-24 08:45:26 +01:00
Tim Ledbetter
23380a563a LibWeb: Include custom-ident type in specification of grid properties
Previously, serialization of `grid-column-*` and `grid-row-*`
properties containing a custom-ident would fail.
2025-09-24 02:25:26 +02:00
Tim Ledbetter
4def0b9dc4 LibWeb: Serialize grid-area according to specification 2025-09-24 02:25:26 +02:00
Aliaksandr Kalenik
9bbc1cd618 LibWeb: Check if transform is identity instead of has_css_transform()
...in clip and scroll frames calculation algorithm.

Fix a regression from 719a50c where display-list recording disagreed
with the clipping logic about whether a stacking context is transformed.
`has_css_transform()` returns true whenever the computed transform is
not `none`, which differs from an identity-matrix check. These yield
different results for cases like `translate(0, 0)`.
2025-09-23 23:35:19 +02:00
Aliaksandr Kalenik
719a50c9bf LibWeb: Don't emit Push{Pop}StackingContext without visible effect
Before this change we would emit PushStackingContext/PopStackingContext
display list items regardless of whether the stacking context had any
transform/opacity/clip effects.

Display list size on https://x.com/ladybirdbrowser is reduced from ~2700
to ~800 items.
2025-09-23 19:05:01 +02:00
Aliaksandr Kalenik
2cf10981af LibGfx+LibWeb: Implement GlyphRun::bounding_rect()
Allows us to skip painting of glyph runs lying outside of viewport.
2025-09-23 17:55:32 +02:00
Tim Ledbetter
9c204f36ec LibWeb: Make eventInitDict GamepadEvent constructor parameter optional
This differs from the specification but matches the behavior of
existing implementations.
2025-09-23 16:04:56 +01:00