Improve block margin estimation function to account for not having a layout and for quirks mode.
Created attachment 152328 [details] Patch
Landed in r122639.