Only other thing it could credibly return was Document. We can exclude it from the composed tree and avoid a lot of casting.
Created attachment 263469 [details] patch
Comment on attachment 263469 [details] patch r=me
Created attachment 275507 [details] for landing
https://trac.webkit.org/r198992