Skip to content

Commit

Permalink
::backdrop is tree-abiding and should be allowed after ::slotted()
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265611

Reviewed by Tim Nguyen.

This patch is to align WebKIt with Blink / Chromium and Web-Specification [1]:

Merge: https://chromium-review.googlesource.com/c/chromium/src/+/4778566

[1] https://drafts.csswg.org/css-position-4/#backdrop

When ::backdrop was moved into css-position, it was made tree-abiding, which means
that '::slotted()::backdrop' should be allowed.

This PR also syncs WPT test from upstream:

Upstream Hash: web-platform-tests/wpt@3e2d8fc

* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(isTreeAbidingPseudoElement):
* LayoutTests/imported/w3c/web-platform-tests/css/css-position/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/css/css-position/backdrop-tree-abiding-slotted.html: Add Test Case
* LayoutTests/imported/w3c/web-platform-tests/css/css-position/backdrop-tree-abiding-slotted-expected.txt: Add Test Case Expectation

Canonical link: https://commits.webkit.org/271366@main
  • Loading branch information
Ahmad-S792 authored and nt1m committed Dec 1, 2023
1 parent 9ab66ea commit 01864fd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

PASS ::backdrop is tree-abiding and should be allowed after ::slotted()

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Position Test: ::backdrop is tree abiding, allowed after ::slotted</title>
<link rel="help" href="https://drafts.csswg.org/css-position-4/#backdrop">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#tree-abiding">
<link rel="help" href="https://drafts.csswg.org/css-scoping/#slotted-pseudo">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/declarative-shadow-dom-polyfill.js"></script>
<div>
<template shadowrootmode="open">
<style>
::slotted(dialog)::backdrop {
background-color: green;
}
</style>
<slot></slot>
</template>
<dialog id="target"></dialog>
</div>
<script>
const target = document.getElementById("target");
target.showModal();

test(() => {
assert_equals(getComputedStyle(target, "::backdrop").backgroundColor, "rgb(0, 128, 0)");
}, "::backdrop is tree-abiding and should be allowed after ::slotted()");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ None
------------------------------------------------------------------------
List of files:
/LayoutTests/imported/w3c/web-platform-tests/css/css-position/META.yml
/LayoutTests/imported/w3c/web-platform-tests/css/css-position/backdrop-tree-abiding-slotted.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-position/fixed-z-index-blend-expected.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-position/fixed-z-index-blend.html
/LayoutTests/imported/w3c/web-platform-tests/css/css-position/hypothetical-box-scroll-parent-expected.html
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/css/parser/CSSSelectorParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ static bool isTreeAbidingPseudoElement(CSSSelector::PseudoElementType pseudoElem
case CSSSelector::PseudoElementBefore:
case CSSSelector::PseudoElementAfter:
case CSSSelector::PseudoElementMarker:
case CSSSelector::PseudoElementBackdrop:
return true;
default:
return false;
Expand Down

0 comments on commit 01864fd

Please sign in to comment.