mirror of
https://github.com/servo/servo.git
synced 2025-07-16 20:03:39 +01:00
Remove get_attr from TElement. \o/
This commit is contained in:
parent
1d8d1cb9d9
commit
187a47d89d
3 changed files with 7 additions and 19 deletions
|
@ -395,13 +395,6 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
||||||
fn attr_equals(&self, namespace: &Namespace, attr: &Atom, val: &Atom) -> bool {
|
fn attr_equals(&self, namespace: &Namespace, attr: &Atom, val: &Atom) -> bool {
|
||||||
self.get_attr(namespace, attr).map_or(false, |x| x == val)
|
self.get_attr(namespace, attr).map_or(false, |x| x == val)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str> {
|
|
||||||
unsafe {
|
|
||||||
(*self.element.unsafe_get()).get_attr_val_for_layout(namespace, name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,6 +405,13 @@ impl<'le> ServoLayoutElement<'le> {
|
||||||
chain: PhantomData,
|
chain: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str> {
|
||||||
|
unsafe {
|
||||||
|
(*self.element.unsafe_get()).get_attr_val_for_layout(namespace, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_element<'le>(node: LayoutJS<Node>) -> Option<ServoLayoutElement<'le>> {
|
fn as_element<'le>(node: LayoutJS<Node>) -> Option<ServoLayoutElement<'le>> {
|
||||||
|
|
|
@ -210,8 +210,6 @@ pub trait TElement : Sized + Copy + Clone + ElementExt + PresentationalHintsSynt
|
||||||
fn has_attr(&self, namespace: &Namespace, attr: &Atom) -> bool;
|
fn has_attr(&self, namespace: &Namespace, attr: &Atom) -> bool;
|
||||||
fn attr_equals(&self, namespace: &Namespace, attr: &Atom, value: &Atom) -> bool;
|
fn attr_equals(&self, namespace: &Namespace, attr: &Atom, value: &Atom) -> bool;
|
||||||
|
|
||||||
fn get_attr<'a>(&'a self, namespace: &Namespace, attr: &Atom) -> Option<&'a str>;
|
|
||||||
|
|
||||||
/// Properly marks nodes as dirty in response to restyle hints.
|
/// Properly marks nodes as dirty in response to restyle hints.
|
||||||
fn note_restyle_hint(&self, mut hint: RestyleHint) {
|
fn note_restyle_hint(&self, mut hint: RestyleHint) {
|
||||||
// Bail early if there's no restyling to do.
|
// Bail early if there's no restyling to do.
|
||||||
|
|
|
@ -380,16 +380,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
/* ignoreCase = */ false)
|
/* ignoreCase = */ false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> {
|
|
||||||
unsafe {
|
|
||||||
let mut length: u32 = 0;
|
|
||||||
let ptr = Gecko_GetAttrAsUTF8(self.element, namespace.0.as_ptr(), name.as_ptr(),
|
|
||||||
&mut length);
|
|
||||||
reinterpret_string(ptr, length)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
|
impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue