Remove *Cast::from_actual.

Since JSRef was removed, from_actual duplicates from_ref.
This commit is contained in:
Ms2ger 2015-07-04 12:55:01 +02:00
parent 02d84a1347
commit 2f88b84e07
3 changed files with 8 additions and 13 deletions

View file

@ -411,7 +411,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
fn is_link(&self) -> bool { fn is_link(&self) -> bool {
// FIXME: This is HTML only. // FIXME: This is HTML only.
let node: &Node = NodeCast::from_actual(self.element); let node: &Node = NodeCast::from_ref(self.element);
match node.type_id_for_layout() { match node.type_id_for_layout() {
// https://html.spec.whatwg.org/multipage/#selector-link // https://html.spec.whatwg.org/multipage/#selector-link
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
@ -438,7 +438,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
#[inline] #[inline]
fn get_hover_state(&self) -> bool { fn get_hover_state(&self) -> bool {
unsafe { unsafe {
let node: &Node = NodeCast::from_actual(self.element); let node: &Node = NodeCast::from_ref(self.element);
node.get_hover_state_for_layout() node.get_hover_state_for_layout()
} }
} }
@ -446,7 +446,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
#[inline] #[inline]
fn get_focus_state(&self) -> bool { fn get_focus_state(&self) -> bool {
unsafe { unsafe {
let node: &Node = NodeCast::from_actual(self.element); let node: &Node = NodeCast::from_ref(self.element);
node.get_focus_state_for_layout() node.get_focus_state_for_layout()
} }
} }
@ -461,7 +461,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
#[inline] #[inline]
fn get_disabled_state(&self) -> bool { fn get_disabled_state(&self) -> bool {
unsafe { unsafe {
let node: &Node = NodeCast::from_actual(self.element); let node: &Node = NodeCast::from_ref(self.element);
node.get_disabled_state_for_layout() node.get_disabled_state_for_layout()
} }
} }
@ -469,7 +469,7 @@ impl<'le> ::selectors::Element for LayoutElement<'le> {
#[inline] #[inline]
fn get_enabled_state(&self) -> bool { fn get_enabled_state(&self) -> bool {
unsafe { unsafe {
let node: &Node = NodeCast::from_actual(self.element); let node: &Node = NodeCast::from_ref(self.element);
node.get_enabled_state_for_layout() node.get_enabled_state_for_layout()
} }
} }

View file

@ -5736,7 +5736,7 @@ class GlobalGenRoots():
impl ${selfName} for ${baseName} { impl ${selfName} for ${baseName} {
#[inline] #[inline]
fn ${fname}(&self) -> bool { fn ${fname}(&self) -> bool {
let base: &${parentName} = ${parentName}Cast::from_actual(self); let base: &${parentName} = ${parentName}Cast::from_ref(self);
base.${fname}() base.${fname}()
} }
} }
@ -5805,11 +5805,6 @@ impl ${name}Cast {
pub fn from_root<T: ${fromBound}+Reflectable>(derived: Root<T>) -> Root<${name}> { pub fn from_root<T: ${fromBound}+Reflectable>(derived: Root<T>) -> Root<${name}> {
unsafe { mem::transmute(derived) } unsafe { mem::transmute(derived) }
} }
#[inline]
pub fn from_actual<'a, T: ${fromBound}+Reflectable>(derived: &'a T) -> &'a ${name} {
unsafe { mem::transmute(derived) }
}
} }
""").substitute({'checkFn': 'is_' + name.lower(), """).substitute({'checkFn': 'is_' + name.lower(),
'name': name, 'name': name,

View file

@ -180,7 +180,7 @@ impl RawHTMLIFrameElementHelpers for HTMLIFrameElement {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn get_width(&self) -> LengthOrPercentageOrAuto { fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
element::get_attr_for_layout(ElementCast::from_actual(&*self), element::get_attr_for_layout(ElementCast::from_ref(&*self),
&ns!(""), &ns!(""),
&atom!("width")).map(|attribute| { &atom!("width")).map(|attribute| {
str::parse_length(&**attribute.value_for_layout()) str::parse_length(&**attribute.value_for_layout())
@ -191,7 +191,7 @@ impl RawHTMLIFrameElementHelpers for HTMLIFrameElement {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn get_height(&self) -> LengthOrPercentageOrAuto { fn get_height(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
element::get_attr_for_layout(ElementCast::from_actual(&*self), element::get_attr_for_layout(ElementCast::from_ref(&*self),
&ns!(""), &ns!(""),
&atom!("height")).map(|attribute| { &atom!("height")).map(|attribute| {
str::parse_length(&**attribute.value_for_layout()) str::parse_length(&**attribute.value_for_layout())