diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-25 00:28:59 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-25 00:35:35 +0200 |
commit | 5245931dc283af528bb085f652d41856246b01bb (patch) | |
tree | 1f27b10a4d6d90563f9767135b673a80dadafc64 /components/script/dom/htmlsourceelement.rs | |
parent | 49dd04cd8b6beb4cc44991f5bbf945f6c3fa8fd5 (diff) | |
download | servo-5245931dc283af528bb085f652d41856246b01bb.tar.gz servo-5245931dc283af528bb085f652d41856246b01bb.zip |
Implement the error path for source children of media elements
This removes some test timeout.
Diffstat (limited to 'components/script/dom/htmlsourceelement.rs')
-rw-r--r-- | components/script/dom/htmlsourceelement.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index 84adbc16548..865b21d6acb 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -3,10 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; +use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; +use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; +use dom::htmlmediaelement::HTMLMediaElement; use dom::node::Node; +use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; @@ -34,3 +38,18 @@ impl HTMLSourceElement { HTMLSourceElementBinding::Wrap) } } + +impl VirtualMethods for HTMLSourceElement { + fn super_type(&self) -> Option<&VirtualMethods> { + Some(self.upcast::<HTMLElement>() as &VirtualMethods) + } + + /// https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted + fn bind_to_tree(&self, tree_in_doc: bool) { + self.super_type().unwrap().bind_to_tree(tree_in_doc); + let parent = self.upcast::<Node>().GetParentNode().unwrap(); + if let Some(media) = parent.downcast::<HTMLMediaElement>() { + media.handle_source_child_insertion(); + } + } +} |