#40578 adds a check for video elements, but there are other replaced element types: https://html.spec.whatwg.org/multipage/rendering.html#replaced-elements . #40693 is related to this as well. I'd like to introduce a is_replaced_content method that can encapsulate any special conditions for particular element types.
This is tested by ./mach test-wpt /css/css-pseudo/pseudo-replaced-elements.html.