Fix n^2 walk inside NodeRenderingContext from r159037

In r159037 I made us enter Element::attach() without detaching but this
means that NodeRenderingContext::nextRenderer() becomes n^2 since the
n^2 avoidance code was based on looking at attached(). Instead it should
use needsAttach().

BUG=305411
R=ojan@chromium.org

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

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