LibWeb: Update inherited properties for elements without layout nodes#7400
LibWeb: Update inherited properties for elements without layout nodes#7400jmhunter83 wants to merge 2 commits intoLadybirdBrowser:masterfrom
Conversation
Previously, recompute_inherited_style() returned early when an element had no layout node. This caused a bug where descendants of display:none elements would retain stale inherited property values. When a parent element transitions from display:none to visible (e.g., theme toggle showing a different SVG icon), its descendants need their inherited properties updated before layout nodes are created. Without this update, properties like `fill: currentColor` would resolve to the old inherited `color` value instead of the new one. This fixes GitHub issue LadybirdBrowser#7204 where SVG icons with currentColor didn't update after CSS changes triggered by data-* attribute modifications. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Can you add a test for this so we can avoid regressions? Probably a modification of the test case from #7204. |
This test verifies that elements with display:none correctly receive updated inherited property values when they become visible. It tests the fix for GitHub issue LadybirdBrowser#7204 where SVG elements with currentColor would retain stale inherited color values after theme changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Regression Test AddedPer request, I've added a regression test for this fix: Test file: What the test verifies:
Test scenario:Why this catches the bug:Before the fix, The test passes with the fix applied. |
Screen.Recording.2026-01-09.at.09.57.14.mov |
CI Failure AnalysisThe failing job Leak locations (from ASan):
This PR modifies:
The leaks are in the post-quantum cryptography (MLKEM) code path, which this PR does not touch. This appears to be a pre-existing issue or flaky test in the GNU sanitizer configuration. Could a maintainer please re-run the failed job? All other CI jobs pass. |
|
Changes look fine to me, though you need to rebase on master - the Windows CI job got renamed and it's required for merging. Unrelated to the changes themselves, please don't feel the need to comment with everything that Claude says. It tends to be overly verbose, and makes the whole thing feel like I'm just talking to Claude with extra steps. |
|
for the changes, i could see why you say that. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! |
|
This pull request has been closed because it has not had recent activity. Feel free to open a new pull request if you wish to still contribute these changes. Thank you for your contributions! |
Summary
display:noneelements retaining stale inherited property valuesrecompute_inherited_style()now updates computed properties even for elements without layout nodesapply_style()when layout node existsPreviously,
recompute_inherited_style()returned early when an element had no layout node. This caused descendants ofdisplay:noneelements to retain stale inherited property values. When a parent element transitions fromdisplay:noneto visible (e.g., theme toggle showing a different SVG icon), its descendants need their inherited properties updated before layout nodes are created. Without this update, properties likefill: currentColorwould resolve to the old inheritedcolorvalue instead of the new one.Fixes #7204
Test plan
fill: currentColornow correctly update when toggling themes viadata-*attributesTests/LibWeb/Text/input/SVG/svg-currentcolor-inherited-update.html🤖 Generated with Claude Code