Skip to content

LibWeb: Implement the CSS d property - #10958

Merged
kalenikaliaksandr merged 5 commits into
LadybirdBrowser:masterfrom
Calme1709:css-d-property
Aug 2, 2026
Merged

LibWeb: Implement the CSS d property#10958
kalenikaliaksandr merged 5 commits into
LadybirdBrowser:masterfrom
Calme1709:css-d-property

Conversation

@Calme1709

Copy link
Copy Markdown
Member

Previously we directly used the attribute value for a <path> element's path.

This PR implements the d CSS property and instead uses the cascaded value (including the attribute value as a presentational hint).

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d543e40f-c535-4729-b947-5bcd5299c7d2

📥 Commits

Reviewing files that changed from the base of the PR and between a21fa53 and e797dd5.

⛔ Files ignored due to path filters (8)
  • Tests/LibWeb/Ref/expected/wpt-import/svg/path/property/d-none-ref.svg is excluded by !**/*.svg
  • Tests/LibWeb/Ref/expected/wpt-import/svg/path/property/priority-ref.svg is excluded by !**/*.svg
  • Tests/LibWeb/Ref/input/wpt-import/svg/path/property/d-none.svg is excluded by !**/*.svg
  • Tests/LibWeb/Ref/input/wpt-import/svg/path/property/priority.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/d-interpolation-discrete.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/d-interpolation-relative-absolute.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/d-interpolation-single.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/getComputedStyle.svg is excluded by !**/*.svg
📒 Files selected for processing (22)
  • Libraries/LibWeb/CSS/ComputedProperties.cpp
  • Libraries/LibWeb/CSS/ComputedValues.cpp
  • Libraries/LibWeb/CSS/ComputedValues.h
  • Libraries/LibWeb/CSS/Parser/Parser.h
  • Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp
  • Libraries/LibWeb/CSS/Properties.json
  • Libraries/LibWeb/Rust/src/css/computed_value_types.rs
  • Libraries/LibWeb/Rust/src/css/computed_values.rs
  • Libraries/LibWeb/SVG/SVGElement.cpp
  • Libraries/LibWeb/SVG/SVGPathElement.cpp
  • Libraries/LibWeb/SVG/SVGPathElement.h
  • Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
  • Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
  • Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-discrete.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-relative-absolute.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-single.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/getComputedStyle.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-special-cases.txt
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/resources/interpolation-test-common.js
💤 Files with no reviewable changes (1)
  • Libraries/LibWeb/SVG/SVGPathElement.h
🚧 Files skipped from review as they are similar to previous changes (20)
  • Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
  • Libraries/LibWeb/Rust/src/css/computed_value_types.rs
  • Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt
  • Libraries/LibWeb/CSS/Properties.json
  • Libraries/LibWeb/CSS/ComputedValues.cpp
  • Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
  • Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
  • Libraries/LibWeb/CSS/ComputedValues.h
  • Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-single.txt
  • Libraries/LibWeb/SVG/SVGElement.cpp
  • Libraries/LibWeb/CSS/Parser/Parser.h
  • Libraries/LibWeb/CSS/ComputedProperties.cpp
  • Libraries/LibWeb/SVG/SVGPathElement.cpp
  • Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-special-cases.txt
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/resources/interpolation-test-common.js
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-relative-absolute.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-discrete.txt
  • Libraries/LibWeb/Rust/src/css/computed_values.rs
  • Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

📝 Walkthrough

Walkthrough

The change adds CSS d property parsing and computed-value support. It integrates SVG d presentation attributes with CSS and derives <path> geometry from computed values. CSS and WPT expectations cover property exposure, presentation attributes, computed styles, and interpolation.

Changes

SVG d property

