Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 621ca2e48495592e7dceb1ae4ad9c837f2189d2c
      
https://github.com/WebKit/WebKit/commit/621ca2e48495592e7dceb1ae4ad9c837f2189d2c
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-03-18 (Wed, 18 Mar 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/adoption-expected.txt
    M Source/WebCore/html/HTMLImageElement.cpp

  Log Message:
  -----------
  Adopting a standalone img element should update its image data
https://bugs.webkit.org/show_bug.cgi?id=310208
rdar://172856773

Reviewed by Ryosuke Niwa.

In HTMLImageElement::didMoveToNewDocument, HTMLImageElement::selectImageSource()
was called before ImageLoader::elementDidMoveToNewDocument(), which calls
ImageLoader::clearImage() and cancels the pending load event that was just
scheduled. For img elements inside a <picture>, this was masked because
HTMLPictureElement::sourcesChanged() re-triggered the load afterward. For
standalone img elements, the load was simply lost.

Fix by swapping the order: call ImageLoader::elementDidMoveToNewDocument()
first to clear the old image state, then HTMLImageElement::selectImageSource()
to select the new image source.

* LayoutTests/TestExpectations: Unskip test
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/adoption-expected.txt:
 Progressions
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::didMoveToNewDocument):

Canonical link: https://commits.webkit.org/309523@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to