mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Move Attr::local_name() to AttrHelpers/AttrHelpersForLayout.
This commit is contained in:
parent
b73b06b9a8
commit
a4ec892dbc
2 changed files with 12 additions and 6 deletions
|
@ -110,10 +110,6 @@ impl Attr {
|
|||
let attr = Attr::new_inherited(local_name, value, name, namespace, prefix, owner);
|
||||
reflect_dom_object(box attr, &Window(*window), AttrBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn local_name<'a>(&'a self) -> &'a Atom {
|
||||
&self.local_name
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> AttrMethods for JSRef<'a, Attr> {
|
||||
|
@ -151,6 +147,7 @@ impl<'a> AttrMethods for JSRef<'a, Attr> {
|
|||
pub trait AttrHelpers {
|
||||
fn set_value(&self, set_type: AttrSettingType, value: AttrValue);
|
||||
fn value<'a>(&'a self) -> Ref<'a, AttrValue>;
|
||||
fn local_name<'a>(&'a self) -> &'a Atom;
|
||||
}
|
||||
|
||||
impl<'a> AttrHelpers for JSRef<'a, Attr> {
|
||||
|
@ -182,11 +179,16 @@ impl<'a> AttrHelpers for JSRef<'a, Attr> {
|
|||
fn value<'a>(&'a self) -> Ref<'a, AttrValue> {
|
||||
self.value.deref().borrow()
|
||||
}
|
||||
|
||||
fn local_name<'a>(&'a self) -> &'a Atom {
|
||||
&self.local_name
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AttrHelpersForLayout {
|
||||
unsafe fn value_ref_forever(&self) -> &'static str;
|
||||
unsafe fn value_atom_forever(&self) -> Option<Atom>;
|
||||
unsafe fn local_name_atom_forever(&self) -> Atom;
|
||||
}
|
||||
|
||||
impl AttrHelpersForLayout for Attr {
|
||||
|
@ -204,4 +206,8 @@ impl AttrHelpersForLayout for Attr {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn local_name_atom_forever(&self) -> Atom {
|
||||
self.local_name.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ impl RawLayoutElementHelpers for Element {
|
|||
let attrs: *const Vec<JS<Attr>> = mem::transmute(&self.attrs);
|
||||
(*attrs).iter().find(|attr: & &JS<Attr>| {
|
||||
let attr = attr.unsafe_get();
|
||||
name == (*attr).local_name().as_slice() &&
|
||||
name == (*attr).local_name_atom_forever().as_slice() &&
|
||||
(*attr).namespace == *namespace
|
||||
}).map(|attr| {
|
||||
let attr = attr.unsafe_get();
|
||||
|
@ -193,7 +193,7 @@ impl RawLayoutElementHelpers for Element {
|
|||
let attrs: *const Vec<JS<Attr>> = mem::transmute(&self.attrs);
|
||||
(*attrs).iter().find(|attr: & &JS<Attr>| {
|
||||
let attr = attr.unsafe_get();
|
||||
name == (*attr).local_name().as_slice() &&
|
||||
name == (*attr).local_name_atom_forever().as_slice() &&
|
||||
(*attr).namespace == *namespace
|
||||
}).and_then(|attr| {
|
||||
let attr = attr.unsafe_get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue