Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a75ff815de73fbcd5ba8992f6daccf3bf9a7e0f6
      
https://github.com/WebKit/WebKit/commit/a75ff815de73fbcd5ba8992f6daccf3bf9a7e0f6
  Author: Ahmad Saleem <[email protected]>
  Date:   2025-12-29 (Mon, 29 Dec 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
    M 
LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
    M 
LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
    M 
LayoutTests/platform/mac/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
    M Source/WebCore/html/HTMLImageElement.cpp

  Log Message:
  -----------
  Fix HTMLImageElement.currentSrc for empty src attribute
https://bugs.webkit.org/show_bug.cgi?id=304723
rdar://167229274

Reviewed by Chris Dumez.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Don't resolve empty src attributes to the document base URL when
setting the image's current URL. The completeURL() call should only
be made for non-empty source URLs to comply with the HTML specification [1].

When the source URL is empty, the current URL should be set to an empty
URL rather than resolving to the document's base URL, ensuring currentSrc
returns the empty string as specified.

[1] 
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc

* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::setBestFitURLAndDPRFromImageCandidate):
> Progression:
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt:
* 
LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt:
* 
LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt:
* 
LayoutTests/platform/mac/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt:

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



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

Reply via email to