mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Track all node damage with PendingRestyles.
This commit is contained in:
parent
0547a6b313
commit
f1043f6305
5 changed files with 68 additions and 44 deletions
|
@ -529,6 +529,35 @@ impl<'le> ServoLayoutElement<'le> {
|
|||
self.get_style_and_layout_data().map(|d| &**d.ptr)
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn note_dirty_descendant(&self) {
|
||||
use ::selectors::Element;
|
||||
|
||||
let mut current = Some(*self);
|
||||
while let Some(el) = current {
|
||||
// FIXME(bholley): Ideally we'd have the invariant that any element
|
||||
// with has_dirty_descendants also has the bit set on all its ancestors.
|
||||
// However, there are currently some corner-cases where we get that wrong.
|
||||
// I have in-flight patches to fix all this stuff up, so we just always
|
||||
// propagate this bit for now.
|
||||
el.set_dirty_descendants();
|
||||
current = el.parent_element();
|
||||
}
|
||||
|
||||
debug_assert!(self.dirty_descendants_bit_is_propagated());
|
||||
}
|
||||
|
||||
fn dirty_descendants_bit_is_propagated(&self) -> bool {
|
||||
use ::selectors::Element;
|
||||
|
||||
let mut current = Some(*self);
|
||||
while let Some(el) = current {
|
||||
if !el.has_dirty_descendants() { return false; }
|
||||
current = el.parent_element();
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fn as_element<'le>(node: LayoutJS<Node>) -> Option<ServoLayoutElement<'le>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue