RESOLVED FIXED 283140
Switching light/dark modes doesn't update the base background color if the root has `color` set explicitly
https://bugs.webkit.org/show_bug.cgi?id=283140
Summary Switching light/dark modes doesn't update the base background color if the ro...
Simon Fraser (smfr)
Reported 2024-11-14 15:19:31 PST
Created attachment 473231 [details] Test case Load the attached test file in MiniBrowser. Switch between light and dark modes either via Web Inspector, or by changing system settings; the page background color should update, but does not. For some reason, the bug does not reproduce in Safari.
Attachments
Test case (295 bytes, text/html)
2024-11-14 15:19 PST, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2024-11-14 15:22:36 PST
The issue here is that the base background color, which is set via `LocalFrameView::updateBackgroundRecursively()`, isn't really represented in the render tree, so there's no render that sees the style change and knows to trigger `updateBackgroundRecursively`. `RenderBox::styleDidChange()` does call `frameView().recalculateBaseBackgroundColor()` when it sees a style change for the document element or body renderers, but on light/dark mode switches, that is triggered by chance because the `color` property (which is inherited) changes, and we get a RepaintForText diff. If the content sets an explicit color on the root, as the test case does, then the bug occurs.
Radar WebKit Bug Importer
Comment 2 2024-11-14 15:53:53 PST
Simon Fraser (smfr)
Comment 3 2024-11-14 16:53:31 PST
EWS
Comment 4 2024-11-19 19:20:56 PST
Committed 286833@main (060793dcd586): <https://commits.webkit.org/286833@main> Reviewed commits have been landed. Closing PR #36673 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.