Commit 6854f589 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Disallow backdrop-filter on the root element of the main page.

There is nothing behind the root element stacking context in the same
frame, and it's also important not to blend with any white behind
the root frame.

This is also causing a problem at the moment in Chromium because
to implement the semantics in [1] for filters of the root element group
applying after drawing and before compositing into the root group,
we now paint two PaintChunks for the LayoutView [2]. The second such
PaintChunk has a PropertyTreeState that includes filters (including
at the moment backdrop-filter). But since it's not composited the code
fails to work correctly.

This CL does not apply to iframes, because they do have a well-defined
backdrop from their containing frame's contents.

[1] https://drafts.fxtf.org/compositing/#pagebackdrop
[2] https://chromium-review.googlesource.com/c/chromium/src/+/1979258

Bug: 1061802

Change-Id: I9212213d1787647b171fbefcf18ef80d51b74a2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2109318Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751883}
parent 04b4c62e
...@@ -639,6 +639,12 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state, ...@@ -639,6 +639,12 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state,
style.SetDisplayLayoutCustomParentName( style.SetDisplayLayoutCustomParentName(
layout_parent_style.DisplayLayoutCustomName()); layout_parent_style.DisplayLayoutCustomName());
} }
bool is_in_main_frame = element && element->GetDocument().IsInMainFrame();
// The root element of the main frame has no backdrop, so don't allow
// it to have a backdrop filter either.
if (is_document_element && is_in_main_frame && style.HasBackdropFilter())
style.MutableBackdropFilter().clear();
} else { } else {
AdjustStyleForFirstLetter(style); AdjustStyleForFirstLetter(style);
} }
......
<!doctype HTML>
<meta charset="utf-8">
<title>backdrop-filter: no effect on the root element</title>
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/filter-effects-2/#BackdropFilterProperty">
<style>
html {
background: green;
}
</style>
Test
<!doctype HTML>
<meta charset="utf-8">
<title>backdrop-filter: no effect on the root element</title>
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/filter-effects-2/#BackdropFilterProperty">
<link rel="match" href="backdrop-filter-root-element-ref.html">
<style>
html {
background: green;
backdrop-filter: invert(1);
}
</style>
Test
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment