summaryrefslogtreecommitdiffstats
path: root/servo/components/style/gecko/snapshot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'servo/components/style/gecko/snapshot.rs')
-rw-r--r--servo/components/style/gecko/snapshot.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/servo/components/style/gecko/snapshot.rs b/servo/components/style/gecko/snapshot.rs
index 2ff04406ac..8f6eb120d5 100644
--- a/servo/components/style/gecko/snapshot.rs
+++ b/servo/components/style/gecko/snapshot.rs
@@ -171,4 +171,33 @@ impl ElementSnapshot for GeckoElementSnapshot {
Some(AtomString(unsafe { Atom::from_addrefed(ptr) }))
}
}
+
+ /// Returns true if the snapshot has stored state for custom states
+ #[inline]
+ fn has_custom_states(&self) -> bool {
+ self.has_any(Flags::CustomState)
+ }
+
+ /// Returns true if the snapshot has a given CustomState
+ #[inline]
+ fn has_custom_state(&self, state: &AtomIdent) -> bool {
+ unsafe {
+ self.mCustomStates.iter().any(|setstate| {
+ AtomIdent::with(setstate.mRawPtr, |setstate| state == setstate)
+ })
+ }
+ }
+
+ #[inline]
+ fn each_custom_state<F>(&self, mut callback: F)
+ where
+ F: FnMut(&AtomIdent),
+ {
+ unsafe {
+ for atom in self.mCustomStates.iter() {
+ AtomIdent::with(atom.mRawPtr, &mut callback)
+ }
+ }
+ }
+
}