Skip to content

Commit

Permalink
Unreviewed, reverting r254127@main.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=247297

Causes some images with loading=lazy to not load

Reverted changeset:

"Fix image-loading-lazy-multiple-times.html"
https://bugs.webkit.org/show_bug.cgi?id=216979
https://commits.webkit.org/254127@main

Canonical link: https://commits.webkit.org/256175@main
  • Loading branch information
webkit-commit-queue authored and Said Abou-Hallawa committed Oct 31, 2022
1 parent ca201a7 commit ddc412d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
@@ -1,4 +1,4 @@


PASS Images with loading='lazy' can be lazy loaded multiple times
FAIL Images with loading='lazy' can be lazy loaded multiple times assert_unreached: The loading=lazy below-viewport image should lazily load its second image, and not load it eagerly when the `src` attribute is changed Reached unreachable code

Expand Up @@ -37,24 +37,19 @@
function changeImageSourceAndScrollToTop() {
top_div.scrollIntoView();

// Allow some time for scroll back to top, since we don't
// want the image to still be in the viewport and trigger a
// load due to the scroll being slow.
// Lazily load a "different" image.
image.src = 'resources/image.png?image-loading-lazy-multiple-times-second';
image.onload =
t.unreached_func("The loading=lazy below-viewport image should lazily " +
"load its second image, and not load it eagerly when " +
"the `src` attribute is changed");

// In 1s, scroll the image *back* into view, and record that it loads
// successfully.
t.step_timeout(() => {
// Lazily load a "different" image.
image.src = 'resources/image.png?image-loading-lazy-multiple-times-second';
image.onload =
t.unreached_func("The loading=lazy below-viewport image should lazily " +
"load its second image, and not load it eagerly when " +
"the `src` attribute is changed");

// In 1s, scroll the image *back* into view, and record that it loads
// successfully.
t.step_timeout(() => {
image.onload = t.step_func_done();
image.scrollIntoView();
}, 1000);
}, 500);
image.onload = t.step_func_done();
image.scrollIntoView();
}, 1000);
}
</script>
</body>
2 changes: 1 addition & 1 deletion Source/WebCore/loader/ImageLoader.cpp
Expand Up @@ -251,7 +251,7 @@ void ImageLoader::updateFromElement(RelevantMutation relevantMutation)
#if !LOG_DISABLED
auto oldState = m_lazyImageLoadState;
#endif
if (!isDeferred() && isImageElement) {
if (m_lazyImageLoadState == LazyImageLoadState::None && isImageElement) {
auto& imageElement = downcast<HTMLImageElement>(element());
if (imageElement.isLazyLoadable() && document.settings().lazyImageLoadingEnabled()) {
m_lazyImageLoadState = LazyImageLoadState::Deferred;
Expand Down

0 comments on commit ddc412d

Please sign in to comment.