Auto merge of #9722 - mbrubeck:slow-selector, r=nox

Dirty elements whose selectors are affected by sibling changes

This fixes incremental layout of nodes that match pseudo-class selectors such as :first-child, :nth-child, :last-child, :first-of-type, etc.  Fixes #8191 and other intermittent layout bugs.

This code is based on the following flags from Gecko:
https://hg.mozilla.org/mozilla-central/file/e1cf617a1f28/dom/base/nsINode.h#l134

Depends on servo/rust-selectors#71. r? @SimonSapin

There are a couple of TODO items in this commit, but I'd appreciate feedback on the general approach before I finish it up.  (Also, if someone who knows more than I do could give some advice about atomic orderings...)

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9722)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-02-24 18:55:39 +05:30
commit 438b3a444b
14 changed files with 145 additions and 47 deletions

View file

@ -1011,7 +1011,7 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1",
"script_traits 0.0.1",
"selectors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1619,7 +1619,7 @@ dependencies = [
"ref_slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"selectors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1670,7 +1670,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1884,7 +1884,7 @@ dependencies = [
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1904,7 +1904,7 @@ dependencies = [
"euclid 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"plugins 0.0.1",
"selectors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
"style_traits 0.0.1",
@ -1925,7 +1925,7 @@ dependencies = [
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2088,7 +2088,7 @@ dependencies = [
"plugins 0.0.1",
"rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",