Changeset 284901 in webkit


Ignore:
Timestamp:
Oct 26, 2021 2:49:46 PM (9 months ago)
Author:
Chris Dumez
Message:

Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load
https://bugs.webkit.org/show_bug.cgi?id=232323

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline test that is now passing.

  • web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt:

Source/WebCore:

Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load.
This is because when constructing the ImageDocument, we set that <img> element's ImageLoader into
manual loading mode so that we can feed it the network response we already have instead of triggering
a new load.

To address the issue, we now reset the <img> element's ImageLoader to automatic loading mode once
we've set its initial src attribute. Setting the src attribute is what ends up calling
ImageLoader::updateFromElement(), which checks the |manual loading| flag. This way, any later attempt
to change the src attribute will actually trigger an automatic load.

No new tests, unskipped existing test.

  • html/ImageDocument.cpp:

(WebCore::ImageDocument::createDocumentStructure):

LayoutTests:

Unskip test that is no longer timing out.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284899 r284901  
     12021-10-26  Chris Dumez  <cdumez@apple.com>
     2
     3        Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load
     4        https://bugs.webkit.org/show_bug.cgi?id=232323
     5
     6        Reviewed by Alex Christensen.
     7
     8        Unskip test that is no longer timing out.
     9
     10        * TestExpectations:
     11
    1122021-10-26  John Wilander  <wilander@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r284898 r284901  
    570570imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html [ Skip ]
    571571imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_change_hash.html [ Skip ]
    572 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document.html [ Skip ]
    573572imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/natural-size-orientation.html [ Skip ]
    574573imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-multiple-targets.html [ Skip ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r284898 r284901  
     12021-10-26  Chris Dumez  <cdumez@apple.com>
     2
     3        Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load
     4        https://bugs.webkit.org/show_bug.cgi?id=232323
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline test that is now passing.
     9
     10        * web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt:
     11
    1122021-10-26  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt

    r263987 r284901  
    11
    22
    3 Harness Error (TIMEOUT), message = null
     3PASS HTMLImageElement.prototype.decode(), image document tests. Decode from iframe with image document, succeeds (img not loaded)
    44
    5 TIMEOUT HTMLImageElement.prototype.decode(), image document tests. Decode from iframe with image document, succeeds (img not loaded) Test timed out
    6 
  • trunk/Source/WebCore/ChangeLog

    r284900 r284901  
     12021-10-26  Chris Dumez  <cdumez@apple.com>
     2
     3        Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load
     4        https://bugs.webkit.org/show_bug.cgi?id=232323
     5
     6        Reviewed by Alex Christensen.
     7
     8        Changing the src attribute of the <img> element inside an ImageDocument does not trigger a load.
     9        This is because when constructing the ImageDocument, we set that <img> element's ImageLoader into
     10        manual loading mode so that we can feed it the network response we already have instead of triggering
     11        a new load.
     12
     13        To address the issue, we now reset the <img> element's ImageLoader to automatic loading mode once
     14        we've set its initial src attribute. Setting the src attribute is what ends up calling
     15        ImageLoader::updateFromElement(), which checks the |manual loading| flag. This way, any later attempt
     16        to change the src attribute will actually trigger an automatic load.
     17
     18        No new tests, unskipped existing test.
     19
     20        * html/ImageDocument.cpp:
     21        (WebCore::ImageDocument::createDocumentStructure):
     22
    1232021-10-26  Sihui Liu  <sihui_liu@apple.com>
    224
  • trunk/Source/WebCore/html/ImageDocument.cpp

    r278532 r284901  
    243243    imageElement->cachedImage()->setResponse(loader()->response());
    244244    body->appendChild(imageElement);
     245    imageElement->setLoadManually(false);
    245246   
    246247    if (m_shouldShrinkImage) {
Note: See TracChangeset for help on using the changeset viewer.