aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-16 12:01:50 -0500
committerGitHub <noreply@github.com>2017-05-16 12:01:50 -0500
commita42df6dd30bb1e789ea109aceb7b4893e54bf45e (patch)
tree5fa250c313f3bd97e081d008abbee9f8ad515761
parent7f6b28e241e58944f1e11826094776446965ca64 (diff)
parent993cb6eb41a91959e19db862be011a8bb76277f5 (diff)
downloadservo-a42df6dd30bb1e789ea109aceb7b4893e54bf45e.tar.gz
servo-a42df6dd30bb1e789ea109aceb7b4893e54bf45e.zip
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 -->
-rw-r--r--components/style/gecko/selector_parser.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs
index bed3737db99..e46b8c489f5 100644
--- a/components/style/gecko/selector_parser.rs
+++ b/components/style/gecko/selector_parser.rs
@@ -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.