Auto merge of #16875 - bzbarsky:dir-no-revalidation, r=emilio

Don't require style sharing cache invalidation for :dir

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because we have no way to test performance optimizations, sadly.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/16875)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-16 12:01:50 -05:00 committed by GitHub
commit a42df6dd30

View file

@ -159,8 +159,12 @@ impl NonTSPseudoClass {
/// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
pub fn needs_cache_revalidation(&self) -> bool {
// :dir() depends on state only, but doesn't use state_flag because its
// semantics don't quite match. Nevertheless, it doesn't need cache
// revalidation, because we already compare states for elements and
// candidates.
self.state_flag().is_empty() &&
!matches!(*self, NonTSPseudoClass::MozAny(_))
!matches!(*self, NonTSPseudoClass::MozAny(_) | NonTSPseudoClass::Dir(_))
}
/// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.