aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/context.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-09-21 18:10:05 -0500
committerGitHub <noreply@github.com>2017-09-21 18:10:05 -0500
commitbe9c8ec07a0ca745adf1b412d32b3b32adec122c (patch)
tree9c279228e0b0b06e0f72c44c831ed6577dd8b28e /components/selectors/context.rs
parent83705a8fa8992a974b32acc6635c7dfeed1afa50 (diff)
parent438740b912b99ebacf3f5269b37be570cbdcaf7e (diff)
downloadservo-be9c8ec07a0ca745adf1b412d32b3b32adec122c.tar.gz
servo-be9c8ec07a0ca745adf1b412d32b3b32adec122c.zip
Auto merge of #18595 - bholley:nth_index_cache, r=emilio
Implement an nth-index cache https://bugzilla.mozilla.org/show_bug.cgi?id=1334730 <!-- 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/18595) <!-- Reviewable:end -->
Diffstat (limited to 'components/selectors/context.rs')
-rw-r--r--components/selectors/context.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/components/selectors/context.rs b/components/selectors/context.rs
index 46991d349ce..f0da3b14ef6 100644
--- a/components/selectors/context.rs
+++ b/components/selectors/context.rs
@@ -4,6 +4,7 @@
use attr::CaseSensitivity;
use bloom::BloomFilter;
+use nth_index_cache::NthIndexCache;
/// What kind of selector matching mode we should use.
///
@@ -69,12 +70,6 @@ impl QuirksMode {
}
}
-/// A cache to speed up matching of nth-index-like selectors.
-///
-/// NB: This is just a dummy type right now, it will be fleshed out in later patches.
-#[derive(Default)]
-pub struct NthIndexCache(usize);
-
/// Data associated with the matching process for a element. This context is
/// used across many selectors for an element, so it's not appropriate for
/// transient data that applies to only a single selector.
@@ -84,7 +79,7 @@ pub struct MatchingContext<'a> {
/// Input with the bloom filter used to fast-reject selectors.
pub bloom_filter: Option<&'a BloomFilter>,
/// An optional cache to speed up nth-index-like selectors.
- nth_index_cache: Option<&'a mut NthIndexCache>,
+ pub nth_index_cache: Option<&'a mut NthIndexCache>,
/// Input that controls how matching for links is handled.
pub visited_handling: VisitedHandlingMode,
/// Output that records whether we encountered a "relevant link" while