mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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
|
@ -21,11 +21,14 @@ use std::fmt;
|
|||
///
|
||||
/// The `data` argument is a mutable reference to the element's style data, if
|
||||
/// any.
|
||||
pub trait InvalidationProcessor {
|
||||
pub trait InvalidationProcessor<E>
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
/// Collect invalidations for a given element's descendants and siblings.
|
||||
///
|
||||
/// Returns whether the element itself was invalidated.
|
||||
fn collect_invalidations<E>(
|
||||
fn collect_invalidations(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
|
@ -33,57 +36,45 @@ pub trait InvalidationProcessor {
|
|||
shared_context: &SharedStyleContext,
|
||||
descendant_invalidations: &mut InvalidationVector,
|
||||
sibling_invalidations: &mut InvalidationVector,
|
||||
) -> bool
|
||||
where
|
||||
E: TElement;
|
||||
) -> bool;
|
||||
|
||||
/// Returns whether the invalidation process should process the descendants
|
||||
/// of the given element.
|
||||
fn should_process_descendants<E>(
|
||||
fn should_process_descendants(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
) -> bool
|
||||
where
|
||||
E: TElement;
|
||||
) -> bool;
|
||||
|
||||
/// Executes an arbitrary action when the recursion limit is exceded (if
|
||||
/// any).
|
||||
fn recursion_limit_exceeded<E>(
|
||||
fn recursion_limit_exceeded(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
)
|
||||
where
|
||||
E: TElement;
|
||||
);
|
||||
|
||||
/// Executes an arbitrary action when a direct child is invalidated.
|
||||
fn invalidated_child<E>(
|
||||
fn invalidated_child(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
child: E,
|
||||
)
|
||||
where
|
||||
E: TElement;
|
||||
);
|
||||
|
||||
/// Executes an action when `Self` is invalidated.
|
||||
fn invalidated_self<E>(
|
||||
fn invalidated_self(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
)
|
||||
where
|
||||
E: TElement;
|
||||
);
|
||||
|
||||
/// Executes an action when any descendant of `Self` is invalidated.
|
||||
fn invalidated_descendants<E>(
|
||||
fn invalidated_descendants(
|
||||
&self,
|
||||
element: E,
|
||||
data: Option<&mut ElementData>,
|
||||
)
|
||||
where
|
||||
E: TElement;
|
||||
);
|
||||
}
|
||||
|
||||
/// The struct that takes care of encapsulating all the logic on where and how
|
||||
|
@ -91,7 +82,7 @@ pub trait InvalidationProcessor {
|
|||
pub struct TreeStyleInvalidator<'a, 'b: 'a, E, P: 'a>
|
||||
where
|
||||
E: TElement,
|
||||
P: InvalidationProcessor
|
||||
P: InvalidationProcessor<E>
|
||||
{
|
||||
element: E,
|
||||
// TODO(emilio): It's tempting enough to just avoid running invalidation for
|
||||
|
@ -242,7 +233,7 @@ impl InvalidationResult {
|
|||
impl<'a, 'b: 'a, E, P: 'a> TreeStyleInvalidator<'a, 'b, E, P>
|
||||
where
|
||||
E: TElement,
|
||||
P: InvalidationProcessor,
|
||||
P: InvalidationProcessor<E>,
|
||||
{
|
||||
/// Trivially constructs a new `TreeStyleInvalidator`.
|
||||
pub fn new(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue