mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Handle nested slots correctly in slotted matching and invalidation.
The patch and test should be pretty much self-descriptive. Differential Revision: https://phabricator.services.mozilla.com/D14063
This commit is contained in:
parent
a519d9ecc3
commit
7f5a9e0f45
3 changed files with 45 additions and 17 deletions
|
@ -471,25 +471,34 @@ where
|
|||
return false;
|
||||
}
|
||||
|
||||
let slot = self.element;
|
||||
self.invalidate_slotted_elements_in_slot(slot, invalidations)
|
||||
}
|
||||
|
||||
fn invalidate_slotted_elements_in_slot(
|
||||
&mut self,
|
||||
slot: E,
|
||||
invalidations: &[Invalidation<'b>],
|
||||
) -> bool {
|
||||
let mut any = false;
|
||||
|
||||
let mut sibling_invalidations = InvalidationVector::new();
|
||||
let element = self.element;
|
||||
for node in element.slotted_nodes() {
|
||||
for node in slot.slotted_nodes() {
|
||||
let element = match node.as_element() {
|
||||
Some(e) => e,
|
||||
None => continue,
|
||||
};
|
||||
|
||||
any |= self.invalidate_child(
|
||||
element,
|
||||
invalidations,
|
||||
&mut sibling_invalidations,
|
||||
DescendantInvalidationKind::Slotted,
|
||||
);
|
||||
|
||||
// FIXME(emilio): Need to handle nested slotted nodes if `element`
|
||||
// is itself a <slot>.
|
||||
if element.is_html_slot_element() {
|
||||
any |= self.invalidate_slotted_elements_in_slot(element, invalidations);
|
||||
} else {
|
||||
any |= self.invalidate_child(
|
||||
element,
|
||||
invalidations,
|
||||
&mut sibling_invalidations,
|
||||
DescendantInvalidationKind::Slotted,
|
||||
);
|
||||
}
|
||||
|
||||
debug_assert!(
|
||||
sibling_invalidations.is_empty(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue