Account for getBoundingClientRect returning read-only elements.

Fixes issue #4582, at least for case when document scrolls before loading.