Skip to content

Implement HTML video and audio element lazy-loading via the loading attribute - #76200

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
credod:eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute
Nov 3, 2026
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
credod:eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute

Conversation

@credod

@credod credod commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

a93ac1a

Implement HTML video and audio element lazy-loading via the loading attribute
https://bugs.webkit.org/show_bug.cgi?id=303995

Reviewed by Anne van Kesteren.

This patch implements a loading attribute for video and audio elements,
enabling lazy loading of media sources and video poster images,
and deferring autoplay.

This was added to the HTML spec here: whatwg/html#11980

Synced test from upstream wpt:

- Commit: web-platform-tests/wpt@7d9d48d
- Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-inserted-load-event.html

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251_include=loading-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/windows-1252_include=loading-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-autoplay-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-autoplay-when-visible-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-disconnected-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-not-rendered-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-source-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-to-eager-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-auto-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-metadata-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-autoplay-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-eager-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-autoplay-when-visible-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-disconnected-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-in-scroller-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-in-viewport-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-load-when-visible-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-not-rendered-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-poster-when-visible-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-resume-on-loading-attribute-change-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-inserted-load-event-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-inserted-load-event.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-poster-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-to-eager-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-poster-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/media/A4.webm: Added.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-in-viewport-expected.txt: Removed.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-window-onload-expected.txt: Removed.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-metadata-deferred-expected.txt: Removed.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::attributeChanged):
(WebCore::isFrameLazyLoadable):
(WebCore::HTMLIFrameElement::shouldLoadFrameLazily):
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
(WebCore::HTMLImageElement::selectImageSource):
(WebCore::HTMLImageElement::attributeChanged):
(WebCore::HTMLImageElement::didAttachRenderers):
(WebCore::HTMLImageElement::allowsAutoSizes const):
(WebCore::HTMLImageElement::hasLazyLoadableAttributeValue): Deleted.
(WebCore::HTMLImageElement::isLazyLoadable const): Deleted.
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::didMoveToNewDocument):
(WebCore::HTMLMediaElement::attributeChanged):
(WebCore::HTMLMediaElement::shouldLazyLoadMediaResource const):
(WebCore::HTMLMediaElement::deferMediaResourceLoadIfNeeded):
(WebCore::HTMLMediaElement::clearLazyLoadState):
(WebCore::HTMLMediaElement::resumeDeferredMediaResourceLoad):
(WebCore::HTMLMediaElement::runLazyLoadResumptionSteps):
(WebCore::HTMLMediaElement::lazyLoadIntersectionCallbackInvoked):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::queueSelectMediaResourceTask):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::sourceWasAdded):
* Source/WebCore/html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::isIntersectingViewport const):
(WebCore::HTMLMediaElement::tracksViewportIntersection const):
(WebCore::HTMLMediaElement::viewportIntersectionChanged):
(WebCore::HTMLMediaElement::isMediaResourceLoadDeferred const):
(WebCore::HTMLMediaElement::shouldObserveViewportIntersection const):
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::rendererIsNeeded):
(WebCore::HTMLVideoElement::didAttachRenderers):
(WebCore::HTMLVideoElement::computeAcceleratedRenderingStateAndUpdateMediaPlayer):
(WebCore::HTMLVideoElement::attributeChanged):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::didMoveToNewDocument):
(WebCore::HTMLVideoElement::viewportIntersectionChanged):
(WebCore::HTMLVideoElement::runLazyLoadResumptionSteps):
(WebCore::HTMLVideoElement::loadDeferredPosterImage):
(WebCore::HTMLVideoElement::resumePosterLoadIfAlreadyVisible):
(WebCore::HTMLVideoElement::~HTMLVideoElement): Deleted.
(WebCore::HTMLVideoElement::lazyLoadIntersectionCallbackInvoked): Deleted.
* Source/WebCore/html/HTMLVideoElement.h:
* Source/WebCore/html/LazyLoadElementObserver.cpp:
(WebCore::LazyLoadElementObserver::unobserve):
(WebCore::LazyLoadElementObserver::unobserveIfLazyLoadOnly):
(WebCore::LazyLoadElementObserver::isObserved const): Deleted.
* Source/WebCore/html/LazyLoadElementObserver.h:
* Source/WebCore/html/LazyLoading.cpp: Added.
(WebCore::LazyLoading::hasLazyAttributeValue):
(WebCore::LazyLoading::isInLazyState):
(WebCore::LazyLoading::isLazyLoadingEnabled):
(WebCore::LazyLoading::isLazyLoadable):
* Source/WebCore/html/LazyLoading.h: Copied from Source/WebCore/html/LazyLoadElementObserver.h.
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
(WebCore::TokenPreloadScanner::StartTagScanner::isLazyloadingImage const):
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::updatedHasPendingEvent):
(WebCore::ImageLoader::decode):
(WebCore::ImageLoader::resetLazyImageLoading):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::layout):

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

