aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2015-11-08 00:09:15 -0800
committerEli Friedman <eli.friedman@gmail.com>2015-11-09 10:47:37 -0800
commit5293afc122626d997bab168554ac0a3cbb5ab03c (patch)
treeedc08688bcf1bc2d03a432cbbcca5c0bfaa0d6e8 /components/script/dom/htmliframeelement.rs
parentef52da7acdcfbcf5b15cc82c2434f60ade0d0e33 (diff)
downloadservo-5293afc122626d997bab168554ac0a3cbb5ab03c.tar.gz
servo-5293afc122626d997bab168554ac0a3cbb5ab03c.zip
Move unsafe layout calls onto LayoutJS.
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs48
1 files changed, 24 insertions, 24 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 37564d22e54..6bc48da1c4f 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use dom::attr::{Attr, AttrHelpersForLayout, AttrValue};
+use dom::attr::{Attr, AttrValue};
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
@@ -14,7 +14,7 @@ use dom::bindings::js::{Root, LayoutJS};
use dom::bindings::reflector::Reflectable;
use dom::customevent::CustomEvent;
use dom::document::Document;
-use dom::element::{self, AttributeMutation, Element};
+use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
use dom::event::Event;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, window_from_node};
@@ -156,28 +156,6 @@ impl HTMLIFrameElement {
self.subpage_id.set(Some(new_subpage_id));
}
- #[allow(unsafe_code)]
- pub fn get_width(&self) -> LengthOrPercentageOrAuto {
- unsafe {
- element::get_attr_for_layout(self.upcast(),
- &ns!(""),
- &atom!("width")).map(|attribute| {
- str::parse_length(&**attribute.value_for_layout())
- }).unwrap_or(LengthOrPercentageOrAuto::Auto)
- }
- }
-
- #[allow(unsafe_code)]
- pub fn get_height(&self) -> LengthOrPercentageOrAuto {
- unsafe {
- element::get_attr_for_layout(self.upcast(),
- &ns!(""),
- &atom!("height")).map(|attribute| {
- str::parse_length(&**attribute.value_for_layout())
- }).unwrap_or(LengthOrPercentageOrAuto::Auto)
- }
- }
-
fn new_inherited(localName: DOMString,
prefix: Option<DOMString>,
document: &Document) -> HTMLIFrameElement {
@@ -211,6 +189,8 @@ impl HTMLIFrameElement {
pub trait HTMLIFrameElementLayoutMethods {
fn pipeline_id(self) -> Option<PipelineId>;
+ fn get_width(&self) -> LengthOrPercentageOrAuto;
+ fn get_height(&self) -> LengthOrPercentageOrAuto;
}
impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
@@ -221,6 +201,26 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
(*self.unsafe_get()).pipeline_id.get()
}
}
+
+ #[allow(unsafe_code)]
+ fn get_width(&self) -> LengthOrPercentageOrAuto {
+ unsafe {
+ (*self.upcast::<Element>().unsafe_get())
+ .get_attr_for_layout(&ns!(""), &atom!("width"))
+ .map(|attribute| str::parse_length(&attribute))
+ .unwrap_or(LengthOrPercentageOrAuto::Auto)
+ }
+ }
+
+ #[allow(unsafe_code)]
+ fn get_height(&self) -> LengthOrPercentageOrAuto {
+ unsafe {
+ (*self.upcast::<Element>().unsafe_get())
+ .get_attr_for_layout(&ns!(""), &atom!("height"))
+ .map(|attribute| str::parse_length(&attribute))
+ .unwrap_or(LengthOrPercentageOrAuto::Auto)
+ }
+ }
}
pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> Fallible<()> {