Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5cf67c9b881a3c43703a015ba095b2f342775e85
      
https://github.com/WebKit/WebKit/commit/5cf67c9b881a3c43703a015ba095b2f342775e85
  Author: Kiet Ho <[email protected]>
  Date:   2026-03-09 (Mon, 09 Mar 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-001.sub-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-001.sub.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-002.sub-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-002.sub.html
    R 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin.sub-expected.html
    R 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin.sub.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/support/light-frame.html
    M LayoutTests/platform/glib/TestExpectations
    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] Synchronize useDarkAppearance of child frame's owner element
rdar://157145568
https://bugs.webkit.org/show_bug.cgi?id=309098

Reviewed by Ryosuke Niwa.

CSS Color Adjustment Module Level 1 [1] dictates that if the used color scheme 
of the
child frame's owner element is different than the used color scheme of the 
child frame,
the background of the child frame must be opaque and not transparent [2]:

> In order to preserve expected color contrasts, in the case of embedded 
> documents typically
rendered over a transparent canvas (such as provided via an HTML iframe 
element), if the used
color scheme of the element and the used color scheme of the embedded 
document’s root element
do not match, then the UA must use an opaque canvas of the Canvas color 
appropriate to the
embedded document’s used color scheme instead of a transparent canvas.

This was implemented in 241325@main by checking useDarkAppearance of the child 
frame's owner
renderer. When Site Isolation is enabled and the child frame is cross-origin 
with the main frame,
this information isn't available, since the main frame's render tree (which 
contains the child
frame's owner renderer) is in a different process from the child frame process, 
therefore the
child frame can't check for this and draw the background opaque.

Fix this by synchronizing useDarkAppearance of the child frame's owner renderer 
using
RemoteFrameLayoutInfo, so that it's available in other processes too. Then the 
child frame's
process can access this info and make decision about drawing opaque background.

[1]: https://drafts.csswg.org/css-color-adjust/
[2]: 
https://drafts.csswg.org/css-color-adjust/#:~:text=In%20order%20to%20preserve%20expected%20color%20contrasts

Test: 
imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-002.sub.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-001.sub-expected.html:
 Renamed from 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin.sub-expected.html.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-001.sub.html:
 Renamed from 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin.sub.html.
    - Change the iframe domain to a different TLD+1. WebKit site isolation 
considers a frame
      cross-origin only if its TLD+1 is different.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-002.sub-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-background-mismatch-opaque-cross-origin-002.sub.html:
 Added.
    - Add a new test, similar to 
color-scheme-iframe-background-mismatch-opaque-cross-origin-001.sub.html,
      but the main page is dark color-scheme, and child frame is light 
color-scheme.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-color-adjust/rendering/dark-color-scheme/support/light-frame.html:
 Added.
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/page/Frame.cpp:
* Source/WebCore/page/FrameView.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::ownerElementOfChildFrameUsesDarkAppearance const):
* 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::ownerElementOfChildFrameUsesDarkAppearance const):
* 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/308950@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to