LazyLoad: Add basic support for lazily loading image elements
This CL adds basic support (behind a flag) for deferring the load of html image
elements until the user scrolls near them, in order to reduce network data
usage, memory usage, and speed up the loading of other content on the page.
LazyLoadImageObserver is created per document and that holds an
IntersectionObserver to observe the <img> elements within the document. When
the IntersectionObserver detects that the deferred image element is within a
specific distance threshold of the viewport, it resumes loading the image.
Subsequent CLs will defer CSS background images as well, and configure the
hardcoded distance-from-viewport threshold from field trial.
See the design docs below for more info.
LazyImages design doc:
https://docs.google.com/document/d/1jF1eSOhqTEt0L1WBCccGwH9chxLd9d1Ez0zo11obj14/edit
LazyLoad design doc:
https://docs.google.com/document/d/1e8ZbVyUwgIkQMvJma3kKUDg8UUkLRRdANStqKuOIvHg/edit
Bug: 846170
Change-Id: I8c1024a4cdb19f3c6c700ae49eec6369b67b72b4
Reviewed-on: https://chromium-review.googlesource.com/1132573
Commit-Queue: rajendrant <[email protected]>
Reviewed-by: Fredrik Söderquist <[email protected]>
Reviewed-by: Hiroshige Hayashizaki <[email protected]>
Cr-Commit-Position: refs/heads/master@{#583451}
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites
index e355068..8d8d27d 100644
--- a/third_party/WebKit/LayoutTests/VirtualTestSuites
+++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -719,6 +719,11 @@
"args": ["--enable-features=MojoBlobURLs"]
},
{
+ "prefix": "lazyload-image",
+ "base": "http/tests/lazyload",
+ "args": ["--enable-features=LazyImageLoading"]
+ },
+ {
"prefix": "origin-policy",
"base": "external/wpt/origin-policy",
"args": ["--enable-features=OriginPolicy"]