aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/style/selector_matching.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/style/selector_matching.rs')
-rw-r--r--src/components/style/selector_matching.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/components/style/selector_matching.rs b/src/components/style/selector_matching.rs
index 2a19ef5fc39..24692bd0876 100644
--- a/src/components/style/selector_matching.rs
+++ b/src/components/style/selector_matching.rs
@@ -9,6 +9,7 @@ use std::str;
use std::to_bytes;
use servo_util::namespace;
+use servo_util::sort;
use media_queries::{Device, Screen};
use node::{TElement, TNode};
@@ -147,13 +148,7 @@ impl SelectorMap {
});
// Sort only the rules we just added.
- matching_rules_list.mut_slice_from(init_len).sort_by(|a, b| {
- if a < b {
- Less
- } else {
- Greater
- }
- });
+ sort::quicksort(matching_rules_list.mut_slice_from(init_len));
}
fn get_matching_rules_from_hash<E:TElement,
@@ -495,6 +490,15 @@ impl Ord for Rule {
}
}
+impl Eq for Rule {
+ #[inline]
+ fn eq(&self, other: &Rule) -> bool {
+ let this_rank = (self.specificity, self.source_order);
+ let other_rank = (other.specificity, other.source_order);
+ this_rank == other_rank
+ }
+}
+
fn matches_compound_selector<E:TElement,N:TNode<E>>(selector: &CompoundSelector, element: &N)
-> bool {
if !selector.simple_selectors.iter().all(|simple_selector| {