Title: [284901] trunk
Revision
284901
Author
[email protected]
Date
2021-10-26 14:49:46 -0700 (Tue, 26 Oct 2021)

Log 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.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284900 => 284901)


--- trunk/LayoutTests/ChangeLog	2021-10-26 21:42:08 UTC (rev 284900)
+++ trunk/LayoutTests/ChangeLog	2021-10-26 21:49:46 UTC (rev 284901)
@@ -1,3 +1,14 @@
+2021-10-26  Chris Dumez  <[email protected]>
+
+        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.
+
+        Unskip test that is no longer timing out.
+
+        * TestExpectations:
+
 2021-10-26  John Wilander  <[email protected]>
 
         [ iOS 15 ] ASSERTION FAILED: isRunningTest(WebCore::applicationBundleIdentifier())

Modified: trunk/LayoutTests/TestExpectations (284900 => 284901)


--- trunk/LayoutTests/TestExpectations	2021-10-26 21:42:08 UTC (rev 284900)
+++ trunk/LayoutTests/TestExpectations	2021-10-26 21:49:46 UTC (rev 284901)
@@ -569,7 +569,6 @@
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-change-src.html [ Skip ]
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html [ Skip ]
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_change_hash.html [ Skip ]
-imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document.html [ Skip ]
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/natural-size-orientation.html [ Skip ]
 imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-multiple-targets.html [ Skip ]
 imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-to-different-origin-frame.html [ Skip ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (284900 => 284901)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-26 21:42:08 UTC (rev 284900)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-26 21:49:46 UTC (rev 284901)
@@ -1,5 +1,16 @@
 2021-10-26  Chris Dumez  <[email protected]>
 
+        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.
+
+        Rebaseline test that is now passing.
+
+        * web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt:
+
+2021-10-26  Chris Dumez  <[email protected]>
+
         error event should be fired at <style> element when @import rule fails parsing due to MIME type
         https://bugs.webkit.org/show_bug.cgi?id=232313
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt (284900 => 284901)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt	2021-10-26 21:42:08 UTC (rev 284900)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/decode/image-decode-image-document-expected.txt	2021-10-26 21:49:46 UTC (rev 284901)
@@ -1,6 +1,4 @@
 
 
-Harness Error (TIMEOUT), message = null
+PASS HTMLImageElement.prototype.decode(), image document tests. Decode from iframe with image document, succeeds (img not loaded)
 
-TIMEOUT HTMLImageElement.prototype.decode(), image document tests. Decode from iframe with image document, succeeds (img not loaded) Test timed out
-

Modified: trunk/Source/WebCore/ChangeLog (284900 => 284901)


--- trunk/Source/WebCore/ChangeLog	2021-10-26 21:42:08 UTC (rev 284900)
+++ trunk/Source/WebCore/ChangeLog	2021-10-26 21:49:46 UTC (rev 284901)
@@ -1,3 +1,25 @@
+2021-10-26  Chris Dumez  <[email protected]>
+
+        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.
+
+        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):
+
 2021-10-26  Sihui Liu  <[email protected]>
 
         FileSystemHandle should be ContextDestructionObserver

Modified: trunk/Source/WebCore/html/ImageDocument.cpp (284900 => 284901)


--- trunk/Source/WebCore/html/ImageDocument.cpp	2021-10-26 21:42:08 UTC (rev 284900)
+++ trunk/Source/WebCore/html/ImageDocument.cpp	2021-10-26 21:49:46 UTC (rev 284901)
@@ -242,6 +242,7 @@
     imageElement->setSrc(url().string());
     imageElement->cachedImage()->setResponse(loader()->response());
     body->appendChild(imageElement);
+    imageElement->setLoadManually(false);
     
     if (m_shouldShrinkImage) {
 #if PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to