mirror of
https://github.com/servo/servo.git
synced 2025-06-21 23:59:00 +01:00
Make it clearer that we never insert elements with preshints into the cache.
MozReview-Commit-ID: 9bdc0sNZeEy
This commit is contained in:
parent
e4ed69c52b
commit
1d6892afa3
1 changed files with 13 additions and 13 deletions
|
@ -152,7 +152,7 @@ fn element_matches_candidate<E: TElement>(element: &E,
|
||||||
miss!(Class)
|
miss!(Class)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !have_same_presentational_hints(element, candidate_element) {
|
if has_presentational_hints(element) {
|
||||||
miss!(PresHints)
|
miss!(PresHints)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,18 +168,10 @@ fn element_matches_candidate<E: TElement>(element: &E,
|
||||||
Ok(current_styles.primary.clone())
|
Ok(current_styles.primary.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn have_same_presentational_hints<E: TElement>(element: &E, candidate: &E) -> bool {
|
fn has_presentational_hints<E: TElement>(element: &E) -> bool {
|
||||||
let mut first = ForgetfulSink::new();
|
let mut hints = ForgetfulSink::new();
|
||||||
element.synthesize_presentational_hints_for_legacy_attributes(&mut first);
|
element.synthesize_presentational_hints_for_legacy_attributes(&mut hints);
|
||||||
|
!hints.is_empty()
|
||||||
if cfg!(debug_assertions) {
|
|
||||||
let mut second = vec![];
|
|
||||||
candidate.synthesize_presentational_hints_for_legacy_attributes(&mut second);
|
|
||||||
debug_assert!(second.is_empty(),
|
|
||||||
"Should never have inserted an element with preshints in the cache!");
|
|
||||||
}
|
|
||||||
|
|
||||||
first.is_empty()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn have_same_class<E: TElement>(element: &E,
|
fn have_same_class<E: TElement>(element: &E,
|
||||||
|
@ -296,6 +288,14 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we noted any presentational hints in the StyleRelations.
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
let mut hints = ForgetfulSink::new();
|
||||||
|
element.synthesize_presentational_hints_for_legacy_attributes(&mut hints);
|
||||||
|
debug_assert!(hints.is_empty(), "Style relations should not be shareable!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let box_style = style.get_box();
|
let box_style = style.get_box();
|
||||||
if box_style.specifies_transitions() {
|
if box_style.specifies_transitions() {
|
||||||
debug!("Failing to insert to the cache: transitions");
|
debug!("Failing to insert to the cache: transitions");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue