Skip to content

Commit d23e04b

Browse files
keithamusnt1m
authored andcommitted
Make ::backdrop inherit from parent element
https://bugs.webkit.org/show_bug.cgi?id=263834 Reviewed by Tim Nguyen. StyleTreeResolver/RenterTreeUpdate explicitly checked for ::backdrop elements to remove their inheritance chain, per the spec at the time. whatwg/fullscreen#124 was created to query this and it was resolved that ::backdrop _should_ inherit. This commit addresses the change by removing the check in StyleTreeResolve to allow ::backdrop to inherit from its parent element, and altering the check in RenderTreeUpdate to call renderer.style() instead of renderer.view.style(). This aligns behaviour with the other browsers and WPT. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/dialog-backdrop-create.html: * Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: (WebCore::RenderTreeUpdater::GeneratedContent::updateBackdropRenderer): * Source/WebCore/style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::makeResolutionContextForPseudoElement): Canonical link: https://commits.webkit.org/270246@main
1 parent 133a726 commit d23e04b

File tree

4 files changed

+2
-9
lines changed

4 files changed

+2
-9
lines changed

Diff for: LayoutTests/TestExpectations

-4
Original file line numberDiff line numberDiff line change
@@ -6825,10 +6825,6 @@ webkit.org/b/263873 imported/w3c/web-platform-tests/scroll-animations/css/printi
68256825

68266826
webkit.org/b/263923 animations/transition-and-animation-2.html [ Failure Pass ]
68276827

6828-
# <dialog> element failures
6829-
6830-
webkit.org/b/263834 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/backdrop-inherits.html [ ImageOnlyFailure ]
6831-
68326828
# CloseWatcher related timeouts
68336829
imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-cancel-events.html [ Skip ]
68346830
imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-cancel-preventDefault.html [ Skip ]

Diff for: LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/dialog-backdrop-create.html

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
visibility: hidden;
1616
}
1717
dialog::backdrop {
18+
visibility: visible;
1819
display: none;
1920
background-color: green;
2021
}

Diff for: Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ void RenderTreeUpdater::GeneratedContent::updateBackdropRenderer(RenderElement&
200200
return;
201201
}
202202

203-
// ::backdrop does not inherit style, hence using the view style as parent style
204-
auto style = renderer.getCachedPseudoStyle(PseudoId::Backdrop, &renderer.view().style());
203+
auto style = renderer.getCachedPseudoStyle(PseudoId::Backdrop, &renderer.style());
205204
if (!style || style->display() == DisplayType::None) {
206205
destroyBackdropIfNeeded();
207206
return;

Diff for: Source/WebCore/style/StyleTreeResolver.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,6 @@ ResolutionContext TreeResolver::makeResolutionContextForPseudoElement(const Elem
515515
if (auto* firstLineStyle = elementUpdate.style->getCachedPseudoStyle(PseudoId::FirstLine))
516516
return firstLineStyle;
517517
}
518-
// ::backdrop does not inherit style, hence using the view style as parent style
519-
if (pseudoId == PseudoId::Backdrop)
520-
return &m_document.renderView()->style();
521518
return elementUpdate.style.get();
522519
};
523520

0 commit comments

Comments
 (0)