aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/htmlimageelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/htmlimageelement.rs')
-rw-r--r--src/components/script/dom/htmlimageelement.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/script/dom/htmlimageelement.rs b/src/components/script/dom/htmlimageelement.rs
index 35d85441e64..6bc113b5891 100644
--- a/src/components/script/dom/htmlimageelement.rs
+++ b/src/components/script/dom/htmlimageelement.rs
@@ -2,6 +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::AttrValue;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, HTMLElementCast, HTMLImageElementDerived};
use dom::bindings::js::{JS, JSRef, Temporary};
@@ -199,7 +200,7 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
fn Hspace(&self) -> u32 {
let element: &JSRef<Element> = ElementCast::from_ref(self);
- from_str::<u32>(element.get_string_attribute("hspace").as_slice()).unwrap()
+ element.get_uint_attribute("hspace")
}
fn SetHspace(&self, hspace: u32) {
@@ -209,7 +210,7 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
fn Vspace(&self) -> u32 {
let element: &JSRef<Element> = ElementCast::from_ref(self);
- from_str::<u32>(element.get_string_attribute("vspace").as_slice()).unwrap()
+ element.get_uint_attribute("vspace")
}
fn SetVspace(&self, vspace: u32) {
@@ -267,4 +268,11 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLImageElement> {
self.update_image(None, None);
}
}
+
+ fn parse_plain_attribute(&self, name: &str, value: DOMString) -> AttrValue {
+ match name {
+ "width" | "height" | "hspace" | "vspace" => AttrValue::from_u32(value, 0),
+ _ => self.super_type().unwrap().parse_plain_attribute(name, value),
+ }
+ }
}