Ensure CSS :target is set before calling the load event.

I am working on https://crbug.com/831155. It causes the frame to commit
a navigation more quickly. As a result, some tests that are relying on
how things are scheduled in blink are failling.

This CL makes sure at least two WPT tests keep working:
* external/wpt/dom/nodes/Element-matches.html
* external/wpt/dom/nodes/Element-webkitMatchesSelector.html

What happens in theses tests:
In the frame.load event, document.querySelector(":target") is used.
When an URL has an anchor, like in http://example.com#anchor, it returns
the element with the "anchor" ID.

The problem is that blink::Document::SetCSSTarget(Element*) may
currently be called after the 'load' event is executed.

The solution is simply to exchange two lines:
1) The one that will maybe send the 'load' event.
   frame_->GetDocument()->CheckCompleted();
2) The one that will call Document::SetCSSTarget()
   ProcessFragment([...])

This CL is similar to:
https://chromium-review.googlesource.com/c/chromium/src/+/1042191
It is the same solutioa to a different problem.

This test is disabled because of http://crbug.com/843192
* svg/animations/viewspec-checkaspectparams.html

Bug: 831155, 843523, 843192
Change-Id: I8ecedd212d3ce30d252ec9c1b1f22214f7bc012a
Reviewed-on: https://chromium-review.googlesource.com/1057507
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562235}
2 files changed