mirror of
https://github.com/servo/servo.git
synced 2025-07-15 19:33:46 +01:00
dom: add media_data() method to LayoutDom implementation
This commit is contained in:
parent
74a9edfed3
commit
da5d1d462f
1 changed files with 14 additions and 2 deletions
|
@ -43,6 +43,7 @@ use dom::htmliframeelement::{HTMLIFrameElement, HTMLIFrameElementLayoutMethods};
|
|||
use dom::htmlimageelement::{HTMLImageElement, LayoutHTMLImageElementHelpers};
|
||||
use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
|
||||
use dom::htmllinkelement::HTMLLinkElement;
|
||||
use dom::htmlmediaelement::{HTMLMediaElement, LayoutHTMLMediaElementHelpers};
|
||||
use dom::htmlmetaelement::HTMLMetaElement;
|
||||
use dom::htmlstyleelement::HTMLStyleElement;
|
||||
use dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
|
||||
|
@ -62,9 +63,11 @@ use libc::{self, c_void, uintptr_t};
|
|||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use ref_slice::ref_slice;
|
||||
use script_layout_interface::{HTMLCanvasData, OpaqueStyleAndLayoutData, SVGSVGData};
|
||||
use script_layout_interface::{LayoutElementType, LayoutNodeType, TrustedNodeAddress};
|
||||
use script_layout_interface::message::Msg;
|
||||
use script_layout_interface::{
|
||||
HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, OpaqueStyleAndLayoutData,
|
||||
SVGSVGData, TrustedNodeAddress,
|
||||
};
|
||||
use script_thread::ScriptThread;
|
||||
use script_traits::DocumentActivity;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
|
@ -1086,6 +1089,7 @@ pub trait LayoutNodeHelpers {
|
|||
fn image_url(&self) -> Option<ServoUrl>;
|
||||
fn image_density(&self) -> Option<f64>;
|
||||
fn canvas_data(&self) -> Option<HTMLCanvasData>;
|
||||
fn media_data(&self) -> Option<HTMLMediaData>;
|
||||
fn svg_data(&self) -> Option<SVGSVGData>;
|
||||
fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId>;
|
||||
fn iframe_pipeline_id(&self) -> Option<PipelineId>;
|
||||
|
@ -1245,6 +1249,11 @@ impl LayoutNodeHelpers for LayoutDom<Node> {
|
|||
.map(|canvas| canvas.data())
|
||||
}
|
||||
|
||||
fn media_data(&self) -> Option<HTMLMediaData> {
|
||||
self.downcast::<HTMLMediaElement>()
|
||||
.map(|media| media.data())
|
||||
}
|
||||
|
||||
fn svg_data(&self) -> Option<SVGSVGData> {
|
||||
self.downcast::<SVGSVGElement>().map(|svg| svg.data())
|
||||
}
|
||||
|
@ -2911,6 +2920,9 @@ impl Into<LayoutElementType> for ElementTypeId {
|
|||
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement) => {
|
||||
LayoutElementType::HTMLImageElement
|
||||
},
|
||||
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)) => {
|
||||
LayoutElementType::HTMLMediaElement
|
||||
},
|
||||
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement) => {
|
||||
LayoutElementType::HTMLInputElement
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue