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.
It's a little strange that we have `content_box_request`, `content_boxes_request`, and so forth, instead of an enum specifying which one script wants. Does it have to be done this way?