dom: should change media element's currentSrc to children source element's src in resource selection algorithm. (#36408)

Set the `htmlmediaelement`'s `currenSrc` in
resource-selection-algorithm.
Change the `htmlsourceelement`'s src and srcset to USVString type.

According to
[Spec](https://html.spec.whatwg.org/multipage/media.html#concept-media-load-algorithm),
Step 9.3 for mode is children, should set the `currentSrc` to `src` of
children `htmlsourceelement`.
Also, In the `htmlsourceelement` [interface
definition](https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element),
the `src` and `srcset` attribute should be type `USVString`.

Testing: More WPT tests related to resource selection algorithm are
passing.
Fix: Some spec fix

[Try](https://github.com/rayguo17/servo/actions/runs/14347535616)
cc @xiaochengh

Signed-off-by: rayguo17 <rayguo17@gmail.com>
This commit is contained in:
TIN TUN AUNG 2025-04-11 14:32:34 +08:00 committed by GitHub
parent c8ecb57d97
commit 972ca77ce1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 22 additions and 45 deletions

View file

@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourc
use crate::dom::bindings::codegen::Bindings::NodeBinding::Node_Binding::NodeMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{Dom, DomRoot, Root};
use crate::dom::bindings::str::DOMString;
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::document::Document;
use crate::dom::element::AttributeMutation;
use crate::dom::htmlelement::HTMLElement;
@ -119,10 +119,10 @@ impl VirtualMethods for HTMLSourceElement {
impl HTMLSourceElementMethods<crate::DomTypeHolder> for HTMLSourceElement {
// https://html.spec.whatwg.org/multipage/#dom-source-src
make_getter!(Src, "src");
make_url_getter!(Src, "src");
// https://html.spec.whatwg.org/multipage/#dom-source-src
make_setter!(SetSrc, "src");
make_url_setter!(SetSrc, "src");
// https://html.spec.whatwg.org/multipage/#dom-source-type
make_getter!(Type, "type");
@ -131,10 +131,10 @@ impl HTMLSourceElementMethods<crate::DomTypeHolder> for HTMLSourceElement {
make_setter!(SetType, "type");
// https://html.spec.whatwg.org/multipage/#dom-source-srcset
make_getter!(Srcset, "srcset");
make_url_getter!(Srcset, "srcset");
// https://html.spec.whatwg.org/multipage/#dom-source-srcset
make_setter!(SetSrcset, "srcset");
make_url_setter!(SetSrcset, "srcset");
// https://html.spec.whatwg.org/multipage/#dom-source-sizes
make_getter!(Sizes, "sizes");