mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
style: Move the bounds up in InvalidationProcessor.
This commit is contained in:
parent
a5e2f2c76c
commit
557353c1f6
2 changed files with 34 additions and 58 deletions
|
@ -53,8 +53,11 @@ where
|
|||
/// changes.
|
||||
pub struct StateAndAttrInvalidationProcessor;
|
||||
|
||||
impl InvalidationProcessor for StateAndAttrInvalidationProcessor {
|
||||
fn collect_invalidations<E>(
|
||||
impl<E> InvalidationProcessor<E> for StateAndAttrInvalidationProcessor
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
fn collect_invalidations(
|
||||
&self,
|
||||
element: E,
|
||||
mut data: Option<&mut ElementData>,
|
||||
|
@ -62,10 +65,7 @@ impl InvalidationProcessor for StateAndAttrInvalidationProcessor {
|
|||
shared_context: &SharedStyleContext,
|
||||
descendant_invalidations: &mut InvalidationVector,
|
||||
sibling_invalidations: &mut InvalidationVector,
|
||||
) -> bool
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
) -> bool {
|
||||
debug_assert!(element.has_snapshot(), "Why bothering?");
|
||||
debug_assert!(data.is_some(), "How exactly?");
|
||||
|
||||
|
@ -176,14 +176,11 @@ impl InvalidationProcessor for StateAndAttrInvalidationProcessor {
|
|||
invalidated_self
|
||||
}
|
||||
|
||||
fn should_process_descendants<E>(
|
||||
fn should_process_descendants(
|
||||
&self,
|
||||
_element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
) -> bool
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
) -> bool {
|
||||
let data = match data {
|
||||
None => return false,
|
||||
Some(ref data) => data,
|
||||
|
@ -196,28 +193,22 @@ impl InvalidationProcessor for StateAndAttrInvalidationProcessor {
|
|||
!data.hint.contains_subtree()
|
||||
}
|
||||
|
||||
fn recursion_limit_exceeded<E>(
|
||||
fn recursion_limit_exceeded(
|
||||
&self,
|
||||
_element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
) {
|
||||
if let Some(data) = data {
|
||||
data.hint.insert(RESTYLE_DESCENDANTS);
|
||||
}
|
||||
}
|
||||
|
||||
fn invalidated_child<E>(
|
||||
fn invalidated_child(
|
||||
&self,
|
||||
element: E,
|
||||
_data: Option<&mut ElementData>,
|
||||
child: E,
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
) {
|
||||
if child.get_data().is_none() {
|
||||
return;
|
||||
}
|
||||
|
@ -238,14 +229,11 @@ impl InvalidationProcessor for StateAndAttrInvalidationProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
fn invalidated_descendants<E>(
|
||||
fn invalidated_descendants(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
) {
|
||||
// FIXME(emilio): We probably want to walk the flattened tree here too,
|
||||
// and remove invalidated_child instead, or something like that.
|
||||
if data.as_ref().map_or(false, |d| !d.styles.is_display_none()) {
|
||||
|
@ -253,14 +241,11 @@ impl InvalidationProcessor for StateAndAttrInvalidationProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
fn invalidated_self<E>(
|
||||
fn invalidated_self(
|
||||
&self,
|
||||
_element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
) {
|
||||
if let Some(data) = data {
|
||||
data.hint.insert(RESTYLE_SELF);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue