mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Centralize note_dirty_descendants implementation, and fully propagate dirty_descendants in resolve_style.
The current code can leave the tree in an inconsistent state, with the dirty descendants bit not fully propagated. MozReview-Commit-ID: ALI6etmlrDa
This commit is contained in:
parent
185d31f086
commit
7c58483aff
4 changed files with 68 additions and 27 deletions
|
@ -63,7 +63,8 @@ use style::attr::AttrValue;
|
|||
use style::computed_values::display;
|
||||
use style::context::{QuirksMode, SharedStyleContext};
|
||||
use style::data::ElementData;
|
||||
use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthetizer, TElement, TNode};
|
||||
use style::dom::{DirtyDescendants, LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthetizer};
|
||||
use style::dom::{TElement, TNode};
|
||||
use style::dom::UnsafeNode;
|
||||
use style::element_state::*;
|
||||
use style::properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
|
@ -487,6 +488,9 @@ impl<'le> ServoLayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME(bholley): This should be merged with TElement::note_dirty_descendants,
|
||||
// but that requires re-testing and possibly fixing the broken callers given
|
||||
// the FIXME below, which I don't have time to do right now.
|
||||
pub unsafe fn note_dirty_descendant(&self) {
|
||||
use ::selectors::Element;
|
||||
|
||||
|
@ -501,19 +505,7 @@ impl<'le> ServoLayoutElement<'le> {
|
|||
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
|
||||
debug_assert!(self.descendants_bit_is_propagated::<DirtyDescendants>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue