I'd rather you didn't compute this unless boundDir===BEFORE and you actually need the value.  In general, querying these properties can trigger layouts, so they can be expensive.

One of our assumptions is that elements have a non-decreasing Y coordinate, right? Is it possible to use that assumption and just look at document order without considering any of the actual pixel coordinates?  I suspect that would be faster.  But I haven't read all the way through the multi-level algorithm, so I may be missing something.