mirror of
https://github.com/servo/servo.git
synced 2025-08-30 01:28:21 +01:00
style: Allow to export a shadow part under multiple names.
Other browsers allow this and the spec doesn't really disallow it, so fix it, add a test and carry on. Differential Revision: https://phabricator.services.mozilla.com/D65107
This commit is contained in:
parent
614d3e746f
commit
635f5fbf1b
8 changed files with 46 additions and 46 deletions
|
@ -193,11 +193,6 @@ impl ElementSnapshot for GeckoElementSnapshot {
|
|||
snapshot_helpers::has_class_or_part(name, CaseSensitivity::CaseSensitive, attr)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn exported_part(&self, name: &Atom) -> Option<Atom> {
|
||||
snapshot_helpers::exported_part(&*self.mAttrs, name)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn imported_part(&self, name: &Atom) -> Option<Atom> {
|
||||
snapshot_helpers::imported_part(&*self.mAttrs, name)
|
||||
|
|
|
@ -83,16 +83,32 @@ pub fn get_id(attrs: &[structs::AttrArray_InternalAttr]) -> Option<&WeakAtom> {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(super) fn exported_part(
|
||||
pub(super) fn each_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;
|
||||
mut callback: impl FnMut(&Atom),
|
||||
) {
|
||||
let attr = match find_attr(attrs, &atom!("exportparts")) {
|
||||
Some(attr) => attr,
|
||||
None => return,
|
||||
};
|
||||
let mut length = 0;
|
||||
let atoms = unsafe {
|
||||
bindings::Gecko_Element_ExportedParts(
|
||||
attr,
|
||||
name.as_ptr(),
|
||||
&mut length,
|
||||
)
|
||||
};
|
||||
if atoms.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
for atom in std::slice::from_raw_parts(atoms, length) {
|
||||
Atom::with(*atom, &mut callback)
|
||||
}
|
||||
}
|
||||
Some(unsafe { Atom::from_raw(atom) })
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
|
@ -1281,6 +1281,14 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
snapshot_helpers::each_class_or_part(attr, callback)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn each_exported_part<F>(&self, name: &Atom, callback: F)
|
||||
where
|
||||
F: FnMut(&Atom),
|
||||
{
|
||||
snapshot_helpers::each_exported_part(self.attrs(), name, callback)
|
||||
}
|
||||
|
||||
fn each_part<F>(&self, callback: F)
|
||||
where
|
||||
F: FnMut(&Atom),
|
||||
|
@ -2226,11 +2234,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
snapshot_helpers::has_class_or_part(name, CaseSensitivity::CaseSensitive, attr)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn exported_part(&self, name: &Atom) -> Option<Atom> {
|
||||
snapshot_helpers::exported_part(self.attrs(), name)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn imported_part(&self, name: &Atom) -> Option<Atom> {
|
||||
snapshot_helpers::imported_part(self.attrs(), name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue