Document should not use confusingAndOftenMisusedAttached()

Switch all uses in Document.cpp of confusingAndOftenMisusedAttached()
to use the new DocumentLifecycle concept. This also switched away from
nulling out the RenderView on Document to indicate "destruction mode",
and now uses the Stopping state of Document which is much nicer and
means the render tree still has access to the root of the tree even
during teardown.

R=abarth@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@159188 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Fix the preferred logical widths code to work with spanning grid items

We implemented a simple algorithm to get the easy cases. The
algorithm was completely wrong for more complex cases though,
which was fine as the specification was completely silent on
how to compute these logical widths. This has been raised to
the working group in
http://lists.w3.org/Archives/Public/www-style/2013Oct/0054.html
No one objected after a week so we should be good to go.

BUG=234197

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

git-svn-id: svn://svn.chromium.org/blink/trunk@159189 bbb929c8-8fbe-4397-9dbb-9b2b20218538
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
Remove RandomNumber and RandomNumberSeed.

The classes are just shells, since we delegate to CryptographicallyRandomNumber
under the hood. And amusingingly, the one caller of randomNumber() incurs an
int -> float -> int conversion when all it wants is a random int.

The only caller of raw OS random APIs is inside fastMalloc() and specific to the
Mac port. It uses the Mac-specific arc4random(), which self-initializes. So the
removal of RandomNumberSeed does not affect anything in Blink either.

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

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