New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style: Use left-to-right indices in the invalidator. #18884
Conversation
r? @heycam |
Heads up! This PR modifies the following files:
|
@bors-servo try |
style: Use left-to-right indices in the invalidator. This will make easier to create external invalidations that don't point to a combinator, and also makes reasoning about the invalidator a bit easier. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18884) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
9fbf0cb
to
2819ba5
Compare
Rebased. @bors-servo try |
style: Use left-to-right indices in the invalidator. This will make easier to create external invalidations that don't point to a combinator, and also makes reasoning about the invalidator a bit easier. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18884) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for making selector indexes a bit easier to understand. :-)
components/selectors/parser.rs
Outdated
@@ -442,10 +442,9 @@ impl<Impl: SelectorImpl> Selector<Impl> { | |||
|
|||
/// Returns the combinator at index `index` (one-indexed from the right), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this now be "zero-indexed"?
components/selectors/parser.rs
Outdated
@@ -460,16 +459,24 @@ impl<Impl: SelectorImpl> Selector<Impl> { | |||
self.0.slice.iter() | |||
} | |||
|
|||
/// Returns the combinator at index `index` (one-indexed from the right), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "zero-indexed from the left"?
debug_assert!(!dependency.affects_later_siblings()); | ||
self.descendant_invalidations.push(Invalidation::new( | ||
dependency.selector.clone(), | ||
dependency.selector_offset, | ||
dependency.selector.len() - dependency.selector_offset + 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to Invalidation
's offset
field saying that it's a parse order offset?
This will make easier to create external invalidations, and also makes reasoning about the invalidator a bit easier.
2819ba5
to
f1cc225
Compare
@bors-servo r=heycam |
📌 Commit f1cc225 has been approved by |
style: Use left-to-right indices in the invalidator. This will make easier to create external invalidations that don't point to a combinator, and also makes reasoning about the invalidator a bit easier. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18884) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This will make easier to create external invalidations that don't point to a combinator,
and also makes reasoning about the invalidator a bit easier.
This change is