Closed Bug 1767262 Opened 5 months ago Closed 27 days ago

Lazily layout content that is hidden via `content-visibility: hidden`

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: mrobinson, Assigned: mrobinson)

References

Details

Attachments

(1 file)

The containment specification [1] says:

When an element skips its contents, the user agent must change the used value of the contain property so as to turn on layout containment, style containment, paint containment, and size containment. Further, its contents (the flat tree descendants of the element, including both text and elements, or the replaced content of a replaced element) are not painted (as if they had visibility: hidden) and do not respond to hit-testing (as if they had pointer-events: none), and to a large extent do not update their styles at all unless explicitly requested by script (see § 4.3 Restrictions and Clarifications for details).

The user agent should additionally avoid as much layout/rendering work as possible for skipped contents; the combination of heavy containment and making the contents invisible and untouchable enables heavy optimizations. If rendering work is done at some point, the user-agent should retain the previously computed layout state if possible, to allow the skipped contents to be displayed quickly at a later moment.

  1. https://drafts.csswg.org/css-contain/#cv-notes

The idea of this bug is that unless script specifically asks for the size of content that is hidden, we can avoid laying out that content.

Assignee: nobody → mrobinson
Attachment #9275831 - Attachment description: WIP: Bug 1767262 - Lazily layout content that is hidden via `content-visibility: hidden` → Bug 1767262 - Lazily layout content that is hidden via `content-visibility: hidden` r=emilio
Status: NEW → ASSIGNED

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody → mrobinson
Status: NEW → ASSIGNED
Pushed by mrobinson@igalia.com:
https://hg.mozilla.org/integration/autoland/rev/7538d23ee88e
Lazily layout content that is hidden via `content-visibility: hidden` r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/35472 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Pushed by mrobinson@igalia.com:
https://hg.mozilla.org/integration/autoland/rev/5a4a5749f8dc
Lazily layout content that is hidden via `content-visibility: hidden` r=emilio
Upstream PR was closed without merging
Pushed by mrobinson@igalia.com:
https://hg.mozilla.org/integration/autoland/rev/f67c8298a104
Lazily layout content that is hidden via `content-visibility: hidden` r=emilio

Backed out changeset f67c8298a104 (bug 1767262) for causing wpt assertion failures in layout/base/PresShell.cpp

Backout link: https://hg.mozilla.org/integration/autoland/rev/c4bac60f5dc5e2ebc5db221ead691b329701aef3

Push with failures

Failure log

Upstream PR was closed without merging

It seems that the problem here is an assertion failure. When forcing the layout of hidden content, layout requests are flushed. These layout requests can, in turn, trigger queries which force the layout of hidden content. We need to take this into account in the code. I've uploaded a new version of the change which does this.

Flags: needinfo?(mrobinson)
Pushed by mrobinson@igalia.com:
https://hg.mozilla.org/integration/autoland/rev/a02e1198c61e
Lazily layout content that is hidden via `content-visibility: hidden` r=emilio
Status: ASSIGNED → RESOLVED
Closed: 27 days ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.