Skip to content

Commit 5ed0c54

Browse files
committed
Reuse hasPendingActivity() in ImageLoader
https://bugs.webkit.org/show_bug.cgi?id=290914 Reviewed by Tim Nguyen. hasPendingActivity() encompasses the exact logic that is needed in updatedHasPendingEvent() so might as well use it. * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::updatedHasPendingEvent): Canonical link: https://commits.webkit.org/293118@main
1 parent 224847f commit 5ed0c54

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Source/WebCore/loader/ImageLoader.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,7 @@ void ImageLoader::updatedHasPendingEvent()
547547
// destroyed by DOM manipulation or garbage collection.
548548
// If such an Element wishes for the load to stop when removed from the DOM it needs to stop the ImageLoader explicitly.
549549
bool wasProtected = m_elementIsProtected;
550-
551-
// Because of lazy image loading, an image's load may be deferred indefinitely. To avoid leaking the element, we only
552-
// protect it once the load has actually started.
553-
bool imageWillBeLoadedLater = m_image && !m_image->isLoading() && m_image->stillNeedsLoad();
554-
555-
m_elementIsProtected = (m_hasPendingLoadEvent && !imageWillBeLoadedLater) || m_hasPendingErrorEvent;
550+
m_elementIsProtected = hasPendingActivity();
556551
if (wasProtected == m_elementIsProtected)
557552
return;
558553

0 commit comments

Comments
 (0)