Fix writingmode and direction inheriting for the Document

The old code spread logic out in multiple places that tries to have the
document inherit the writing mode of <html> and <html> inherit the
writing mode of <body>. This logic breaks in the face of lazy attaching
because the renderers are not necessarily there.

Instead, compute these values ahead of time in Document::recalcStyle
and avoid the <html> or <body> renderers needing to reach up and modify
the document's style. This way, the logic works even if we haven't created
the renderers yet, which is needed for lazyAttach.

The ElementResolveContext fixes a bug where we do the wrong thing if the 
documentElement lacks a renderer. The code in StyleResolver::pseudoStyleForElement
that resets bits on the document seems like it's just wrong. We should
only reset those bits when recalculating the documentElement's style.

Review URL: https://chromiumcodereview.appspot.com/23468006

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