diff options
author | Ms2ger <Ms2ger@gmail.com> | 2016-06-07 11:10:40 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2016-06-07 11:10:40 +0200 |
commit | 5859109197f35edaee07682547c22d27201a60ae (patch) | |
tree | 455a4f6c1b3278d7dcde8d6d213645568d4edb33 | |
parent | ef3c6a7773f31fd8dbdee074893346692adbf8d3 (diff) | |
download | servo-5859109197f35edaee07682547c22d27201a60ae.tar.gz servo-5859109197f35edaee07682547c22d27201a60ae.zip |
Move the definition of ServoThreadSafeLayoutNode::canvas_data to script.
-rw-r--r-- | components/layout/wrapper.rs | 8 | ||||
-rw-r--r-- | components/script/dom/node.rs | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index c7e400cb588..30435fb884a 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -46,7 +46,7 @@ use script::dom::bindings::js::LayoutJS; use script::dom::characterdata::LayoutCharacterDataHelpers; use script::dom::document::{Document, LayoutDocumentHelpers}; use script::dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers}; -use script::dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData}; +use script::dom::htmlcanvaselement::HTMLCanvasData; use script::dom::htmliframeelement::HTMLIFrameElement; use script::dom::node::{CAN_BE_FRAGMENTED, HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY}; use script::dom::node::{LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData}; @@ -1151,10 +1151,8 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { } fn canvas_data(&self) -> Option<HTMLCanvasData> { - unsafe { - let canvas_element = self.get_jsmanaged().downcast(); - canvas_element.map(|canvas| canvas.data()) - } + let this = unsafe { self.get_jsmanaged() }; + this.canvas_data() } fn iframe_pipeline_id(&self) -> PipelineId { diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 9575a7bea16..f265f83a098 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -38,6 +38,7 @@ use dom::documenttype::DocumentType; use dom::element::{Element, ElementCreator}; use dom::eventtarget::EventTarget; use dom::htmlbodyelement::HTMLBodyElement; +use dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData}; use dom::htmlcollection::HTMLCollection; use dom::htmlelement::HTMLElement; use dom::htmlimageelement::{HTMLImageElement, LayoutHTMLImageElementHelpers}; @@ -965,6 +966,7 @@ pub trait LayoutNodeHelpers { fn text_content(&self) -> String; fn selection(&self) -> Option<Range<usize>>; fn image_url(&self) -> Option<Url>; + fn canvas_data(&self) -> Option<HTMLCanvasData>; } impl LayoutNodeHelpers for LayoutJS<Node> { @@ -1094,6 +1096,11 @@ impl LayoutNodeHelpers for LayoutJS<Node> { .image_url() } } + + fn canvas_data(&self) -> Option<HTMLCanvasData> { + self.downcast() + .map(|canvas| canvas.data()) + } } |