mirror of
https://github.com/servo/servo
synced 2026-04-30 19:37:43 +02:00
html: Support selecting <media> element source from children (#39717)
Follow the HTML implemetation and support selection of the 'media' element loading source from 'source' children elements with validation processing over their 'media/src/type' attributes. See https://html.spec.whatwg.org/multipage/#concept-media-load-algorithm To handle loading with multiple 'source' children was introduced source children pointer to track the remaining unprocessed 'source' elements after the resource selection algorithm was invoked. Testing: Changes in the following tests with improvements: - html/semantics/embedded-content/media-elements/loading-the-media-resource/* - webgl/tests/conformance/textures/misc/texture-video-transparent.html with regressions (after enabled 'source' type attribute validation): - content-security-policy/media-src/media-src* - mixed-content/gen/top\*audio|video-tag* - resource-timing/initiator-type/* Fixes: https://github.com/servo/servo/issues/21481 Fixes: https://github.com/servo/servo/issues/34127 Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
@@ -105,8 +105,11 @@ impl VirtualMethods for HTMLSourceElement {
|
||||
|
||||
// Step 2. If parent is a media element that has no src attribute and whose networkState has
|
||||
// the value NETWORK_EMPTY, then invoke that media element's resource selection algorithm.
|
||||
if let Some(media) = parent.downcast::<HTMLMediaElement>() {
|
||||
media.handle_source_child_insertion(can_gc);
|
||||
if parent.is::<HTMLMediaElement>() && std::ptr::eq(&*parent, context.parent) {
|
||||
parent
|
||||
.downcast::<HTMLMediaElement>()
|
||||
.unwrap()
|
||||
.handle_source_child_insertion(self, can_gc);
|
||||
}
|
||||
|
||||
// Step 3. If parent is a picture element, then for each child of parent's children, if
|
||||
|
||||
Reference in New Issue
Block a user