html: Properly count <image>/<source> insertion/removal steps as the relevant mutations (#39452)

Follow the HTML specification and take into account that the HTML
`<image>/<source>` element inserting/removal steps should only be
counted as relevant mutations for `<image>` element if the parent of the
inclusive ancestor that was inserted/removed is the parent `<picture>`
element.

See <https://html.spec.whatwg.org/multipage/#relevant-mutations>.

Testing: Improvements in the following tests
-
html/semantics/embedded-content/the-img-element/relevant-mutations.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
Andrei Volykhin 2025-09-23 15:40:03 +03:00 committed by GitHub
parent c63311af02
commit 99fbd36b5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 75 additions and 71 deletions

View file

@ -1,30 +1,12 @@
[relevant-mutations.html]
[ancestor picture; previous sibling source inserted]
expected: FAIL
[picture is inserted; img has previous sibling source]
expected: FAIL
[ancestor picture; previous sibling source removed]
expected: FAIL
[crossorigin state not changed: empty to anonymous]
expected: FAIL
[picture is inserted; img has following sibling source]
expected: FAIL
[picture is inserted; img has src]
expected: FAIL
[crossorigin state not changed: use-credentials to USE-CREDENTIALS]
expected: FAIL
[crossorigin state not changed: anonymous to foobar]
expected: FAIL
[picture is inserted; img has srcset]
expected: FAIL
[sizes is set to same value]
expected: FAIL