We already excluded most nodes in a visibility: hidden or inert subtree. However, we previously checked this only on the frame of the node itself, and since display: contents nodes don't have a frame, they weren't excluded. We now check ancestor frames of display: contents nodes for visibility: hidden and inert, just as we already did for content-visibility: hidden. Differential Revision: https://phabricator.services.mozilla.com/D301484