aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/gecko/snapshot.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/components/style/gecko/snapshot.rs b/components/style/gecko/snapshot.rs
index ea4871bc2a7..261af44f6d6 100644
--- a/components/style/gecko/snapshot.rs
+++ b/components/style/gecko/snapshot.rs
@@ -148,7 +148,12 @@ impl ElementSnapshot for GeckoElementSnapshot {
self.has_any(Flags::Attributes)
}
+ #[inline]
fn id_attr(&self) -> Option<Atom> {
+ if !self.has_any(Flags::Id) {
+ return None
+ }
+
let ptr = unsafe {
bindings::Gecko_SnapshotAtomAttrValue(self,
atom!("id").as_ptr())
@@ -161,15 +166,25 @@ impl ElementSnapshot for GeckoElementSnapshot {
}
}
+ #[inline]
fn has_class(&self, name: &Atom) -> bool {
+ if !self.has_any(Flags::MaybeClass) {
+ return false;
+ }
+
snapshot_helpers::has_class(self.as_ptr(),
name,
bindings::Gecko_SnapshotClassOrClassList)
}
+ #[inline]
fn each_class<F>(&self, callback: F)
where F: FnMut(&Atom)
{
+ if !self.has_any(Flags::MaybeClass) {
+ return;
+ }
+
snapshot_helpers::each_class(self.as_ptr(),
callback,
bindings::Gecko_SnapshotClassOrClassList)