style: Refactor XBL rule matching to add another API to iterate the Stylists.

This will allow us to query the relevant stylists for invalidation.

Bug: 1375969
Reviewed-By: TYLin
MozReview-Commit-ID: EIIzbr2pEqN
This commit is contained in:
Emilio Cobos Álvarez 2017-06-27 17:23:17 -07:00
parent 9d1b26de1f
commit 02b61ed1a1
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 54 additions and 39 deletions

View file

@ -31,6 +31,7 @@ use std::fmt::Debug;
use std::hash::Hash;
use std::ops::Deref;
use stylearc::Arc;
use stylist::Stylist;
use thread_state;
pub use style_traits::UnsafeNode;
@ -623,15 +624,34 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
}
}
/// Gets declarations from XBL bindings from the element. Only gecko element could have this.
fn get_declarations_from_xbl_bindings<V>(&self,
_pseudo_element: Option<&PseudoElement>,
_applicable_declarations: &mut V)
-> bool
where V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock> {
/// Implements Gecko's `nsBindingManager::WalkRules`.
///
/// Returns whether to cut off the inheritance.
fn each_xbl_stylist<F>(&self, _: F) -> bool
where
F: FnMut(&Stylist),
{
false
}
/// Gets declarations from XBL bindings from the element.
fn get_declarations_from_xbl_bindings<V>(
&self,
pseudo_element: Option<&PseudoElement>,
applicable_declarations: &mut V
) -> bool
where
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>
{
self.each_xbl_stylist(|stylist| {
stylist.push_applicable_declarations_as_xbl_only_stylist(
self,
pseudo_element,
applicable_declarations
);
})
}
/// Gets the current existing CSS transitions, by |property, end value| pairs in a HashMap.
#[cfg(feature = "gecko")]
fn get_css_transitions_info(&self)