mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
style: when iterating over a selector to find a bucket, choose the rightmost
This restores the pre-regression behavior by choosing the later class in cases where folks use stuff like `.foo.bar`. This matches other browsers too. Differential Revision: https://phabricator.services.mozilla.com/D177398
This commit is contained in:
parent
303ea410e2
commit
9ac97dd8ad
1 changed files with 8 additions and 1 deletions
|
@ -684,6 +684,11 @@ impl<'a> Bucket<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn more_or_equally_specific_than(&self, other: &Self) -> bool {
|
||||
self.specificity() >= other.specificity()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn more_specific_than(&self, other: &Self) -> bool {
|
||||
self.specificity() > other.specificity()
|
||||
|
@ -787,7 +792,9 @@ fn find_bucket<'a>(
|
|||
loop {
|
||||
for ss in &mut iter {
|
||||
let new_bucket = specific_bucket_for(ss, disjoint_buckets, bucket_attributes);
|
||||
if new_bucket.more_specific_than(¤t_bucket) {
|
||||
// NOTE: When presented with the choice of multiple specific selectors, use the
|
||||
// rightmost, on the assumption that that's less common, see bug 1829540.
|
||||
if new_bucket.more_or_equally_specific_than(¤t_bucket) {
|
||||
current_bucket = new_bucket;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue