mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Move the definition of ServoThreadSafeLayoutNode::image_url to script.
This commit is contained in:
parent
093b7b7710
commit
ef3c6a7773
2 changed files with 14 additions and 6 deletions
|
@ -48,7 +48,6 @@ use script::dom::document::{Document, LayoutDocumentHelpers};
|
|||
use script::dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
|
||||
use script::dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData};
|
||||
use script::dom::htmliframeelement::HTMLIFrameElement;
|
||||
use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
|
||||
use script::dom::node::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
|
||||
use script::dom::node::{LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData};
|
||||
use script::dom::text::Text;
|
||||
|
@ -1147,11 +1146,8 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
|||
}
|
||||
|
||||
fn image_url(&self) -> Option<Url> {
|
||||
unsafe {
|
||||
self.get_jsmanaged().downcast()
|
||||
.expect("not an image!")
|
||||
.image_url()
|
||||
}
|
||||
let this = unsafe { self.get_jsmanaged() };
|
||||
this.image_url()
|
||||
}
|
||||
|
||||
fn canvas_data(&self) -> Option<HTMLCanvasData> {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue