[webkit-changes] [WebKit/WebKit] a9623f: Avoid calling selectImageSource when attribute val...

Ryosuke Niwa noreply at github.com
Wed Jan 17 14:55:24 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a9623f4e66388a31261fe1e715ffb7fbb7bb8cfa
      https://github.com/WebKit/WebKit/commit/a9623f4e66388a31261fe1e715ffb7fbb7bb8cfa
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-01-17 (Wed, 17 Jan 2024)

  Changed paths:
    M Source/WebCore/html/HTMLImageElement.cpp
    M Source/WebCore/loader/ImageLoader.cpp
    M Source/WebCore/loader/ImageLoader.h

  Log Message:
  -----------
  Avoid calling selectImageSource when attribute value didn't change
https://bugs.webkit.org/show_bug.cgi?id=267315

Reviewed by Alex Christensen.

This PR adds a fast path for setting src to the same value in HTMLImageElement::attributeChanged.
In this case, we check whether image loading is observable or not (e.g. has a service worker),
and it if isn't, we avoid going through the full image loading path and simply fire the load event instead.

* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::attributeChanged):
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElementIgnoringPreviousErrorToSameValue):
* Source/WebCore/loader/ImageLoader.h:

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




More information about the webkit-changes mailing list