diff options
author | Ting-Yu Lin <tlin@mozilla.com> | 2017-08-15 20:35:08 +0800 |
---|---|---|
committer | Ting-Yu Lin <tlin@mozilla.com> | 2017-08-16 14:25:01 +0800 |
commit | 0e82ca1d3a540ba96f01e8647d314dfd8d05cc47 (patch) | |
tree | b5dd4569f3ca4db9e9825268ce49cf62171bb93d /components/selectors/tree.rs | |
parent | dc654c991238305d6fc0524173c85f40d7b9e90f (diff) | |
download | servo-0e82ca1d3a540ba96f01e8647d314dfd8d05cc47.tar.gz servo-0e82ca1d3a540ba96f01e8647d314dfd8d05cc47.zip |
style: Skip matching :nth-child if element is the root of anonymous subtree
This implement the logic in Gecko's nsNthIndexCache::GetNthIndex().
MozReview-Commit-ID: 8lzK9iIbfzo
Diffstat (limited to 'components/selectors/tree.rs')
-rw-r--r-- | components/selectors/tree.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs index 7827dc6bbe6..23238237b2f 100644 --- a/components/selectors/tree.rs +++ b/components/selectors/tree.rs @@ -86,6 +86,12 @@ pub trait Element: Sized + Debug { /// if the parent node is a `DocumentFragment`. fn is_root(&self) -> bool; + /// Returns whether this element should ignore matching nth child + /// selector. + fn ignores_nth_child_selectors(&self) -> bool { + false + } + /// Return true if we want to stop lookup ancestor of the current /// element while matching complex selectors with descendant/child /// combinator. |