Skip to content

LibWeb: Remove per-element computed style overrides - #11022

Merged
kalenikaliaksandr merged 1 commit into
LadybirdBrowser:masterfrom
kalenikaliaksandr:remove-adjust-computed-style
Aug 6, 2026
Merged

LibWeb: Remove per-element computed style overrides#11022
kalenikaliaksandr merged 1 commit into
LadybirdBrowser:masterfrom
kalenikaliaksandr:remove-adjust-computed-style

Conversation

@kalenikaliaksandr

Copy link
Copy Markdown
Member

Element-specific computed style adjustments existed in the Rust style computation core and a virtual method on Element. The latter was still required for element-backed shadow pseudo-elements and animation style updates, so the two implementations could silently diverge over time.

Expose a combined box transformation and element adjustment through the Rust FFI and use it for the remaining side paths and per-frame animation samples. Remove the Element virtual and its 20 HTML and SVG overrides. Adjusted animation samples preserve input and select line heights, SVG positioning, and table alignment throughout animated style updates.

Element-specific computed style adjustments existed in the Rust style
computation core and a virtual method on Element. The latter was still
required for element-backed shadow pseudo-elements and animation style
updates, so the two implementations could silently diverge over time.

Expose a combined box transformation and element adjustment through the
Rust FFI and use it for the remaining side paths and per-frame animation
samples. Remove the Element virtual and its 20 HTML and SVG overrides.
Adjusted animation samples preserve input and select line heights, SVG
positioning, and table alignment throughout animated style updates.
@coderabbitai

coderabbitai Bot commented Aug 6, 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: cb204ac6-5b20-4c4e-a2d9-ac3c1b34b3fa

📥 Commits

Reviewing files that changed from the base of the PR and between 28908d5 and c1248dd.

📒 Files selected for processing (46)
  • Libraries/LibWeb/CSS/StyleComputer.cpp
  • Libraries/LibWeb/CSS/StyleComputer.h
  • Libraries/LibWeb/DOM/Element.h
  • Libraries/LibWeb/HTML/HTMLAudioElement.cpp
  • Libraries/LibWeb/HTML/HTMLAudioElement.h
  • Libraries/LibWeb/HTML/HTMLBRElement.cpp
  • Libraries/LibWeb/HTML/HTMLBRElement.h
  • Libraries/LibWeb/HTML/HTMLButtonElement.cpp
  • Libraries/LibWeb/HTML/HTMLButtonElement.h
  • Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
  • Libraries/LibWeb/HTML/HTMLCanvasElement.h
  • Libraries/LibWeb/HTML/HTMLElement.cpp
  • Libraries/LibWeb/HTML/HTMLElement.h
  • Libraries/LibWeb/HTML/HTMLEmbedElement.cpp
  • Libraries/LibWeb/HTML/HTMLEmbedElement.h
  • Libraries/LibWeb/HTML/HTMLFrameElement.cpp
  • Libraries/LibWeb/HTML/HTMLFrameElement.h
  • Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp
  • Libraries/LibWeb/HTML/HTMLFrameSetElement.h
  • Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
  • Libraries/LibWeb/HTML/HTMLIFrameElement.h
  • Libraries/LibWeb/HTML/HTMLImageElement.cpp
  • Libraries/LibWeb/HTML/HTMLImageElement.h
  • Libraries/LibWeb/HTML/HTMLInputElement.cpp
  • Libraries/LibWeb/HTML/HTMLInputElement.h
  • Libraries/LibWeb/HTML/HTMLMediaElement.cpp
  • Libraries/LibWeb/HTML/HTMLMediaElement.h
  • Libraries/LibWeb/HTML/HTMLMeterElement.cpp
  • Libraries/LibWeb/HTML/HTMLMeterElement.h
  • Libraries/LibWeb/HTML/HTMLObjectElement.cpp
  • Libraries/LibWeb/HTML/HTMLObjectElement.h
  • Libraries/LibWeb/HTML/HTMLProgressElement.cpp
  • Libraries/LibWeb/HTML/HTMLProgressElement.h
  • Libraries/LibWeb/HTML/HTMLSelectElement.cpp
  • Libraries/LibWeb/HTML/HTMLSelectElement.h
  • Libraries/LibWeb/HTML/HTMLTableElement.cpp
  • Libraries/LibWeb/HTML/HTMLTableElement.h
  • Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
  • Libraries/LibWeb/HTML/HTMLTextAreaElement.h
  • Libraries/LibWeb/Rust/src/css/style_compute.rs
  • Libraries/LibWeb/SVG/SVGElement.cpp
  • Libraries/LibWeb/SVG/SVGElement.h
  • Libraries/LibWeb/SVG/SVGSymbolElement.cpp
  • Libraries/LibWeb/SVG/SVGSymbolElement.h
  • Tests/LibWeb/Text/expected/css/animated-post-compute-adjustments.txt
  • Tests/LibWeb/Text/input/css/animated-post-compute-adjustments.html
