style: Invalidate parts in nested shadow trees correctly.

Differential Revision: https://phabricator.services.mozilla.com/D54010
This commit is contained in:
Emilio Cobos Álvarez 2019-11-21 10:32:10 +00:00
parent e3009a4de9
commit f8ceb5cb84
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
6 changed files with 104 additions and 43 deletions

View file

@ -62,6 +62,12 @@ pub trait ElementSnapshot: Sized {
/// called if `has_attrs()` returns true.
fn is_part(&self, name: &Atom) -> bool;
/// See Element::exported_part.
fn exported_part(&self, name: &Atom) -> Option<Atom>;
/// See Element::imported_part.
fn imported_part(&self, name: &Atom) -> Option<Atom>;
/// A callback that should be called for each class of the snapshot. Should
/// only be called if `has_attrs()` returns true.
fn each_class<F>(&self, _: F)
@ -366,13 +372,17 @@ where
}
fn exported_part(&self, name: &Atom) -> Option<Atom> {
// FIXME(emilio): Implement for proper invalidation.
self.element.exported_part(name)
match self.snapshot() {
Some(snapshot) if snapshot.has_attrs() => snapshot.exported_part(name),
_ => self.element.exported_part(name),
}
}
fn imported_part(&self, name: &Atom) -> Option<Atom> {
// FIXME(emilio): Implement for proper invalidation.
self.element.imported_part(name)
match self.snapshot() {
Some(snapshot) if snapshot.has_attrs() => snapshot.imported_part(name),
_ => self.element.imported_part(name),
}
}
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {