Skip to content

LibWeb: Declare each style groups in Properties.json - #11034

Closed
tcl3 wants to merge 2 commits into
LadybirdBrowser:masterfrom
tcl3:libweb_style_group_declarations
Closed

LibWeb: Declare each style groups in Properties.json#11034
tcl3 wants to merge 2 commits into
LadybirdBrowser:masterfrom
tcl3:libweb_style_group_declarations

Conversation

@tcl3

@tcl3 tcl3 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Declare the group for every physical longhand in Properties.json and generate a dependency mask function and a per group longhand list from the declarations. The generator rejects a longhand without a declaration and a shorthand or alias with one. A logical alias derives its mask from the target property's group and the inherited box group that stores the mapping context.

My intention is to use the newly-introduced style_group_dependency_mask() function to speed up style diffing in certain cases.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

CSS property definitions now declare style groups. The generator validates this metadata and emits group APIs. ComputedValues.cpp derives descriptor and computed-style property lists from these APIs instead of hard-coded arrays.

Changes

CSS style-group metadata and computed values

Layer / File(s) Summary
Style-group metadata generation
Libraries/LibWeb/CSS/Properties.json, Meta/Generators/generate_libweb_css_property_id.py, Documentation/CSSGeneratedFiles.md
Property definitions include style-group metadata. The generator validates groups and emits style-group indexes, dependency masks, and longhand lookup APIs. The documentation describes the metadata and generated APIs.
Descriptor-derived property caches
Libraries/LibWeb/CSS/ComputedValues.cpp
Descriptor registration uses generated group longhand lists, validates dependency coverage, and caches per-group property spans.
Dynamic computed-style group gathering
Libraries/LibWeb/CSS/ComputedValues.cpp
Computed-style groups use dynamic descriptor-derived spans for FFI value gathering across layout, inherited, visual, animation, and reset groups.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PropertiesJSON
  participant CSSPropertyGenerator
  participant ComputedValues
  participant RustStyleGroups
  PropertiesJSON->>CSSPropertyGenerator: provide style-group metadata
  CSSPropertyGenerator->>ComputedValues: generate dependency masks and longhand spans
  ComputedValues->>ComputedValues: cache and validate group properties
  ComputedValues->>RustStyleGroups: gather dynamic computed-style group values
Loading

Possibly related PRs

Suggested reviewers: kalenikaliaksandr, awesomekling

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description directly matches the changes to style-group declarations, dependency masks, longhand lists, and generator validation.
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.

@tcl3
tcl3 force-pushed the libweb_style_group_declarations branch from edc01d8 to c9cc7c9 Compare August 7, 2026 18:54

@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.

🧹 Nitpick comments (1)
Documentation/CSSGeneratedFiles.md (1)

38-38: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Clarify the style-group dependency contract.

For arrays, document that the first element is the storage group returned by longhands_in_style_group(), that array order is insignificant, and that every listed group is included in style_group_dependency_mask(). Clarify the logical-alias mask rule: aliases without inherited-box implicitly add inherited-box because the mapping context determines which physical longhand applies.

🤖 Prompt for 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.

In `@Documentation/CSSGeneratedFiles.md` at line 38, Update the style-group
documentation entry to specify that array order is insignificant, its first
element is the storage group returned by longhands_in_style_group(), and every
listed group contributes to style_group_dependency_mask(). Also document that
logical aliases without inherited-box implicitly include inherited-box because
the mapping context determines the applicable physical longhand.
🤖 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.

Nitpick comments:
In `@Documentation/CSSGeneratedFiles.md`:
- Line 38: Update the style-group documentation entry to specify that array
order is insignificant, its first element is the storage group returned by
longhands_in_style_group(), and every listed group contributes to
style_group_dependency_mask(). Also document that logical aliases without
inherited-box implicitly include inherited-box because the mapping context
determines the applicable physical longhand.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b5be64e0-f8b0-4be4-9585-3c1a5766fb6d

📥 Commits

Reviewing files that changed from the base of the PR and between edc01d8 and c9cc7c9.

📒 Files selected for processing (1)
  • Documentation/CSSGeneratedFiles.md

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Your pull request has conflicts that need to be resolved before it can be reviewed and merged. Make sure to rebase your branch on top of the latest master.

@github-actions github-actions Bot added the conflicts Pull request has merge conflicts that need resolution label Aug 7, 2026
tcl3 added 2 commits August 8, 2026 23:05
Declare the group for every physical longhand in `Properties.json` and
generate a dependency mask function and a per group longhand list from
the declarations. The generator rejects a longhand without a
declaration and a shorthand or alias with one. A logical alias derives
its mask from the target property's group and the inherited box group
that stores the mapping context.
@tcl3
tcl3 force-pushed the libweb_style_group_declarations branch from c9cc7c9 to 97a6e2f Compare August 8, 2026 22:13
@github-actions github-actions Bot removed the conflicts Pull request has merge conflicts that need resolution label Aug 8, 2026

@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: 1

🤖 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 `@Libraries/LibWeb/CSS/Properties.json`:
- Around line 4426-4435: Update the style-group for the shape-rendering property
definition to inherited-svg instead of svg-reset, preserving its existing
inherited classification and other metadata.
🪄 Autofix

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: 6af0dcfd-e4b9-4940-a75e-c5ecd158a1f3

📥 Commits

Reviewing files that changed from the base of the PR and between c9cc7c9 and 97a6e2f.

📒 Files selected for processing (2)
  • Libraries/LibWeb/CSS/ComputedValues.cpp
  • Libraries/LibWeb/CSS/Properties.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • Libraries/LibWeb/CSS/ComputedValues.cpp

Comment thread Libraries/LibWeb/CSS/Properties.json
@tcl3

tcl3 commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Superseded by #11088, which also does this.

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.

1 participant