mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Keep dirty bit invariants during invalidation.
There's the question of whether should we be recursing into the invalidation code for elements without data... Probably not, but that's a somewhat more risky change. Bug: 1391444 Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
d4e43d9d76
commit
aa0c320f4f
1 changed files with 11 additions and 2 deletions
|
@ -29,6 +29,15 @@ pub struct TreeStyleInvalidator<'a, 'b: 'a, E>
|
||||||
where E: TElement,
|
where E: TElement,
|
||||||
{
|
{
|
||||||
element: E,
|
element: E,
|
||||||
|
// TODO(emilio): It's tempting enough to just avoid running invalidation for
|
||||||
|
// elements without data.
|
||||||
|
//
|
||||||
|
// But that's be wrong for sibling invalidations when a new element has been
|
||||||
|
// inserted in the tree and still has no data (though I _think_ the slow
|
||||||
|
// selector bits save us, it'd be nice not to depend on them).
|
||||||
|
//
|
||||||
|
// Seems like we could at least avoid running invalidation for the
|
||||||
|
// descendants if an element has no data, though.
|
||||||
data: Option<&'a mut ElementData>,
|
data: Option<&'a mut ElementData>,
|
||||||
shared_context: &'a SharedStyleContext<'b>,
|
shared_context: &'a SharedStyleContext<'b>,
|
||||||
}
|
}
|
||||||
|
@ -353,7 +362,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
||||||
//
|
//
|
||||||
// Since we keep the traversal flags in terms of the flattened tree,
|
// Since we keep the traversal flags in terms of the flattened tree,
|
||||||
// we need to propagate it as appropriate.
|
// we need to propagate it as appropriate.
|
||||||
if invalidated_child {
|
if invalidated_child && child.get_data().is_some() {
|
||||||
let mut current = child.traversal_parent();
|
let mut current = child.traversal_parent();
|
||||||
while let Some(parent) = current.take() {
|
while let Some(parent) = current.take() {
|
||||||
if parent == self.element {
|
if parent == self.element {
|
||||||
|
@ -470,7 +479,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
||||||
|
|
||||||
any_descendant |= self.invalidate_nac(invalidations);
|
any_descendant |= self.invalidate_nac(invalidations);
|
||||||
|
|
||||||
if any_descendant {
|
if any_descendant && self.data.as_ref().map_or(false, |d| !d.styles.is_display_none()) {
|
||||||
unsafe { self.element.set_dirty_descendants() };
|
unsafe { self.element.set_dirty_descendants() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue