style: Refactor RestyleHint to be a struct.

Later PRs will add additional data to it that is not so easy to
represent using bitflags.
This commit is contained in:
Cameron McCormack 2017-05-19 17:39:15 +08:00 committed by Emilio Cobos Álvarez
parent c13be5cd13
commit a397590838
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 294 additions and 111 deletions

View file

@ -9,7 +9,7 @@ use context::{SharedStyleContext, StyleContext, ThreadLocalStyleContext};
use data::{ElementData, ElementStyles, StoredRestyleHint};
use dom::{DirtyDescendants, NodeInfo, OpaqueNode, TElement, TNode};
use matching::{ChildCascadeRequirement, MatchMethods, StyleSharingBehavior};
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_SELF};
use restyle_hints::RestyleHint;
use selector_parser::RestyleDamage;
#[cfg(feature = "servo")] use servo_config::opts;
use std::borrow::BorrowMut;
@ -232,7 +232,7 @@ pub trait DomTraversal<E: TElement> : Sync {
if let Some(next) = root.next_sibling_element() {
if let Some(mut next_data) = next.mutate_data() {
let hint = StoredRestyleHint::subtree_and_later_siblings();
next_data.ensure_restyle().hint.insert(&hint);
next_data.ensure_restyle().hint.insert(hint);
}
}
}
@ -819,11 +819,11 @@ fn preprocess_children<E, D>(traversal: &D,
// Propagate the parent and sibling restyle hint.
if !propagated_hint.is_empty() {
restyle_data.hint.insert(&propagated_hint);
restyle_data.hint.insert_from(&propagated_hint);
}
if later_siblings {
propagated_hint.insert(&(RESTYLE_SELF | RESTYLE_DESCENDANTS).into());
propagated_hint.insert(RestyleHint::subtree().into());
}
// Store the damage already handled by ancestors.