Layer / File(s) Summary
CSS property contract and parsing
Libraries/LibWeb/CSS/Properties.json, Libraries/LibWeb/CSS/Parser/*
Defines d with an initial value of none. The parser accepts none and valid path() values.
Computed-value plumbing
Libraries/LibWeb/CSS/ComputedProperties.cpp, Libraries/LibWeb/CSS/ComputedValues.*, Libraries/LibWeb/Rust/src/css/*
Stores d in the Rust-backed SVG reset values, initializes it to none, compares the payload, and exposes computed-style serialization.
SVG path integration
Libraries/LibWeb/SVG/SVGElement.cpp, Libraries/LibWeb/SVG/SVGPathElement.*
Maps d presentation attributes on <path> elements, parses them as path(), and derives path geometry from computed d values.
CSS and SVG validation
Tests/LibWeb/Text/expected/css/*, Tests/LibWeb/Text/expected/wpt-import/{css,svg}/*, Tests/LibWeb/Text/input/wpt-import/svg/path/property/resources/*
Updates expected property and computed-style output. Adds SVG presentation, computed-style, and interpolation results with shared interpolation helpers.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SVGElement
  participant CSSParser
  participant ComputedValues
  participant SVGPathElement
  SVGElement->>CSSParser: parse the d presentation attribute as path()
  CSSParser->>ComputedValues: store the computed d value
  SVGPathElement->>ComputedValues: request computed d
  ComputedValues-->>SVGPathElement: return d style value
  SVGPathElement-->>SVGPathElement: build Gfx::Path geometry
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately explains that the PR implements the CSS d property and uses the cascaded value for SVG path elements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt`:
- Line 165: Regenerate the expected outputs through the WPT import workflow
rather than editing them directly: update
Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
at 165-165,
Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-discrete.txt
at 6-6,
Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-relative-absolute.txt
at 7-7, and
Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-single.txt
at 7-7. Apply the expectation changes upstream or via the repository’s import
process.

In
`@Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-relative-absolute.txt`:
- Around line 3-6: Fix the underlying SVG path d-interpolation failures before
regenerating expected outputs. Update both
Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-relative-absolute.txt
lines 3-6 and
Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-single.txt
lines 3-6 only after the suites pass, so the snapshots record intended WPT
results rather than failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae9cb6f2-477d-40ff-ae46-72c9e7f986e1

📥 Commits

Reviewing files that changed from the base of the PR and between 9d060f0 and a21fa53.

⛔ Files ignored due to path filters (8)
  • Tests/LibWeb/Ref/expected/wpt-import/svg/path/property/d-none-ref.svg is excluded by !**/*.svg
  • Tests/LibWeb/Ref/expected/wpt-import/svg/path/property/priority-ref.svg is excluded by !**/*.svg
  • Tests/LibWeb/Ref/input/wpt-import/svg/path/property/d-none.svg is excluded by !**/*.svg
  • Tests/LibWeb/Ref/input/wpt-import/svg/path/property/priority.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/d-interpolation-discrete.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/d-interpolation-relative-absolute.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/d-interpolation-single.svg is excluded by !**/*.svg
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/getComputedStyle.svg is excluded by !**/*.svg
📒 Files selected for processing (22)
  • Libraries/LibWeb/CSS/ComputedProperties.cpp
  • Libraries/LibWeb/CSS/ComputedValues.cpp
  • Libraries/LibWeb/CSS/ComputedValues.h
  • Libraries/LibWeb/CSS/Parser/Parser.h
  • Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp
  • Libraries/LibWeb/CSS/Properties.json
  • Libraries/LibWeb/Rust/src/css/computed_value_types.rs
  • Libraries/LibWeb/Rust/src/css/computed_values.rs
  • Libraries/LibWeb/SVG/SVGElement.cpp
  • Libraries/LibWeb/SVG/SVGPathElement.cpp
  • Libraries/LibWeb/SVG/SVGPathElement.h
  • Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
  • Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
  • Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-discrete.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-relative-absolute.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/d-interpolation-single.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/path/property/getComputedStyle.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-special-cases.txt
  • Tests/LibWeb/Text/input/wpt-import/svg/path/property/resources/interpolation-test-common.js
💤 Files with no reviewable changes (1)
  • Libraries/LibWeb/SVG/SVGPathElement.h

Pass `d` presentational attributes through the cascade in preparation
for switching <path> to respect cascaded CSS values for `d`.
Previously we directly used the `d` attribute's value. Now we use the
value produced by the CSS cascade (which includes the attribute value as
a presentational hint).
@kalenikaliaksandr
kalenikaliaksandr merged commit 892ef76 into LadybirdBrowser:master Aug 2, 2026
15 checks passed
@Calme1709
Calme1709 deleted the css-d-property branch August 2, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants