[SVG] Resources should be laid out in dependecy order.

We're currently laying out resources in tree order, while they are
(conceptually) forming a DAG - and this disconnect results in
complicated logic and an extra layout pass attempting to re-validate
nodes that might have been invalidated by the resource layout. This is
broken in (at least) two ways:

  * two passes are not guaranteed to be enough, we could need an
    arbitrary number of passes to stabilize the tree.
  * the re-layout logic hangs off RenderSVGRoot, and falls apart when
    multiple root nodes are present (html doc with multiple svg fragments).

Recently introduced asserts are testing for render tree nodes which are
still marked for layout at paint time, and are catching several invariant
violations due to the above.

To address this problem, we should lay out resources in transitive
dependency order (where node A depends on resource B if it references
it directly: <rect id="a" filter="url(#b)"/>). Turns out this is not as
complicated as it sounds, and we can avoid building an explicit resources
DAG because we already have the sparse version: each node tracks the list
of resources it is referencing.

So before laying out a node, we should ensure that its resources are laid
out first. Applying this recursively, we are effectively traversing the
dependency DAG in the correct order.

(This relies on the assumption that a resource' layout does not depend on
its in-tree parent layout - which should be the case as resources only
make sense in the context of their clients).

The CL also removes the RenderSVGRoot re-layout logic added in
http://trac.webkit.org/changeset/111601 as it is no longer needed: a
resource is now guaranteed to be laid out before any of its clients.

BUG=282925,294237,294238
R=pdr@chromium.org,schenney@chromium.org,dschulze@chromium.org,ojan@chromium.org,eseidel@chromium.org

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

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