Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the amount of dom code used outside the script crate. #11656

Merged
merged 8 commits into from Jun 7, 2016

Move the definition of ServoThreadSafeLayoutNode::iframe_pipeline_id …

…to script.
  • Loading branch information
Ms2ger committed Jun 7, 2016
commit 858ea2eb9afdee0767a4d35b7f858fde03dd6108
@@ -47,7 +47,6 @@ use script::dom::characterdata::LayoutCharacterDataHelpers;
use script::dom::document::{Document, LayoutDocumentHelpers};
use script::dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
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};
use script::dom::text::Text;
@@ -1156,12 +1155,8 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
}

fn iframe_pipeline_id(&self) -> PipelineId {
use script::dom::htmliframeelement::HTMLIFrameElementLayoutMethods;
unsafe {
let iframe_element = self.get_jsmanaged().downcast::<HTMLIFrameElement>()
.expect("not an iframe element!");
iframe_element.pipeline_id().unwrap()
}
let this = unsafe { self.get_jsmanaged() };
this.iframe_pipeline_id()
}

fn get_colspan(&self) -> u32 {
@@ -41,6 +41,7 @@ use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlcanvaselement::{LayoutHTMLCanvasElementHelpers, HTMLCanvasData};
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
use dom::htmliframeelement::{HTMLIFrameElement, HTMLIFrameElementLayoutMethods};
use dom::htmlimageelement::{HTMLImageElement, LayoutHTMLImageElementHelpers};
use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
use dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
@@ -58,6 +59,7 @@ use html5ever::tree_builder::QuirksMode;
use js::jsapi::{JSContext, JSObject, JSRuntime};
use layout_interface::Msg;
use libc::{self, c_void, uintptr_t};
use msg::constellation_msg::PipelineId;
use parse::html::parse_html_fragment;
use ref_slice::ref_slice;
use script_traits::UntrustedNodeAddress;
@@ -967,6 +969,7 @@ pub trait LayoutNodeHelpers {
fn selection(&self) -> Option<Range<usize>>;
fn image_url(&self) -> Option<Url>;
fn canvas_data(&self) -> Option<HTMLCanvasData>;
fn iframe_pipeline_id(&self) -> PipelineId;
}

impl LayoutNodeHelpers for LayoutJS<Node> {
@@ -1101,6 +1104,12 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
self.downcast()
.map(|canvas| canvas.data())
}

fn iframe_pipeline_id(&self) -> PipelineId {
let iframe_element = self.downcast::<HTMLIFrameElement>()
.expect("not an iframe element!");
iframe_element.pipeline_id().unwrap()
}
}


ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.