[Site Isolation] prefers-color-scheme doesn't see color-scheme from parent frames and above#62786
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash b40b4bf) Details
|
b40b4bf to
88f2c5e
Compare
Collaborator
|
EWS run on previous version of this PR (hash 88f2c5e) Details
|
88f2c5e to
692adb1
Compare
Collaborator
|
EWS run on previous version of this PR (hash 692adb1) Details
|
692adb1 to
85c81e2
Compare
Collaborator
|
EWS run on previous version of this PR (hash 85c81e2) Details
|
smfr
approved these changes
Apr 23, 2026
85c81e2 to
82c17ab
Compare
Collaborator
|
EWS run on current version of this PR (hash 82c17ab) Details |
…arent 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
82c17ab to
9e45d72
Compare
Collaborator
|
Committed 312212@main (9e45d72): https://commits.webkit.org/312212@main Reviewed commits have been landed. Closing PR #62786 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 ios-apple
9e45d72
82c17ab