Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9e45d72ed9ea3871ccc4d9a4d9ae93d7a5debe38
https://github.com/WebKit/WebKit/commit/9e45d72ed9ea3871ccc4d9a4d9ae93d7a5debe38
Author: Kiet Ho <[email protected]>
Date: 2026-04-28 (Tue, 28 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
M
LayoutTests/http/tests/css/prefers-color-scheme-in-cross-origin-iframe-follows-system-preference-without-parent-color-scheme.html
A
LayoutTests/http/tests/css/prefers-color-scheme-in-nested-iframes-follows-system-preference-expected.txt
A
LayoutTests/http/tests/css/prefers-color-scheme-in-nested-iframes-follows-system-preference.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred-nested.sub-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred-nested.sub.html
M LayoutTests/platform/mac-site-isolation/TestExpectations
M Source/WebCore/css/query/MediaQueryFeatures.cpp
M Source/WebCore/page/Frame.cpp
M Source/WebCore/page/FrameView.h
M Source/WebCore/page/LocalFrameView.cpp
M Source/WebCore/page/LocalFrameView.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/RemoteFrameLayoutInfo.h
M Source/WebCore/page/RemoteFrameView.cpp
M Source/WebCore/page/RemoteFrameView.h
M Source/WebCore/rendering/RenderView.cpp
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Log Message:
-----------
[Site Isolation] prefers-color-scheme doesn't see color-scheme from parent
frames and above
rdar://172229372
https://bugs.webkit.org/show_bug.cgi?id=309611
Reviewed by Simon Fraser.
310465@main makes prefers-color-scheme follow the color scheme of the embedding
element,
if the document is embedded in an iframe. 310874@main adds a behavior to use
the system
appearance if the parent iframe doesn't explicitly set a color-scheme. This uses
ownerRenderer() to peek at the embedding element's style, and thus won't work
with Site
Isolation. This patch makes it work with Site Isolation by using
RemoteFrameLayoutInfo to
broadcast the info whether the embedding element's color scheme is explicitly
set or not.
This involves extending RemoteFrameLayoutInfo::ownerElementAppearance (renamed
from
useDarkAppearance) to store this info.
Additionally, this patch changes the logic of prefers-color-scheme to consider
ancestor
embedding elements if the immediate embedding element doesn't have an explicitly
set color-scheme, in the case of nested iframes. The preferred color scheme is
taken
from the nearest ancestor embedding element with an explicitly set color-scheme.
If none exists, it falls back to the system appearance.
Tests:
http/tests/css/prefers-color-scheme-in-nested-iframes-follows-system-preference.html
imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred-nested.sub.html
* LayoutTests/TestExpectations:
*
LayoutTests/http/tests/css/prefers-color-scheme-in-cross-origin-iframe-follows-system-preference-without-parent-color-scheme.html:
*
LayoutTests/http/tests/css/prefers-color-scheme-in-nested-iframes-follows-system-preference-expected.txt:
Added.
*
LayoutTests/http/tests/css/prefers-color-scheme-in-nested-iframes-follows-system-preference.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred-nested.sub-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred-nested.sub.html:
Added.
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WebCore/css/query/MediaQueryFeatures.cpp:
(WebCore::MQ::Features::frameOwnerElementAncestorsUseDarkAppearance):
(WebCore::MQ::Features::prefersColorSchemeFeatureSchema):
(WebCore::MQ::Features::frameUsesDarkAppearanceForPrefersColorScheme):
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::updateFrameTreeSyncData):
* Source/WebCore/page/FrameView.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::appearanceOfOwnerElementOfChildFrame const):
(WebCore::LocalFrameView::ownerElementOfChildFrameUsesDarkAppearance const):
Deleted.
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::syncLocalFrameInfoToRemote):
* Source/WebCore/page/RemoteFrameLayoutInfo.h:
* Source/WebCore/page/RemoteFrameView.cpp:
(WebCore::RemoteFrameView::appearanceOfOwnerElementOfChildFrame const):
(WebCore::RemoteFrameView::ownerElementOfChildFrameUsesDarkAppearance const):
Deleted.
* Source/WebCore/page/RemoteFrameView.h:
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::shouldPaintBaseBackground const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Canonical link: https://commits.webkit.org/312212@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications