Slight refactoring of the layout task, to prevent creating a vector consisting of every DOM element on every reflow.

r? @pcwalton