mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Implement HTMLIFrameElement::pipeline_id on LayoutJS<HTMLIFrameElement>.
This commit is contained in:
parent
26dd123310
commit
25c19f77af
2 changed files with 14 additions and 4 deletions
|
@ -1014,10 +1014,11 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
/// If this node is an iframe element, returns its pipeline ID. If this node is
|
||||
/// not an iframe element, fails.
|
||||
pub fn iframe_pipeline_id(&self) -> PipelineId {
|
||||
use script::dom::htmliframeelement::HTMLIFrameElementLayoutMethods;
|
||||
unsafe {
|
||||
let iframe_element = HTMLIFrameElementCast::to_layout_js(self.get_jsmanaged())
|
||||
.expect("not an iframe element!");
|
||||
(*iframe_element.unsafe_get()).pipeline_id().unwrap()
|
||||
iframe_element.pipeline_id().unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast};
|
|||
use dom::bindings::conversions::ToJSValConvertible;
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::{Root};
|
||||
use dom::bindings::js::{Root, LayoutJS};
|
||||
use dom::bindings::utils::Reflectable;
|
||||
use dom::customevent::CustomEvent;
|
||||
use dom::document::Document;
|
||||
|
@ -222,10 +222,19 @@ impl HTMLIFrameElement {
|
|||
pub fn subpage_id(&self) -> Option<SubpageId> {
|
||||
self.subpage_id.get()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HTMLIFrameElementLayoutMethods {
|
||||
fn pipeline_id(self) -> Option<PipelineId>;
|
||||
}
|
||||
|
||||
impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
|
||||
#[inline]
|
||||
pub fn pipeline_id(&self) -> Option<PipelineId> {
|
||||
self.pipeline_id.get()
|
||||
#[allow(unsafe_code)]
|
||||
fn pipeline_id(self) -> Option<PipelineId> {
|
||||
unsafe {
|
||||
(*self.unsafe_get()).pipeline_id.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue