Have ContentBox(es)Queries consult the flow tree

Instead of looking at the display tree, have ContentBox(es)Query consult
the flow tree. This allow optimizing away parts of the display tree
later. To do this we need to be more careful about how we send reflow
requests, only querying the flow tree when possible.

Fixes #3790.
Not at all. I reimplemented this using an enum and everything is much cleaner. Thanks for the suggestion!