Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 84cd36c4d819ad38ac12b3b95fd274b68876ec36
      
https://github.com/WebKit/WebKit/commit/84cd36c4d819ad38ac12b3b95fd274b68876ec36
  Author: Anne van Kesteren <ann...@annevk.nl>
  Date:   2025-04-04 (Fri, 04 Apr 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas.html
    M LayoutTests/svg/as-image/svg-image-with-data-uri-reloading.html
    M LayoutTests/svg/as-image/svg-image-with-svg-data-uri.html
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/loader/ImageLoader.cpp
    M Source/WebCore/loader/ImageLoader.h
    M Source/WebCore/platform/graphics/Image.cpp
    M Source/WebCore/platform/graphics/Image.h
    M Source/WebCore/svg/graphics/SVGImage.cpp
    M Source/WebCore/svg/graphics/SVGImage.h

  Log Message:
  -----------
  Improve handling of SVG images with subresources
https://bugs.webkit.org/show_bug.cgi?id=290840

Reviewed by Youenn Fablet.

When a resource is completely fetched, ImageLoader::notifyFinished is
called. This does not quite work for SVG images as they can have local
subresources (data: URLs in particular).

In 292944@main we introduced some infrastructure to handle this better
for ImageUtilities callers. Notably that did not handle multiple layers
of nesting, because it did not improve the situation for HTML <img> and
SVG <image> elements.

In particular if you have a document _DOC_ that references an SVG image
_IMAGE_. And _IMAGE_'s document has an SVG <image> that references
another SVG image _IMAGE2_. And _IMAGE2_'s document references another
image _IMAGE3_, then _IMAGE_'s subresourcesAreFinished() would return
before _IMAGE3_ is ready, because _IMAGE2_ did not increase the delay of
_IMAGE_'s document's load event.

So now we add the infrastructure for those elements to ImageLoader and
SVGImage.

The final bit of complexity here is around supporting multiple
invocations of SVGImage::subresourcesAreFinished by improving
Document::whenWindowLoadEventOrDestroyed. This is needed because
multiple ImageLoader instances can end up pointing to the same SVGImage
instance. E.g., in our test coverage this is hit through SVG <use>
usage.

* LayoutTests/TestExpectations:
* LayoutTests/svg/as-image/svg-image-with-data-uri-from-canvas.html:
* LayoutTests/svg/as-image/svg-image-with-data-uri-reloading.html:
* LayoutTests/svg/as-image/svg-image-with-svg-data-uri.html:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::whenWindowLoadEventOrDestroyed):
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::setImageCompleteAndMaybeUpdateRenderer):
* Source/WebCore/loader/ImageLoader.h:
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::subresourcesAreFinished):
* Source/WebCore/platform/graphics/Image.h:
* Source/WebCore/svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::subresourcesAreFinished):
(WebCore::SVGImage::tryCreateFromData):
* Source/WebCore/svg/graphics/SVGImage.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to