Repository navigation
Mark elements whose children are affected by "slow" selectors - #71
Conversation
| const HAS_SLOW_SELECTOR = 0x01, | ||
| #[doc = "When a child is added or removed from this element, any later children must be"] | ||
| #[doc = "restyled, because they may match selectors such as :nth-child."] | ||
| const HAS_SLOW_SELECTOR_LATER_SIBLINGS = 0x02, |
There was a problem hiding this comment.
Please add an exhaustive list of which pseudo-classes set which flags. Is it all child-indexed and type-child-indexed pseudos? (See table of contents of https://drafts.csswg.org/selectors/) If there’s a flag for later siblings, why not one for earlier siblings with :nth-last-child()?
There was a problem hiding this comment.
Please add an exhaustive list of which pseudo-classes set which flags.
Okay, will do.
Is it all child-indexed and type-child-indexed pseudos?
Yes.
If there’s a flag for later siblings, why not one for earlier siblings with
:nth-last-child()?
There could be. Gecko doesn't have one, possibly because it was not a big enough win to warrant an additional flag. (It only helps when there is an :nth-last-child selector and siblings are inserted at the start or middle of the container—both of which are probably quite rare compared to the other cases here.)
There was a problem hiding this comment.
Oh, ok, I didn’t realize this was an optimization and not necessary for correctness.
There was a problem hiding this comment.
Well, this patch as a whole is necessary for correctness when using incremental layout (which is an optimization).
But using HAS_SLOW_SELECTOR for all of these cases would be sufficient for correctness, since it would always restyle all the siblings. The other flags are special cases where we can get away with restyling fewer siblings. So adding more special cases is purely an optimization.
This required by the fix for servo/servo#8191.
9c76d08 to
2b53d2e
Compare
|
Added a complete listing of selectors to the ElementFlags doc comments (addresses review comments above). |
|
@bors-servo r+ |
|
📌 Commit 2b53d2e has been approved by |
Mark elements whose children are affected by "slow" selectors This required by the fix for servo/servo#8191. r? @SimonSapin <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/rust-selectors/71) <!-- Reviewable:end -->
|
☀️ Test successful - travis |
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 -->
…ibling changes (from mbrubeck:slow-selector); r=nox 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...) Source-Repo: https://github.com/servo/servo Source-Revision: 438b3a444b40ea85e53be0bd1c4689680d577727 UltraBlame original commit: 20374b8c2cf16fcf4bd4be7f07118e95df84b6fe
…ibling changes (from mbrubeck:slow-selector); r=nox 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...) Source-Repo: https://github.com/servo/servo Source-Revision: 438b3a444b40ea85e53be0bd1c4689680d577727 UltraBlame original commit: 20374b8c2cf16fcf4bd4be7f07118e95df84b6fe
…ibling changes (from mbrubeck:slow-selector); r=nox 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...) Source-Repo: https://github.com/servo/servo Source-Revision: 438b3a444b40ea85e53be0bd1c4689680d577727 UltraBlame original commit: 20374b8c2cf16fcf4bd4be7f07118e95df84b6fe
This required by the fix for servo/servo#8191. r? @SimonSapin