Closed Bug 1792416 Opened 2 years ago Closed 2 years ago

Elements with content-visibility: hidden in the top layer should not have boxes

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: mrobinson, Assigned: mrobinson)

References

Details

Attachments

(2 files)

https://w3c.github.io/csswg-drafts/css-contain-2/#cv-notes says:

If an element has an ancestor with content-visibility: hidden, and it is placed in the top
layer, it does not generate any boxes, as if it were display: none.
Note: An element skipped for other reasons, such as having a content-visibility: auto
ancestor, will still generate boxes as normal, and might thus become un-skipped.

This means we need to track when these kind of elements are added to the top layer and ensure they do not have a box.

When an element is in the top layer and an ancestor has
content-visibility: hidden make sure that element does not generate
boxes. There are three cases to handle here:

  1. An element is added to the top layer and already has an ancestor with
    content-visibility: hidden: in that case we add a flag to the
    element which prevents the creation of a frame. This should work
    because addition to the top layer always triggers reframing.
  2. An element is already in the top layer and an ancestor is restyled to
    have content-visibility: hidden: for this case, every time that a
    content-visibility: hidden frame is created check whether it is a
    flat tree ancestor of a top layer element. If it is, add the flag to
    the element and mark that element for reframing.
  3. An element is disabled in the top layer due to a content-visibility: hidden ancestor: whenever a content-visibility: hidden frame is
    destroyed queue a post-reflow task on the PresShell that verifies
    that every disabled top layer element is still disabled.

This change adds some tests to verify various aspects of this. They are
not marked tentative, because this wording is already part of the draft
specification.

The CSS Contain specification says that descendants of elements with
content-visibility: hidden that are in the top layer should not
generate boxes. Implementing this would lead to many open questions that
are currently not answered by the specification. While these questions
are hashed out in the specification, ensure that these top layer
elements do not generate display list items.

Pushed by mrobinson@igalia.com:
https://hg.mozilla.org/integration/autoland/rev/206d86caac20
Do not display top layer elements that are skipped contents r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36439 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: