mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Sort the cached class list in ValidationInfo.
MozReview-Commit-ID: 3vsfP5ECzds
This commit is contained in:
parent
c018340a13
commit
6d8455a916
2 changed files with 11 additions and 2 deletions
|
@ -90,8 +90,15 @@ impl ValidationData {
|
|||
where E: TElement,
|
||||
{
|
||||
if self.class_list.is_none() {
|
||||
let mut class_list = SmallVec::new();
|
||||
let mut class_list = SmallVec::<[Atom; 5]>::new();
|
||||
element.each_class(|c| class_list.push(c.clone()));
|
||||
// Assuming there are a reasonable number of classes (we use the
|
||||
// inline capacity as "reasonable number"), sort them to so that
|
||||
// we don't mistakenly reject sharing candidates when one element
|
||||
// has "foo bar" and the other has "bar foo".
|
||||
if !class_list.spilled() {
|
||||
class_list.sort_by(|a, b| a.get_hash().cmp(&b.get_hash()));
|
||||
}
|
||||
self.class_list = Some(class_list);
|
||||
}
|
||||
&*self.class_list.as_ref().unwrap()
|
||||
|
|
|
@ -966,7 +966,9 @@ impl Stylist {
|
|||
assert_eq!(declaration.level, CascadeLevel::PresHints);
|
||||
}
|
||||
}
|
||||
// Never share style for elements with preshints
|
||||
// Note the existence of presentational attributes so that the
|
||||
// style sharing cache can avoid re-querying them if they don't
|
||||
// exist.
|
||||
context.relations |= AFFECTED_BY_PRESENTATIONAL_HINTS;
|
||||
}
|
||||
debug!("preshints: {:?}", context.relations);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue