mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Make CascadeDataIter iterate from highest to lowest level.
This commit is contained in:
parent
89971910cf
commit
6bdb0abebf
1 changed files with 7 additions and 2 deletions
|
@ -1635,6 +1635,11 @@ impl CascadeData {
|
|||
}
|
||||
}
|
||||
|
||||
/// Iterator over `PerOriginCascadeData`, from highest level (user) to lowest
|
||||
/// (user agent).
|
||||
///
|
||||
/// We rely on this specific order for correctly looking up animations
|
||||
/// (prioritizing rules at higher cascade levels), among other things.
|
||||
struct CascadeDataIter<'a> {
|
||||
cascade_data: &'a CascadeData,
|
||||
cur: usize,
|
||||
|
@ -1645,9 +1650,9 @@ impl<'a> Iterator for CascadeDataIter<'a> {
|
|||
|
||||
fn next(&mut self) -> Option<&'a PerOriginCascadeData> {
|
||||
let result = match self.cur {
|
||||
0 => &self.cascade_data.user_agent,
|
||||
0 => &self.cascade_data.user,
|
||||
1 => &self.cascade_data.author,
|
||||
2 => &self.cascade_data.user,
|
||||
2 => &self.cascade_data.user_agent,
|
||||
_ => return None,
|
||||
};
|
||||
self.cur += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue