aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-06-07 10:57:20 +0200
committerMs2ger <Ms2ger@gmail.com>2016-06-07 10:57:20 +0200
commitef3c6a7773f31fd8dbdee074893346692adbf8d3 (patch)
tree176a4f82d5899f078e5a5d9709f97fb2cffbc45c /components/script/dom
parent093b7b7710a71955ccce8bef74c39178f378116b (diff)
downloadservo-ef3c6a7773f31fd8dbdee074893346692adbf8d3.tar.gz
servo-ef3c6a7773f31fd8dbdee074893346692adbf8d3.zip
Move the definition of ServoThreadSafeLayoutNode::image_url to script.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/node.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index b46b48bc050..9575a7bea16 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -40,6 +40,7 @@ use dom::eventtarget::EventTarget;
use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
+use dom::htmlimageelement::{HTMLImageElement, LayoutHTMLImageElementHelpers};
use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
use dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
use dom::nodelist::NodeList;
@@ -71,6 +72,7 @@ use std::mem;
use std::ops::Range;
use string_cache::{Atom, Namespace, QualName};
use style::selector_impl::ServoSelectorImpl;
+use url::Url;
use util::thread_state;
use uuid::Uuid;
@@ -962,6 +964,7 @@ pub trait LayoutNodeHelpers {
fn text_content(&self) -> String;
fn selection(&self) -> Option<Range<usize>>;
+ fn image_url(&self) -> Option<Url>;
}
impl LayoutNodeHelpers for LayoutJS<Node> {
@@ -1082,6 +1085,15 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
None
}
+
+ #[allow(unsafe_code)]
+ fn image_url(&self) -> Option<Url> {
+ unsafe {
+ self.downcast::<HTMLImageElement>()
+ .expect("not an image!")
+ .image_url()
+ }
+ }
}