0be9b49

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-cmake-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-cmake-debug ✅ 🧪 jsc-wpe
✅ 🧪 jsc-x86-64 ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-cmake-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-wk2-stress ✅ 🧪 gtk-wk2
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp   🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@credod
credod requested review from cdumez and rniwa as code owners October 7, 2026 16:08
Comment thread LayoutTests/TestExpectations Resolved
Comment thread LayoutTests/TestExpectations Resolved
Comment thread Source/WebCore/html/HTMLMediaElement.h Resolved
Comment thread Source/WebCore/html/HTMLVideoElement.h Resolved
Comment thread Source/WebCore/loader/ImageLoader.cpp Resolved
Comment thread Source/WebCore/loader/ImageLoader.cpp Resolved
Comment thread Source/WebCore/loader/ImageLoader.cpp Resolved
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 7, 2026
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from 27fea9c to e9d17f3 Compare October 7, 2026 18:39
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from e9d17f3 to cd036b9 Compare October 8, 2026 16:38
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from cd036b9 to d78478b Compare October 13, 2026 19:56
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from d78478b to 6aa27ab Compare October 14, 2026 15:30
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from 6aa27ab to 215a802 Compare October 14, 2026 18:42
@Ahmad-S792
Ahmad-S792 requested review from a team, annevk and brentfulgham October 14, 2026 23:21

@annevk annevk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me, but I did spot a couple of things that are worth a revision. (And thanks for sorting out the contribution of this on your end!)

Comment thread Source/WebCore/html/HTMLMediaElement.h Resolved
Comment thread Source/WebCore/loader/ImageLoader.cpp Outdated

