This fixes a bug where partially loaded content is displayed to the user
before it should be, usually before stylesheets have loaded. This commit
supresses reflows until either FirstLoad or RefreshTick, whichever comes
first.
Unfortunately, hit_test and mouse_over did not do reflows if they were
necessary, and so by suppressing the initial spurious reflows, these
methods started to panic without a display list to query. This patch
also transforms these into queries similar to the other existing
queries.
script: Fix MouseOver handling
Now we only query for the topmost node, and apply the hover state to all
of the parent elements.
This fixes things like #9705, where the hover state was applied only to
the children.
This also makes us more conformant with other browsers in the case of
taking in account margins and paddings.
For example, prior to this PR, when your mouse was over the inner
element, in the bottom part, `hover` styles didn't apply to the parent.
```html
<style>
div {
padding: 10px;
margin: 10px;
height: 15px;
background: blue;
}
div:hover {
background: red;
}
</style>
<div>
<div></div>
</div>
```
Fixes#9705
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9715)
<!-- Reviewable:end -->
Table border-collapse fixes
Two related fixes for border-collapse:
* Fix border collapsing across table-row-group flows
This fixes the border-end calculation for table rows whose borders are collapsed with rows in different rowgroups. The border collapsing code now uses an iterator that yields all the rows as a flat sequence, regardless of how they are grouped in rowgroups. It gets rid of `TableRowGroupFlow::preliminary_collapsed_borders` which was never correct. (It was read but never written.)
This may fix#8120 but I'm not 100% certain. (I haven't managed to reproduce the intermittent failure locally, and my reduced test case still fails but in a different way.)
* Fix confusing `push_or_mutate` API
This fixes a bug when recalculating border collapsing for an existing table row. The bug was caused by using `push_or_mutate` which has no effect if there is already a value at the specified index.
The fix switches incorrect `push_or_mutate` calls to use `push_or_set` instead. It also renames `push_or_mutate` to `get_mut_or_push` which I think is a less-confusing name for this method.
r? @pcwalton
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9826)
<!-- Reviewable:end -->
Make Fetch Protocol Asynchronous
I'm working on making it possible to run Fetch Asynchronously, as required for some steps, such as Main Fetch. It looks like somebody has already laid some groundwork for that, with a AsyncFetchListener trait and two async fetch functions defined, which I'm building on top of.
So far, as a sort of proof of concept, I've written a test to asynchronously retrieve a fetch response, which uses a simple function to check if the fetch response is complete or not. I'd like to be checked if I'm on the right path, to see if I need to rework anything so far, and what my next step can be.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9753)
<!-- Reviewable:end -->
This fixes the border-end calculation for table rows whose borders are
collapsed with rows in different rowgroups. The border collapsing code now
uses an iterator that yields all the rows as a flat sequence, regardless of
how they are grouped in rowgroups. It gets rid of
`TableRowGroupFlow::preliminary_collapsed_borders` which was never correct.
(It was read but never written.)
This may fix#8120 but I'm not 100% certain. (I haven't managed to reproduce
the intermittent failure locally, and my reduced test case still fails but in
a different way.)
Fix the Node.replaceChild tests
That method first does "if node is a host-including inclusive ancestor of parent,
throw a HierarchyRequestError" and only then "if child’s parent is not parent,
throw a NotFoundError exception".
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9816)
<!-- Reviewable:end -->
That method first does "if node is a host-including inclusive ancestor of parent,
throw a HierarchyRequestError" and only then "if child’s parent is not parent,
throw a NotFoundError exception".
Fix step 14.2 of Range::ExtractContents
We need the last inclusive ancestor of start node that is not an inclusive ancestor
of end node, not the first that is an inclusive ancestor of it.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9799)
<!-- Reviewable:end -->
Fix the "get the parent" loop when dispatching event (fixes#6733)
The DOM specification says:
> A document's get the parent algorithm, given an event, returns null
> if event's type attribute value is "load" or document does not have
> a browsing context, and the document's associated Window object
> otherwise.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9734)
<!-- Reviewable:end -->
The DOM specification says:
A document's get the parent algorithm, given an event, returns null
if event's type attribute value is "load" or document does not have
a browsing context, and the document's associated Window object
otherwise.