mirror of
https://github.com/servo/servo.git
synced 2025-10-02 09:39:14 +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
|
@ -18,6 +18,7 @@ use style::arc_ptr_eq;
|
|||
use style::context::{QuirksMode, SharedStyleContext, StyleContext};
|
||||
use style::context::{ThreadLocalStyleContext, ThreadLocalStyleContextCreationInfo};
|
||||
use style::data::{ElementData, ElementStyles, RestyleData};
|
||||
use style::dom::{AnimationOnlyDirtyDescendants, DirtyDescendants};
|
||||
use style::dom::{ShowSubtreeData, TElement, TNode};
|
||||
use style::error_reporting::StdoutErrorReporter;
|
||||
use style::gecko::data::{PerDocumentStyleData, PerDocumentStyleDataImpl};
|
||||
|
@ -1384,17 +1385,12 @@ unsafe fn maybe_restyle<'a>(data: &'a mut AtomicRefMut<ElementData>,
|
|||
}
|
||||
|
||||
// Propagate the bit up the chain.
|
||||
let mut curr = element;
|
||||
while let Some(parent) = curr.parent_element() {
|
||||
curr = parent;
|
||||
if animation_only {
|
||||
if curr.has_animation_only_dirty_descendants() { break; }
|
||||
curr.set_animation_only_dirty_descendants();
|
||||
} else {
|
||||
if curr.has_dirty_descendants() { break; }
|
||||
curr.set_dirty_descendants();
|
||||
}
|
||||
}
|
||||
if animation_only {
|
||||
element.parent_element().map(|p| p.note_descendants::<AnimationOnlyDirtyDescendants>());
|
||||
} else {
|
||||
element.parent_element().map(|p| p.note_descendants::<DirtyDescendants>());
|
||||
};
|
||||
|
||||
bindings::Gecko_SetOwnerDocumentNeedsStyleFlush(element.0);
|
||||
|
||||
// Ensure and return the RestyleData.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue