diff options
Diffstat (limited to 'components/style/gecko/snapshot_helpers.rs')
-rw-r--r-- | components/style/gecko/snapshot_helpers.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/components/style/gecko/snapshot_helpers.rs b/components/style/gecko/snapshot_helpers.rs index b8b31bc87dd..24b3ebb1991 100644 --- a/components/style/gecko/snapshot_helpers.rs +++ b/components/style/gecko/snapshot_helpers.rs @@ -82,6 +82,26 @@ pub fn get_id(attrs: &[structs::AttrArray_InternalAttr]) -> Option<&WeakAtom> { Some(unsafe { get_id_from_attr(find_attr(attrs, &atom!("id"))?) }) } +#[inline(always)] +pub(super) fn exported_part(attrs: &[structs::AttrArray_InternalAttr], name: &Atom) -> Option<Atom> { + let attr = find_attr(attrs, &atom!("exportparts"))?; + let atom = unsafe { bindings::Gecko_Element_ExportedPart(attr, name.as_ptr()) }; + if atom.is_null() { + return None; + } + Some(unsafe { Atom::from_raw(atom) }) +} + +#[inline(always)] +pub(super) fn imported_part(attrs: &[structs::AttrArray_InternalAttr], name: &Atom) -> Option<Atom> { + let attr = find_attr(attrs, &atom!("exportparts"))?; + let atom = unsafe { bindings::Gecko_Element_ImportedPart(attr, name.as_ptr()) }; + if atom.is_null() { + return None; + } + Some(unsafe { Atom::from_raw(atom) }) +} + /// Given a class or part name, a case sensitivity, and an array of attributes, /// returns whether the attribute has that name. #[inline(always)] |