mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Bug 1369187: style: Add an API to fast-reject eager pseudos. r=bholley
Also, do nothing for now (we'll hook the Gecko pieces here when the time comes). Let me know if you want to hold-off landing this. MozReview-Commit-ID: 6PIhfp6sxk4
This commit is contained in:
parent
12de616532
commit
fe74e70a2d
2 changed files with 20 additions and 1 deletions
|
@ -382,6 +382,20 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
||||||
pseudo: Option<&PseudoElement>)
|
pseudo: Option<&PseudoElement>)
|
||||||
-> Option<&'a PreExistingComputedValues>;
|
-> Option<&'a PreExistingComputedValues>;
|
||||||
|
|
||||||
|
/// Whether a given element may generate a pseudo-element.
|
||||||
|
///
|
||||||
|
/// This is useful to avoid computing, for example, pseudo styles for
|
||||||
|
/// `::-first-line` or `::-first-letter`, when we know it won't affect us.
|
||||||
|
///
|
||||||
|
/// TODO(emilio, bz): actually implement the logic for it.
|
||||||
|
fn may_generate_pseudo(
|
||||||
|
&self,
|
||||||
|
_pseudo: &PseudoElement,
|
||||||
|
_primary_style: &ComputedValues,
|
||||||
|
) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true if this element may have a descendant needing style processing.
|
/// Returns true if this element may have a descendant needing style processing.
|
||||||
///
|
///
|
||||||
/// Note that we cannot guarantee the existence of such an element, because
|
/// Note that we cannot guarantee the existence of such an element, because
|
||||||
|
@ -444,7 +458,8 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Flag that this element has a descendant for animation-only restyle processing.
|
/// Flag that this element has a descendant for animation-only restyle
|
||||||
|
/// processing.
|
||||||
///
|
///
|
||||||
/// Only safe to call with exclusive access to the element.
|
/// Only safe to call with exclusive access to the element.
|
||||||
unsafe fn set_animation_only_dirty_descendants(&self) {
|
unsafe fn set_animation_only_dirty_descendants(&self) {
|
||||||
|
|
|
@ -1106,6 +1106,10 @@ pub trait MatchMethods : TElement {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !self.may_generate_pseudo(&pseudo, data.styles().primary.values()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debug_assert!(applicable_declarations.is_empty());
|
debug_assert!(applicable_declarations.is_empty());
|
||||||
// NB: We handle animation rules for ::before and ::after when
|
// NB: We handle animation rules for ::before and ::after when
|
||||||
// traversing them.
|
// traversing them.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue