Callum Law
d6754307f9
LibWeb: Separate relative sizes from absolute_size_mapping
...
Having relative sizes handled in this function was misleading
2025-09-19 10:06:33 +01:00
Callum Law
1ca511b627
LibWeb: Correctly resolve percentages against relative lengths in calcs
...
Previously we would always assume the percentage was 100%
2025-09-19 10:06:33 +01:00
Callum Law
b80e6a4d30
LibWeb: Rename get_inherit_value
to get_non_animated_inherit_value
...
This more acurately represents what it does.
2025-09-19 10:06:33 +01:00
Tim Ledbetter
9b15517052
LibWeb: Apply composite operator to keyframe effects
2025-09-18 16:46:06 +01:00
Callum Law
004bd3dc8f
LibWeb: Clamp calc()'d shadow blur radius to positive values
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-18 15:21:22 +01:00
Callum Law
19e3ddc0c6
LibWeb: Simplify parse_single_shadow_value
...
The `possibly_dynamic_length` function was unnecessary and can be
replaced with the standard `parse_length_value`
2025-09-18 15:21:22 +01:00
Callum Law
c3a78d2884
LibWeb: Don't include spread distance when serializing text-shadow
...
We shouldn't include spread distance when serializing `text-shadow` as
it is not supported unlike `box-shadow` - to achieve this we store
whether this is a text or box shadow within the ShadowStyleValue and
serialize appropriately.
2025-09-18 15:21:22 +01:00
Callum Law
1ac7b47764
LibWeb: Disallow spread distance value when parsing text-shadow
...
`text-shadow` does not support setting a value for spread distance
unlike `box-shadow`.
2025-09-18 15:21:22 +01:00
Sam Atkins
95aceb6ec9
LibWeb: Store custom properties in an OrderedHashMap
...
We are expected to preserve their order within a style declaration, so
let's do that. Passes 1 tracked WPT subtest.
2025-09-18 14:59:14 +02:00
luizgfc
bcbbecff9f
LibWeb: Correctly handle properties on CSS declaration serialization
2025-09-18 09:25:23 +01:00
luizgfc
3b5df12b38
LibWeb: Handle custom properties on CSSStyleProperties list
2025-09-18 09:25:23 +01:00
Jelle Raaijmakers
c31eff6a47
Everywhere: Use Optional<T>::ensure() where useful
...
No functional changes.
2025-09-17 12:01:18 -04:00
Callum Law
34b8947ca0
LibWeb: Support text-underline-position: under
2025-09-15 15:24:20 +01:00
Callum Law
b0e3af7d10
LibWeb: Parse text-underline-position
property
...
This introduces the `TextUnderlinePositionStyleValue` class, it is
possible to represent `text-underline-position` as a `StyleValueList`
but would have required ugly workarounds for either serialization or in
`ComputedProperties::text_underline_position`
2025-09-15 15:24:20 +01:00
Callum Law
a6812e1005
LibWeb: Store parsed shorthands in canonical order
2025-09-15 15:24:20 +01:00
Tim Ledbetter
f5fd6338d5
LibWeb: Handle interpolation of mixed-type LengthPercentages
2025-09-15 10:41:01 +01:00
Tim Ledbetter
7409c564d7
LibWeb: Extract mixed-type interpolation to a separate method
2025-09-15 10:41:01 +01:00
Tim Ledbetter
b19fee9962
LibWeb: Interpolate ellipse()
function by computed value
2025-09-15 10:34:43 +01:00
Tim Ledbetter
f146207a04
LibWeb: Interpolate circle()
function by computed value
2025-09-15 10:34:43 +01:00
Tim Ledbetter
4a0fe65923
LibWeb: Interpolate polygon()
function by computed value
2025-09-15 10:34:43 +01:00
Tim Ledbetter
853bedeb31
LibWeb: Interpolate rect()
function by computed value
2025-09-15 10:34:43 +01:00
Tim Ledbetter
0c89e86ff7
LibWeb: Interpolate xywh()
function by computed value
2025-09-15 10:34:43 +01:00
Tim Ledbetter
be94c8d456
LibWeb: Interpolate inset()
function by computed value
2025-09-15 10:34:43 +01:00
Sam Atkins
5904694844
LibWeb/CSS: Implement CSSImageValue and reify images as it
...
This is specced to be opaque, so there's not much to it.
2025-09-15 08:47:10 +01:00
Callum Law
50239b58aa
LibWeb: Reset border-image
to initial value when using border
...
Also includes associated handling for serialization of the `border`
shorthand.
2025-09-15 08:42:22 +01:00
Callum Law
588c611e7e
LibWeb: Use correct initial value for border-image
...
Omitting the `/`s meant that `1` and `0` were parsed as part of
border-slice instead of their intended values.
No functional changes but this will be relied on in a later commit.
2025-09-15 08:42:22 +01:00
MFMF-EGY
fff09ed330
LibWeb: Handle interpolation of BorderRadius style value type
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-14 16:49:20 +01:00
Marcos Del Sol Vives
40792aa85d
LibWeb/CSS: Fix compilation with CSS_TRANSITIONS_DEBUG
...
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (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
A new parameter was added to Web::CSS::StyleValue::to_string() in
PR #2820 but this debug message was never updated. If
CSS_TRANSITIONS_DEBUG was enabled, compilation would fail.
2025-09-13 23:33:57 +02:00
Tim Ledbetter
19577b966e
LibWeb: Implement interpolation of border-image-slice
style values
2025-09-13 12:05:19 +02:00
Callum Law
a805635e40
LibWeb: Compute dimension percentage mix as percentage where applicable
...
When we have a `calc` which is a mix of a dimension and a percentage, we
should use the percentage alone for the computed value if the dimension
component is 0 e.g. `calc(50% + 0px)` should use `50%` as it's computed
value.
2025-09-12 15:04:30 +01:00
Nico Weber
9272df7a86
Everywhere: Fix a few unreachable-return / unreachable-break warnings
...
I was playing with clang's -Wunreachable-code-aggressive a bit.
This fixes a handful uncontroversial things it flags.
No behavior change.
2025-09-12 14:33:14 +01:00
Sam Atkins
a139ad1c44
LibWeb/CSS: Implement CSSNumericValue.to()
...
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
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
Tries to convert the CSSNumericValue to a CSSUnitValue with the given
unit.
This gets us the remaining 11 WPT subtests for this method.
2025-09-12 13:45:41 +02:00
Sam Atkins
80abffd2e8
LibWeb/CSS: Implement "Create a sum value"
2025-09-12 13:45:41 +02:00
Sam Atkins
1c952b01ac
LibWeb/CSS: Implement "Convert a CSSUnitValue"
2025-09-12 13:45:41 +02:00
Sam Atkins
5a42b7a40f
LibWeb/CSS: Implement product_of_two_unit_maps()
...
Helper function for combining two UnitMaps.
2025-09-12 13:45:41 +02:00
Sam Atkins
e6e380b109
LibWeb/CSS: Implement "create a type from a unit map"
2025-09-12 13:45:41 +02:00
Sam Atkins
09a6b179d0
LibWeb/CSS: Take FlyString in NumericType::create_from_unit()
...
We only call this with FlyStrings, so we might as well.
2025-09-12 13:45:41 +02:00
Sam Atkins
995c19da56
LibWeb/CSS: Return unit names as FlyStrings
...
From the CSS token side, we already have these in FlyString form. From
the generated code side, we can easily return FlyStrings instead of
StringViews. So, let's do that, and save some work converting back and
forth.
2025-09-12 13:45:41 +02:00
Sam Atkins
59c4076066
LibWeb/CSS: Mark CSSStyleValue classes final where possible
2025-09-12 13:45:41 +02:00
Aliaksandr Kalenik
db5fd614ac
LibWeb: Require layout update for less properties in getComputedStyle()
...
Some properties like `justify-items`, `grid`, or `display` do affect
layout, but their used values can be obtained without performing a
layout calculation.
This change introduces a new helper,
`property_needs_layout_for_getcomputedstyle()`, specifically for use by
`CSSStyleProperties::property()`. It returns true only for properties
such as `width`, `height`, `margin`, `padding`, `top`, and `left`, where
an up-to-date layout is required to return the correct used value.
2025-09-12 11:06:16 +02:00
Callum Law
815e77c04d
LibWeb: Respect text-underline-offset
when rendering underlines
2025-09-12 07:07:15 +01:00
Callum Law
858450922b
LibWeb: Parse and compute text-underline-offset
property
2025-09-12 07:07:15 +01:00
Sam Atkins
524a161a51
LibWeb: Take AbstractElement in start_a_transition()
2025-09-11 18:45:35 +02:00
Sam Atkins
e6bb0ab000
LibWeb/CSS: Take AbstractElement in compute_transitioned_properties()
2025-09-11 18:45:35 +02:00
Sam Atkins
77f1057992
LibWeb/CSS: Take AbstractElement in cascade_custom_properties()
2025-09-11 18:45:35 +02:00
Sam Atkins
b49d00996b
LibWeb/CSS: Take AbstractElement in compute_text_align()
2025-09-11 18:45:35 +02:00
Sam Atkins
fa790e5095
LibWeb/CSS: Take AbstractElement in for_each_matching_rules()
2025-09-11 18:45:35 +02:00
Sam Atkins
cdc4f7c989
LibWeb/CSS: Take AbstractElement to compute alias mapping contexts
2025-09-11 18:45:35 +02:00
Sam Atkins
cdbaa73576
LibWeb/CSS: Take AbstractElement in box-type transformation functions
2025-09-11 18:45:35 +02:00
Sam Atkins
44e70d9087
LibWeb/CSS: Take AbstractElement in compute_cascaded_values()
2025-09-11 18:45:35 +02:00