💤 Files with no reviewable changes (41)
  • Libraries/LibWeb/HTML/HTMLFrameElement.h
  • Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
  • Libraries/LibWeb/HTML/HTMLFrameElement.cpp
  • Libraries/LibWeb/HTML/HTMLEmbedElement.h
  • Libraries/LibWeb/HTML/HTMLObjectElement.h
  • Libraries/LibWeb/HTML/HTMLCanvasElement.h
  • Libraries/LibWeb/HTML/HTMLBRElement.cpp
  • Libraries/LibWeb/HTML/HTMLButtonElement.cpp
  • Libraries/LibWeb/HTML/HTMLImageElement.cpp
  • Libraries/LibWeb/HTML/HTMLMeterElement.h
  • Libraries/LibWeb/HTML/HTMLAudioElement.h
  • Libraries/LibWeb/HTML/HTMLElement.h
  • Libraries/LibWeb/SVG/SVGElement.h
  • Libraries/LibWeb/HTML/HTMLIFrameElement.h
  • Libraries/LibWeb/HTML/HTMLProgressElement.cpp
  • Libraries/LibWeb/HTML/HTMLProgressElement.h
  • Libraries/LibWeb/HTML/HTMLMeterElement.cpp
  • Libraries/LibWeb/DOM/Element.h
  • Libraries/LibWeb/HTML/HTMLSelectElement.h
  • Libraries/LibWeb/HTML/HTMLImageElement.h
  • Libraries/LibWeb/HTML/HTMLMediaElement.h
  • Libraries/LibWeb/HTML/HTMLBRElement.h
  • Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp
  • Libraries/LibWeb/HTML/HTMLFrameSetElement.h
  • Libraries/LibWeb/HTML/HTMLButtonElement.h
  • Libraries/LibWeb/HTML/HTMLElement.cpp
  • Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
  • Libraries/LibWeb/HTML/HTMLObjectElement.cpp
  • Libraries/LibWeb/HTML/HTMLTextAreaElement.h
  • Libraries/LibWeb/SVG/SVGSymbolElement.h
  • Libraries/LibWeb/HTML/HTMLInputElement.cpp
  • Libraries/LibWeb/HTML/HTMLSelectElement.cpp
  • Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
  • Libraries/LibWeb/HTML/HTMLTableElement.cpp
  • Libraries/LibWeb/HTML/HTMLAudioElement.cpp
  • Libraries/LibWeb/HTML/HTMLInputElement.h
  • Libraries/LibWeb/HTML/HTMLMediaElement.cpp
  • Libraries/LibWeb/HTML/HTMLEmbedElement.cpp
  • Libraries/LibWeb/SVG/SVGSymbolElement.cpp
  • Libraries/LibWeb/HTML/HTMLTableElement.h
  • Libraries/LibWeb/SVG/SVGElement.cpp

📝 Walkthrough

Walkthrough

The change moves element-specific computed-style adjustments into Rust and shared StyleComputer helpers. Adjustments now run during normal, pseudo-element, and post-animation style computation. Element-level adjustment overrides and related tests were updated.

Changes

Element style adjustment pipeline

Layer / File(s) Summary
Rust adjustment computation
Libraries/LibWeb/Rust/src/css/style_compute.rs
Rust now returns combined box-type and element-style adjustments. Element-specific rules use the transformed display and text alignment.
StyleComputer integration and validation
Libraries/LibWeb/CSS/StyleComputer.*, Tests/LibWeb/Text/input/css/animated-post-compute-adjustments.html, Tests/LibWeb/Text/expected/css/animated-post-compute-adjustments.txt
StyleComputer applies adjustments during normal, pseudo-element, and animated computation. Tests cover line height, position, text alignment, and display.
Element-specific hook removal
Libraries/LibWeb/DOM/Element.h, Libraries/LibWeb/HTML/*, Libraries/LibWeb/SVG/*
The adjust_computed_style interface and HTML/SVG overrides were removed. Their adjustment rules are handled by the shared pipeline.

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

Sequence Diagram(s)

sequenceDiagram
  participant StyleComputer
  participant ComputedProperties
  participant rust_adjust_element_style
  StyleComputer->>ComputedProperties: collect animation results
  StyleComputer->>rust_adjust_element_style: compute animated element adjustments
  rust_adjust_element_style-->>StyleComputer: return combined adjustments
  StyleComputer->>ComputedProperties: apply adjusted style properties
Loading

Possibly related PRs

Suggested reviewers: awesomekling

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly matches the changes by removing Element overrides and using combined Rust FFI adjustments for animated styles.
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.

@kalenikaliaksandr
kalenikaliaksandr merged commit bf6c4c7 into LadybirdBrowser:master Aug 6, 2026
14 of 15 checks passed
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