static bool shouldLazyLoadImageForElement(const Element& element, const Document& document)
{
if (!LazyLoading::isLazyLoadable(element))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this only handles frames? That seems a bit weird for the generic function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@annevk thanks for the review! This isn't frame specific. It’s step 1 of the will lazy load element steps (“if scripting is disabled for element, then return false”). Both the img and iframe paths already had this same check, so LazyLoading::isLazyLoadable is consolidating them into one generic function. Let me know if that answers your question, I wasn't 100% sure what you meant by "frames".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the thing is that LazyLoading::isLazyLoadable only handles iframe and generally elements with loading=lazy (is that too generic?). And then in this static we handle various settings checks. Why not handle the settings checks in isLazyLoadable too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh I see what you mean. I agree that we can move the settings checks into LazyLoading.cpp. I've put them into isLazyLoadingEnabled, which is called by isLazyLoadable. I noticed that HTMLImageElement was calling isLazyLoadable to implement auto-sizes as defined by the spec. To account for this, I added isInLazyState to LazyLoading.cpp and replaced those instances of isLazyLoadable.

@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from 215a802 to c0028fc Compare October 19, 2026 16:20
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from c0028fc to 8334a4e Compare October 21, 2026 16:37
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from 8334a4e to eaea668 Compare October 23, 2026 16:49
@credod
credod force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from eaea668 to 0be9b49 Compare October 23, 2026 18:46
@annevk annevk added safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks and removed merging-blocked Applied to prevent a change from being merged labels Nov 3, 2026
@webkit-ews-buildbot webkit-ews-buildbot added merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Nov 3, 2026
@webkit-ews-buildbot

Copy link
Copy Markdown
Collaborator

Safe-Merge-Queue: Build #109434.

…ttribute

https://bugs.webkit.org/show_bug.cgi?id=303995

Reviewed by Anne van Kesteren.

This patch implements a loading attribute for video and audio elements,
enabling lazy loading of media sources and video poster images,
and deferring autoplay.

This was added to the HTML spec here: whatwg/html#11980

Synced test from upstream wpt:

- Commit: web-platform-tests/wpt@7d9d48d
- Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-inserted-load-event.html

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/windows-1251_include=loading-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/windows-1252_include=loading-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-autoplay-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-autoplay-when-visible-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-disconnected-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-not-rendered-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-source-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-to-eager-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-auto-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-metadata-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-autoplay-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-eager-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-autoplay-when-visible-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-disconnected-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-in-scroller-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-in-viewport-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-load-when-visible-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-not-rendered-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-poster-when-visible-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-resume-on-loading-attribute-change-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-inserted-load-event-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-inserted-load-event.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-source-poster-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-lazy-to-eager-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-loading-poster-deferred-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/media/A4.webm: Added.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-in-viewport-expected.txt: Removed.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-window-onload-expected.txt: Removed.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-metadata-deferred-expected.txt: Removed.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::attributeChanged):
(WebCore::isFrameLazyLoadable):
(WebCore::HTMLIFrameElement::shouldLoadFrameLazily):
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
(WebCore::HTMLImageElement::selectImageSource):
(WebCore::HTMLImageElement::attributeChanged):
(WebCore::HTMLImageElement::didAttachRenderers):
(WebCore::HTMLImageElement::allowsAutoSizes const):
(WebCore::HTMLImageElement::hasLazyLoadableAttributeValue): Deleted.
(WebCore::HTMLImageElement::isLazyLoadable const): Deleted.
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::didMoveToNewDocument):
(WebCore::HTMLMediaElement::attributeChanged):
(WebCore::HTMLMediaElement::shouldLazyLoadMediaResource const):
(WebCore::HTMLMediaElement::deferMediaResourceLoadIfNeeded):
(WebCore::HTMLMediaElement::clearLazyLoadState):
(WebCore::HTMLMediaElement::resumeDeferredMediaResourceLoad):
(WebCore::HTMLMediaElement::runLazyLoadResumptionSteps):
(WebCore::HTMLMediaElement::lazyLoadIntersectionCallbackInvoked):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::queueSelectMediaResourceTask):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::sourceWasAdded):
* Source/WebCore/html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::isIntersectingViewport const):
(WebCore::HTMLMediaElement::tracksViewportIntersection const):
(WebCore::HTMLMediaElement::viewportIntersectionChanged):
(WebCore::HTMLMediaElement::isMediaResourceLoadDeferred const):
(WebCore::HTMLMediaElement::shouldObserveViewportIntersection const):
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::rendererIsNeeded):
(WebCore::HTMLVideoElement::didAttachRenderers):
(WebCore::HTMLVideoElement::computeAcceleratedRenderingStateAndUpdateMediaPlayer):
(WebCore::HTMLVideoElement::attributeChanged):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::didMoveToNewDocument):
(WebCore::HTMLVideoElement::viewportIntersectionChanged):
(WebCore::HTMLVideoElement::runLazyLoadResumptionSteps):
(WebCore::HTMLVideoElement::loadDeferredPosterImage):
(WebCore::HTMLVideoElement::resumePosterLoadIfAlreadyVisible):
(WebCore::HTMLVideoElement::~HTMLVideoElement): Deleted.
(WebCore::HTMLVideoElement::lazyLoadIntersectionCallbackInvoked): Deleted.
* Source/WebCore/html/HTMLVideoElement.h:
* Source/WebCore/html/LazyLoadElementObserver.cpp:
(WebCore::LazyLoadElementObserver::unobserve):
(WebCore::LazyLoadElementObserver::unobserveIfLazyLoadOnly):
(WebCore::LazyLoadElementObserver::isObserved const): Deleted.
* Source/WebCore/html/LazyLoadElementObserver.h:
* Source/WebCore/html/LazyLoading.cpp: Added.
(WebCore::LazyLoading::hasLazyAttributeValue):
(WebCore::LazyLoading::isInLazyState):
(WebCore::LazyLoading::isLazyLoadingEnabled):
(WebCore::LazyLoading::isLazyLoadable):
* Source/WebCore/html/LazyLoading.h: Copied from Source/WebCore/html/LazyLoadElementObserver.h.
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
(WebCore::TokenPreloadScanner::StartTagScanner::isLazyloadingImage const):
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::updatedHasPendingEvent):
(WebCore::ImageLoader::decode):
(WebCore::ImageLoader::resetLazyImageLoading):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::layout):

Canonical link: https://commits.webkit.org/325572@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/Implement-HTML-video-and-audio-element-lazy-loading-via-the-loading-attribute branch from 0be9b49 to a93ac1a Compare November 3, 2026 09:50
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 325572@main (a93ac1a): https://commits.webkit.org/325572@main

Reviewed commits have been landed. Closing PR #76200 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit a93ac1a into WebKit:main Nov 3, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants