Reverse style resolution to avoid N^2 walk when building the render tree

Blink resolves style by walking each element from first child to last, but
when we go to insert their renderer, we look for the next renderer to insert
before. On the initial style resolve, this means we'll walk the entire DOM
tree trying to find the right renderer to insert before leading to an N^2
loop over the DOM on load.

This could be fixed by changing the semantics by which we insert renderers
(insert after instead of insert before). Instead, here I reverse the order
we resolve style. This should ensure that in the common case, we'll find
the renderer to insert before immediately.

Testing this change uncovered a bug in checkForSiblingStyleChanges whereby
we'd invalidate the wrong sibling in certain cases for changed children
of elements with directly adjacent sibling selectors. I fixed this
and added a simplified test (acid3 caught it with this change, but it's
a nightmare to debug).

We still attempt to process whitespace text nodes in DOM order by keeping a
stack-allocated vector of whitespace children we postpone recalcing style on
until the end. If we go past that limit, we process them and continue going.
Also removing the didReattach check to force whitespace reattachment. This
causes some whitespace layout tests results to change, but doesn't appear
to break anything.

BUG=288225,245478
R=esprehn@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/24350009

git-svn-id: svn://svn.chromium.org/blink/trunk@158839 bbb929c8-8fbe-4397-9dbb-9b2b20218538