[Webkit-unassigned] [Bug 245883] New: <img> elements are always treated as a replaced element

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 30 07:41:27 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=245883

            Bug ID: 245883
           Summary: <img> elements are always treated as a replaced
                    element
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: cathiechen at igalia.com

Per [1] and [2], when it is fail to download the image data, <img> element is not always treated as a replaced element. It could be treated as a text or empty inline element, which is depended on the values of attributes src and alt, intrinsic dimensions, and so on.
In WebKit, HTMLImageElement always creates RenderImage as its renderer, and let RenderImage handle the scenarios in which <img> represents alt text or nothing. This could cause some issues like bugs 245136 and 244386. Or <img> does not display the content proper when alt or src attributes change (See test cases in the attachment). Or the alt text is too long, it is not displayed.
Should we consider creating a different renderer for <img> depending on which type of content it represents, and create a shadawRoot to display the alt text if needed?
Something similar to the implementation in Chromium [3].

[1] https://www.w3.org/TR/2016/WD-html51-20160412/rendering.html#replaced-elements-images
[2] https://www.w3.org/TR/2016/WD-html51-20160412/semantics-embedded-content.html#the-img-element
[3] https://codereview.chromium.org/481753002

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220930/6e7c9ee3/attachment.htm>


More information about the webkit-unassigned mailing list