mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement the error path for source children of media elements
This removes some test timeout.
This commit is contained in:
parent
49dd04cd8b
commit
5245931dc2
8 changed files with 54 additions and 24 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue