Web Platform Tests for HTML video and audio element lazy loading via the loading attribute#57051
Conversation
…g attribute These tests support the proposal for the addition of a loading attribute on the video element, designed to enable lazy-loading for video and poster data. HTML Standard PR here whatwg/html#11980 Co-authored-by: Zach Lysobey <zlysobey@squarespace.com> Co-authored-by: Brad Frost <bfrost@squarespace.com> Co-authored-by: Credo Duarte <cduarte@squarespace.com>
…d with a proposed HTML feature
rename files to use a .tentative.html convention since they correspond with a proposed HTML feature
|
Renamed the files to be |
html/semantics/embedded-content/the-video-element/video-loading-attr-default.tentative.html
Outdated
Show resolved
Hide resolved
.../semantics/embedded-content/the-video-element/video-loading-autoplay-deferred.tentative.html
Outdated
Show resolved
Hide resolved
.../semantics/embedded-content/the-video-element/video-loading-autoplay-deferred.tentative.html
Outdated
Show resolved
Hide resolved
html/semantics/embedded-content/the-video-element/video-loading-eager.tentative.html
Outdated
Show resolved
Hide resolved
.../semantics/embedded-content/the-video-element/video-loading-autoplay-deferred.tentative.html
Outdated
Show resolved
Hide resolved
html/semantics/embedded-content/the-video-element/video-loading-lazy-in-viewport.tentative.html
Outdated
Show resolved
Hide resolved
html/semantics/embedded-content/the-video-element/video-loading-lazy-in-viewport.tentative.html
Outdated
Show resolved
Hide resolved
...ics/embedded-content/the-video-element/video-loading-lazy-poster-when-visible.tentative.html
Outdated
Show resolved
Hide resolved
...semantics/embedded-content/the-video-element/video-loading-lazy-window-onload.tentative.html
Outdated
Show resolved
Hide resolved
...semantics/embedded-content/the-video-element/video-loading-lazy-window-onload.tentative.html
Outdated
Show resolved
Hide resolved
… event and added a fallback if event never fires.
…t event comes after window load
… scscroll, as the poster image will impact its rendered size and be useful as a proxy for poster lazy loading
|
Thanks for the review.
|
…ure is tentative. note with comments
…the document will not load
…o, only audio. removed.
|
I just added some tests to round out the suite a bit (disconnected node, missing controls attribute, non-rendered elements), and the reflection tests are tentative again so they can be considered for merge before the spec |
|
is there a ETA when this PR can land? on chromium side we are almost done with review (and potentially landing it behind a flag), but would be great to have tests landed first, rn i have them commited into my chromium cl (to see if they turn green), landing it would most likely send a WPT bot and might mess it up. |
|
@scottjehl for next steps, please raise a PR which renames these from tentative to not (so |
|
Thanks @keithamus ! |
…ttribute https://bugs.webkit.org/show_bug.cgi?id=303995 Reviewed by NOBODY (OOPS!). Implement proposed loading attribute for video and audio elements. This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay. This change is proposed to be added to the HTML spec in the following PR: whatwg/html#11980 This patch is passing video and audio WPT tests from the following PR: web-platform-tests/wpt#57051 * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::lazyLoadMediaObserver): * Source/WebCore/dom/Document.h: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didMoveToNewDocument): (WebCore::HTMLMediaElement::attributeChanged): (WebCore::HTMLMediaElement::didFinishInsertingNode): (WebCore::HTMLMediaElement::removedFromAncestor): (WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue): (WebCore::HTMLMediaElement::isLazyLoadable const): (WebCore::HTMLMediaElement::loadDeferredMedia): (WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded): (WebCore::HTMLMediaElement::loading const): (WebCore::HTMLMediaElement::setLoading): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::setShouldDelayLoadEvent): * Source/WebCore/html/HTMLMediaElement.h: * Source/WebCore/html/HTMLMediaElement.idl: * Source/WebCore/html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::rendererIsNeeded): (WebCore::HTMLVideoElement::supportsFullscreen const): (WebCore::HTMLVideoElement::hasAvailableVideoFrame const): (WebCore::HTMLVideoElement::webkitEnterFullscreen): (WebCore::HTMLVideoElement::loadDeferredMedia): * Source/WebCore/html/HTMLVideoElement.h: * Source/WebCore/html/LazyLoadMediaObserver.cpp: Added. (WebCore::LazyLoadMediaObserver::observe): (WebCore::LazyLoadMediaObserver::unobserve): (WebCore::LazyLoadMediaObserver::intersectionObserver): (WebCore::LazyLoadMediaObserver::isObserved const): * Source/WebCore/html/LazyLoadMediaObserver.h: Added. * Source/WebCore/html/parser/HTMLParserOptions.cpp: * Source/WebCore/html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * Source/WebCore/html/shadow/DataListButtonElement.cpp: * Source/WebCore/html/shadow/SpinButtonElement.cpp: * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::didUpdateCachedImage): (WebCore::ImageLoader::notifyFinished): (WebCore::ImageLoader::updatedHasPendingEvent): (WebCore::ImageLoader::decode):
| controls: "boolean", | ||
| controlsList: {type: "tokenlist", domAttrName: "controlsList"}, | ||
| defaultMuted: {type: "boolean", domAttrName: "muted"}, | ||
| defaultMuted: {type: "boolean", domAttrName: "muted"}/*, |
There was a problem hiding this comment.
This is a syntax error.
It needs a comma between this property and the next property.
…ttribute https://bugs.webkit.org/show_bug.cgi?id=303995 Reviewed by NOBODY (OOPS!). Implement proposed loading attribute for video and audio elements. This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay. This change is proposed to be added to the HTML spec in the following PR: whatwg/html#11980 This patch is passing video and audio WPT tests from the following PR: web-platform-tests/wpt#57051 * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::lazyLoadMediaObserver): * Source/WebCore/dom/Document.h: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didMoveToNewDocument): (WebCore::HTMLMediaElement::attributeChanged): (WebCore::HTMLMediaElement::didFinishInsertingNode): (WebCore::HTMLMediaElement::removedFromAncestor): (WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue): (WebCore::HTMLMediaElement::isLazyLoadable const): (WebCore::HTMLMediaElement::loadDeferredMedia): (WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded): (WebCore::HTMLMediaElement::loading const): (WebCore::HTMLMediaElement::setLoading): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::setShouldDelayLoadEvent): * Source/WebCore/html/HTMLMediaElement.h: * Source/WebCore/html/HTMLMediaElement.idl: * Source/WebCore/html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::rendererIsNeeded): (WebCore::HTMLVideoElement::supportsFullscreen const): (WebCore::HTMLVideoElement::hasAvailableVideoFrame const): (WebCore::HTMLVideoElement::webkitEnterFullscreen): (WebCore::HTMLVideoElement::loadDeferredMedia): * Source/WebCore/html/HTMLVideoElement.h: * Source/WebCore/html/LazyLoadMediaObserver.cpp: Added. (WebCore::LazyLoadMediaObserver::observe): (WebCore::LazyLoadMediaObserver::unobserve): (WebCore::LazyLoadMediaObserver::intersectionObserver): (WebCore::LazyLoadMediaObserver::isObserved const): * Source/WebCore/html/LazyLoadMediaObserver.h: Added. * Source/WebCore/html/parser/HTMLParserOptions.cpp: * Source/WebCore/html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * Source/WebCore/html/shadow/DataListButtonElement.cpp: * Source/WebCore/html/shadow/SpinButtonElement.cpp: * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::didUpdateCachedImage): (WebCore::ImageLoader::notifyFinished): (WebCore::ImageLoader::updatedHasPendingEvent): (WebCore::ImageLoader::decode):
…ttribute https://bugs.webkit.org/show_bug.cgi?id=303995 Reviewed by NOBODY (OOPS!). Implement proposed loading attribute for video and audio elements. This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay. This change is proposed to be added to the HTML spec in the following PR: whatwg/html#11980 This patch is passing video and audio WPT tests from the following PR: web-platform-tests/wpt#57051 * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::lazyLoadMediaObserver): * Source/WebCore/dom/Document.h: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didMoveToNewDocument): (WebCore::HTMLMediaElement::attributeChanged): (WebCore::HTMLMediaElement::didFinishInsertingNode): (WebCore::HTMLMediaElement::removedFromAncestor): (WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue): (WebCore::HTMLMediaElement::isLazyLoadable const): (WebCore::HTMLMediaElement::loadDeferredMedia): (WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded): (WebCore::HTMLMediaElement::loading const): (WebCore::HTMLMediaElement::setLoading): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::setShouldDelayLoadEvent): * Source/WebCore/html/HTMLMediaElement.h: * Source/WebCore/html/HTMLMediaElement.idl: * Source/WebCore/html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::rendererIsNeeded): (WebCore::HTMLVideoElement::supportsFullscreen const): (WebCore::HTMLVideoElement::hasAvailableVideoFrame const): (WebCore::HTMLVideoElement::webkitEnterFullscreen): (WebCore::HTMLVideoElement::loadDeferredMedia): * Source/WebCore/html/HTMLVideoElement.h: * Source/WebCore/html/LazyLoadMediaObserver.cpp: Added. (WebCore::LazyLoadMediaObserver::observe): (WebCore::LazyLoadMediaObserver::unobserve): (WebCore::LazyLoadMediaObserver::intersectionObserver): (WebCore::LazyLoadMediaObserver::isObserved const): * Source/WebCore/html/LazyLoadMediaObserver.h: Added. * Source/WebCore/html/parser/HTMLParserOptions.cpp: * Source/WebCore/html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * Source/WebCore/html/shadow/DataListButtonElement.cpp: * Source/WebCore/html/shadow/SpinButtonElement.cpp: * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::didUpdateCachedImage): (WebCore::ImageLoader::notifyFinished): (WebCore::ImageLoader::updatedHasPendingEvent): (WebCore::ImageLoader::decode):
…ttribute https://bugs.webkit.org/show_bug.cgi?id=303995 Reviewed by NOBODY (OOPS!). Implement proposed loading attribute for video and audio elements. This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay. This change is proposed to be added to the HTML spec in the following PR: whatwg/html#11980 This patch is passing video and audio WPT tests from the following PR: web-platform-tests/wpt#57051 * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::lazyLoadMediaObserver): * Source/WebCore/dom/Document.h: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::didMoveToNewDocument): (WebCore::HTMLMediaElement::attributeChanged): (WebCore::HTMLMediaElement::didFinishInsertingNode): (WebCore::HTMLMediaElement::removedFromAncestor): (WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue): (WebCore::HTMLMediaElement::isLazyLoadable const): (WebCore::HTMLMediaElement::loadDeferredMedia): (WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded): (WebCore::HTMLMediaElement::loading const): (WebCore::HTMLMediaElement::setLoading): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::setShouldDelayLoadEvent): * Source/WebCore/html/HTMLMediaElement.h: * Source/WebCore/html/HTMLMediaElement.idl: * Source/WebCore/html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::rendererIsNeeded): (WebCore::HTMLVideoElement::supportsFullscreen const): (WebCore::HTMLVideoElement::hasAvailableVideoFrame const): (WebCore::HTMLVideoElement::webkitEnterFullscreen): (WebCore::HTMLVideoElement::loadDeferredMedia): * Source/WebCore/html/HTMLVideoElement.h: * Source/WebCore/html/LazyLoadMediaObserver.cpp: Added. (WebCore::LazyLoadMediaObserver::observe): (WebCore::LazyLoadMediaObserver::unobserve): (WebCore::LazyLoadMediaObserver::intersectionObserver): (WebCore::LazyLoadMediaObserver::isObserved const): * Source/WebCore/html/LazyLoadMediaObserver.h: Added. * Source/WebCore/html/parser/HTMLParserOptions.cpp: * Source/WebCore/html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): * Source/WebCore/html/shadow/DataListButtonElement.cpp: * Source/WebCore/html/shadow/SpinButtonElement.cpp: * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): (WebCore::ImageLoader::didUpdateCachedImage): (WebCore::ImageLoader::notifyFinished): (WebCore::ImageLoader::updatedHasPendingEvent): (WebCore::ImageLoader::decode):
These tests support the proposal for the addition of a loading attribute
on the video and audio elements, designed to enable lazy-loading of resources related to those elements.
Related HTML Standard Proposal: whatwg/html#11980
Related issue: whatwg/html#10376
These are designed to pass in a browser that supports the proposed feature (verified in a locally patched browser).
Co-authored-by: Zach Lysobey zlysobey@squarespace.com
Co-authored-by: Brad Frost bfrost@squarespace.com
Co-authored-by: Credo Duarte cduarte@squarespace.com