Skip to content
This repository was archived by the owner on May 28, 2024. It is now read-only.

Mark elements whose children are affected by "slow" selectors - #71

Merged
bors-servo merged 1 commit into
servo:masterfrom
mbrubeck:slow_selector
Feb 23, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
mbrubeck:slow_selector

Conversation

@mbrubeck

Copy link
Copy Markdown

This required by the fix for servo/servo#8191. r? @SimonSapin

Review on Reviewable

Comment thread src/matching.rs
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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok, I didn’t realize this was an optimization and not necessary for correctness.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mbrubeck

Copy link
Copy Markdown
Author

Added a complete listing of selectors to the ElementFlags doc comments (addresses review comments above).

@SimonSapin

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown

📌 Commit 2b53d2e has been approved by SimonSapin

@bors-servo

Copy link
Copy Markdown

⌛ Testing commit 2b53d2e with merge daf0684...

bors-servo pushed a commit that referenced this pull request Feb 23, 2016
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 -->
@bors-servo

Copy link
Copy Markdown

☀️ Test successful - travis

@bors-servo
bors-servo merged commit 2b53d2e into servo:master Feb 23, 2016
@mbrubeck mbrubeck mentioned this pull request Feb 23, 2016
bors-servo pushed a commit to servo/servo that referenced this pull request Feb 24, 2016
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 -->
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants