Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2146a0ef0339f6ec61ed43d1004949256e1a6e1b
https://github.com/WebKit/WebKit/commit/2146a0ef0339f6ec61ed43d1004949256e1a6e1b
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-17 (Mon, 17 Aug 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-001-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-shadow-invalidation-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-shadow-invalidation.html
M Source/WebCore/dom/Element.cpp
Log Message:
-----------
getComputedStyle is stale in a display:none shadow tree after an inherited
change on the host
https://bugs.webkit.org/show_bug.cgi?id=321906
rdar://185079066
Reviewed by Antti Koivisto.
This path aligns WebKit with Gecko / Firefox and Blink / Chromium.
resetComputedStyle() only cleared the DOM subtree (descendantsOfType), so cached
computed style inside a shadow tree survived a recalc triggered by an inherited
property change on the host, and getComputedStyle() returned the stale value.
It is
observable on a display:none host because TreeResolver calls
resetComputedStyle() on
it and then stops, never descending into the subtree, so nothing else clears
the cache
or sets IsComputedStyleInvalidFlag. A light DOM child of the same host was
already
handled, being a DOM descendant the old walk reached, which is why only the
shadow
subtest of getComputedStyle-display-none-001.html was failing.
Walk composedTreeDescendants() instead, which matches how computed style
inherits, so
shadow trees are reset too; equivalent when no shadow tree exists. Unslotted
light DOM
children drop out of the walk, but they do not inherit through the host, so no
stale
inherited value can be left behind, and their own invalidation is still honored
because
composedTreeLineage() includes the element itself.
Test:
imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-shadow-invalidation.html
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-001-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-shadow-invalidation-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-display-none-shadow-invalidation.html:
Added.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::resetComputedStyle):
Canonical link: https://commits.webkit.org/319292@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications