mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Don't propagate bits for children invalidated under display:none/not in the flat tree
Much like invalidated_descendants. This preserves our invariant that we only visit elements with data in the post-traversal. Differential Revision: https://phabricator.services.mozilla.com/D160338
This commit is contained in:
parent
8dcf5cddca
commit
3c4d198ad7
1 changed files with 10 additions and 5 deletions
|
@ -152,13 +152,16 @@ where
|
|||
|
||||
/// Sets the appropriate restyle hint after invalidating the style of a given
|
||||
/// element.
|
||||
pub fn invalidated_self<E>(element: E)
|
||||
pub fn invalidated_self<E>(element: E) -> bool
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
if let Some(mut data) = element.mutate_data() {
|
||||
let mut data = match element.mutate_data() {
|
||||
Some(data) => data,
|
||||
None => return false,
|
||||
};
|
||||
data.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
/// Sets the appropriate hint after invalidating the style of a sibling.
|
||||
|
@ -167,7 +170,9 @@ where
|
|||
E: TElement,
|
||||
{
|
||||
debug_assert_eq!(element.as_node().parent_node(), of.as_node().parent_node(), "Should be siblings");
|
||||
invalidated_self(element);
|
||||
if !invalidated_self(element) {
|
||||
return;
|
||||
}
|
||||
if element.traversal_parent() != of.traversal_parent() {
|
||||
let parent = element.as_node().parent_element_or_host();
|
||||
debug_assert!(parent.is_some(), "How can we have siblings without parent nodes?");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue