Sam Atkins
24f4356c3f
LibWeb/CSS: Specify behavior for OOB CSSStyleDeclaration::item()
...
Corresponds to 56ed462ccd
We already did the right thing.
2025-08-07 14:29:17 +02:00
InvalidUsernameException
6c4483fe0e
LibWeb/CSS: Serialize mask shorthand-property properly
2025-08-06 23:09:07 +01:00
InvalidUsernameException
39b64c9b5c
LibWeb/CSS: Parse mask shorthand-property into longhands
...
This commit regresses a couple tests related to the mask shorthand
property. This is because we now parse the longhands but there are
errors related to serialization. Some of the failures are fixed again in
the next commit. However, for some animation tests this is not the case.
Those failures were simply masked by the fact that we did not parse the
property correctly.
2025-08-06 23:09:07 +01:00
InvalidUsernameException
5fca78e0f9
LibWeb/CSS: Parse mask-image property with multiple values
2025-08-06 23:09:07 +01:00
InvalidUsernameException
f953196cb4
LibWeb/CSS: Parse mask-clip property
2025-08-06 23:09:07 +01:00
InvalidUsernameException
eea6792cf7
LibWeb/CSS: Parse mask-origin property
2025-08-06 23:09:07 +01:00
InvalidUsernameException
866e12f688
LibWeb/CSS: Parse mask-size property
2025-08-06 23:09:07 +01:00
InvalidUsernameException
7c5f1a93ed
LibWeb/CSS: Parse mask-repeat property
2025-08-06 23:09:07 +01:00
InvalidUsernameException
add3a095d8
LibWeb/CSS: Rename background-repeat related symbols to align with spec
...
These will be used for the mask-repeat property as well in an upcoming
commit, hence the more generic names. Also, this more closely matches
the names used in the spec.
2025-08-06 23:09:07 +01:00
InvalidUsernameException
667f195d1e
LibWeb/CSS: Parse mask-position property
2025-08-06 23:09:07 +01:00
InvalidUsernameException
d022eea9fc
LibWeb/CSS: Parse mask-mode property
2025-08-06 23:09:07 +01:00
InvalidUsernameException
22d7a58998
LibWeb/CSS: Parse mask-composite property
2025-08-06 23:09:07 +01:00
Callum Law
04ac06f3c4
LibWeb: Absolutize CursorStyleValues in StyleComputer::absolutize_values
2025-08-06 17:44:12 +01:00
Callum Law
c49afd7b28
LibWeb: Absolutize LengthPercentage members of BorderRadiusStyleValues
2025-08-06 17:44:12 +01:00
Callum Law
315f811d69
LibWeb: Absolutize BackgroundSizeSVs in StyleComputer::absolutize_values
2025-08-06 17:44:12 +01:00
Callum Law
c8bd58c0ba
LibWeb: Add method to absolutize CalculatedOr
2025-08-06 17:44:12 +01:00
Callum Law
0df9c225aa
LibWeb: Add method to absolutize PercentageOr
2025-08-06 17:44:12 +01:00
Callum Law
ba4a57b34d
LibWeb: Absolutize StyleValueList in StyleComputer::absolutize_values
2025-08-06 17:44:12 +01:00
Callum Law
a2ceed27e2
LibWeb: Absolutize CalculatedSVs in StyleComputer::absolutize_values
2025-08-06 17:44:12 +01:00
Callum Law
9db3c66a85
LibWeb: Use correct font size when absolutizing animated properties
2025-08-06 17:44:12 +01:00
Callum Law
011ab5f714
LibWeb: Use correct SerializationMode when serializing CalculatedOr
2025-08-06 17:44:12 +01:00
Callum Law
a5cbcaf698
LibWeb: Use correct SerializationMode when serializing PercentageOr
2025-08-06 17:44:12 +01:00
Callum Law
a44e28fd56
LibWeb: Avoid premature creation of CSSPixels in calc simplification
...
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
Previously we were converting lengths to CSSPixels values when we didn't
need to, this had a couple of effects in that:
- We rounded to CSSPixel resolution prematurely (sometimes giving
incorrect results)
- We converted NaN to 0 when we shouldn't have.
We now avoid prematurely converting lengths to CSSPixels values in two
places:
- `CalculationResult::from_value`
- `CalculatedStyleValue::resolve_length_deprecated` (the new method
already avoided rounding).
Gains us 16 WPT tests.
2025-08-06 14:57:34 +01:00
Callum Law
3fa7bc1919
LibWeb: Simplify calc products including unresolved percentages
2025-08-06 14:53:22 +01:00
Callum Law
c3b1013018
LibWeb: Skip inverted non-canonical values when simplifying product node
...
This matches the logic with the non-inverted children.
Gains us 2 WPT tests.
2025-08-06 14:53:22 +01:00
Callum Law
a70a397501
LibWeb: Support percentages in word-spacing
...
Fixes crash in the created test as well as https://wpt.live/css/css-text
/word-spacing/reference/word-spacing-percent-001-ref.html. The WPT test
hasn't been imported as it passing is currently a false-positive due to
the fact that we don't yet respect `word-spacing` in most cases.
2025-08-05 11:43:55 +01:00
Callum Law
15cee5cc15
LibWeb: Correctly round non-integer z-indexes
...
Previously we would just cast to an int.
Gains us 3 WPT tests.
2025-08-05 06:37:40 +01:00
Sam Atkins
56852fb5c2
LibWeb/CSS: Set style sheet for children of ContentStyleValue
...
Without this, any relative url()s in the `content` property don't know
what style sheet they are in, which makes them load relative to the
document instead.
2025-08-05 00:35:03 +02:00
Callum Law
344d6199da
LibWeb: Use correct colors for SVGFEFloodElement::flood_color
...
Previously we would always render floods as black, we now use the
computed color.
We also now support relative lengths within any `calc`s present.
2025-08-04 11:29:05 +01:00
Callum Law
3b52b1139a
LibWeb: Support relative lengths in stop-color
calcs
2025-08-04 11:29:05 +01:00
Callum Law
db439d224a
LibWeb: Support creating ColorResolutionContext from AbstractElement
...
No functionality changes.
2025-08-04 11:29:05 +01:00
Callum Law
a19a6deaa4
LibWeb: Take a ColorResolutionContext in color_or_fallback
...
Taking a ColorResolutionContext directly instead of creating one from a
layout node allows us to call this from places where we don't have a
layout node.
2025-08-04 11:29:05 +01:00
Callum Law
46153910ec
LibWeb: Update to_color
to take ColorResolutionContext
...
Using a generic context argument will allow us to resolve colors in
places where we have all the required information but not in the form of
a layout node as was expected previously.
2025-08-04 11:29:05 +01:00
Callum Law
b0508fb39a
LibWeb: Move CSS::CalculationResolutionContext
to its own file
...
This struct will be used within CSSStyleValue.h in a future commit and
having it in CalculatedStyleValue.h causes a dependency loop.
2025-08-04 11:29:05 +01:00
norbiros
7dc41b52db
LibWeb/CSS: Use proper parsing_params
in CSS.registerProperty
2025-08-04 11:08:46 +01:00
norbiros
190745fd58
LibWeb/CSS: Parse initial value using syntax from @property
...
Now we pass all WPT tests in:
`css/css-properties-values-api/at-property-cssom`.
Note: Failing tests were false positives.
Proper handling of inheriting values and detecting computational
independence will be done in another PR.
2025-08-04 11:08:46 +01:00
Sam Atkins
1adddb158a
WebContent+LibWeb/CSS: Add debug request to dump CSS errors
2025-08-04 10:50:09 +01:00
Sam Atkins
01661503b9
LibWeb/CSS: Remove unused Debug.h include from GradientParsing.cpp
2025-08-04 10:50:09 +01:00
Sam Atkins
dc91688f18
LibWeb/CSS: Use ErrorReporter for property/descriptor parsing errors
2025-08-04 10:50:09 +01:00
Sam Atkins
cebdcd9f69
LibWeb/CSS: Use ErrorReporter for value-parsing errors
...
Also remove some redundant reporting for `<urange>` parsing errors.
2025-08-04 10:50:09 +01:00
Sam Atkins
3b7aa736e7
LibWeb/CSS: Use ErrorReporter for media query parsing
2025-08-04 10:50:09 +01:00
Sam Atkins
1a599ceb98
LibWeb/CSS: Reject @font-face
and margin rules that have a prelude
...
I couldn't find any WPT coverage for this, so here's a homemade test.
2025-08-04 10:50:09 +01:00
Sam Atkins
e072ddfebd
LibWeb/CSS: Use ErrorReporter for rule-parsing errors
...
Unfortunately we already have an InvalidRuleError type defined in the
CSS Parser, so it has to be qualified here, at least for now.
2025-08-04 10:50:09 +01:00
Sam Atkins
0bd83dd996
LibWeb/CSS: Use ErrorReporter for "rule X not allowed in Y" errors
...
QualifiedRule::for_each_as_declaration_list() now takes a rule_name, so
that the error message can actually be useful - we only know what a
qualified rule is by context.
2025-08-04 10:50:09 +01:00
Sam Atkins
d6cfd56ae6
LibWeb/CSS: Use ErrorReporter for selector parsing errors
...
Also removed the error reporting from parse_a_n_plus_b_pattern() as its
caller already reports that error.
2025-08-04 10:50:09 +01:00
Sam Atkins
2a2a1986cc
LibWeb/CSS: Add dump_string()
method to TokenStream
...
This is to support error reporting. It's not the most elegant way of
getting the source CSS, but it works.
2025-08-04 10:50:09 +01:00
Sam Atkins
012f4735a7
LibWeb/CSS: Introduce structured reporting for CSS errors
...
Instead of random dbgln_if(CSS_PARSER_DEBUG) messages, this lets us
report what kind of error it was. Repeated errors are combined instead
of spamming the console.
Ideally this would also record where the error occurred, but not yet.
2025-08-04 10:50:09 +01:00
Sam Atkins
b7a108d7cb
LibWeb/CSS: Remove unused ParseError::InternalError
2025-08-04 10:50:09 +01:00
Sam Atkins
d55626dc32
LibWeb/CSS: Remove debug logging I left in by accident
2025-08-04 10:50:09 +01:00
Sam Atkins
d86bcc795d
LibWeb/CSS: Remove duplicate error reporting for invalid descriptors
...
parse_descriptor_value() already logs this.
2025-08-04 10:50:09 +01:00