From a33f9089bbf348cada87ac36fd13a6c6202b51b7 Mon Sep 17 00:00:00 2001 From: "renevietnam29@gmail.com" Date: Wed, 23 Aug 2023 13:26:36 +0000 Subject: [PATCH] Bug 1842984 Remove dom.image-lazy-loading.enabled r=emilio Differential Revision: https://phabricator.services.mozilla.com/D184883 --- dom/html/HTMLImageElement.cpp | 4 ---- dom/webidl/HTMLImageElement.webidl | 2 +- layout/generic/test/test_reframe_for_lazy_load_image.html | 1 - layout/reftests/image/reftest.list | 2 +- modules/libpref/init/StaticPrefList.yaml | 8 -------- parser/html/nsHtml5TreeBuilderCppSupplement.h | 3 +-- testing/web-platform/meta/loading/lazyload/__dir__.ini | 1 - 7 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 testing/web-platform/meta/loading/lazyload/__dir__.ini diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 5373adf6a71a..e9527af595cc 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -1296,10 +1296,6 @@ void HTMLImageElement::SetLazyLoading() { return; } - if (!StaticPrefs::dom_image_lazy_loading_enabled()) { - return; - } - // If scripting is disabled don't do lazy load. // https://whatpr.org/html/3752/images.html#updating-the-image-data // diff --git a/dom/webidl/HTMLImageElement.webidl b/dom/webidl/HTMLImageElement.webidl index 46ad519f5e6e..1495d25f74b4 100644 --- a/dom/webidl/HTMLImageElement.webidl +++ b/dom/webidl/HTMLImageElement.webidl @@ -41,7 +41,7 @@ interface HTMLImageElement : HTMLElement { attribute unsigned long height; [CEReactions, SetterThrows] attribute DOMString decoding; - [CEReactions, SetterThrows, Pref="dom.image-lazy-loading.enabled"] + [CEReactions, SetterThrows] attribute DOMString loading; readonly attribute unsigned long naturalWidth; readonly attribute unsigned long naturalHeight; diff --git a/layout/generic/test/test_reframe_for_lazy_load_image.html b/layout/generic/test/test_reframe_for_lazy_load_image.html index 28c938101ce2..0ac3c63d3360 100644 --- a/layout/generic/test/test_reframe_for_lazy_load_image.html +++ b/layout/generic/test/test_reframe_for_lazy_load_image.html @@ -15,7 +15,6 @@ SpecialPowers.pushPrefEnv( // the `alt` change. { set: [ - ["dom.image-lazy-loading.enabled", true], ["dom.image-lazy-loading.root-margin.top", 0], ["dom.image-lazy-loading.root-margin.bottom", 0], ["dom.image-lazy-loading.root-margin.left", 0], diff --git a/layout/reftests/image/reftest.list b/layout/reftests/image/reftest.list index 82e788ecc134..caa39659de19 100644 --- a/layout/reftests/image/reftest.list +++ b/layout/reftests/image/reftest.list @@ -67,7 +67,7 @@ fails-if(useDrawSnapshot) == image-srcset-svg-default-2x.html image-srcset-svg-d == image-resize-percent-width.html image-resize-ref.html == moz-broken-matching-1.html moz-broken-matching-1-ref.html -pref(dom.image-lazy-loading.enabled,true) == moz-broken-matching-lazy-load.html moz-broken-matching-1-ref.html +== moz-broken-matching-lazy-load.html moz-broken-matching-1-ref.html == img-invalidation-local-transform-1.html img-invalidation-local-transform-1-ref.html == unknown-protocol.html unknown-protocol-ref.html diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 0f803dfdc1d5..138d0d3eb979 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -2706,14 +2706,6 @@ value: false mirror: always -# -# -# See https://github.com/whatwg/html/pull/3752 -- name: dom.image-lazy-loading.enabled - type: RelaxedAtomicBool - value: true - mirror: always - # The root margin for image lazy loading, defined as four (value, percentage) # pairs. - name: dom.image-lazy-loading.root-margin.top diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h index 7b1c20eef99a..20b2c250f548 100644 --- a/parser/html/nsHtml5TreeBuilderCppSupplement.h +++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h @@ -183,8 +183,7 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement( if (nsGkAtoms::img == aName) { nsHtml5String loading = aAttributes->getValue(nsHtml5AttributeName::ATTR_LOADING); - if (!mozilla::StaticPrefs::dom_image_lazy_loading_enabled() || - !loading.LowerCaseEqualsASCII("lazy")) { + if (!loading.LowerCaseEqualsASCII("lazy")) { nsHtml5String url = aAttributes->getValue(nsHtml5AttributeName::ATTR_SRC); nsHtml5String srcset = diff --git a/testing/web-platform/meta/loading/lazyload/__dir__.ini b/testing/web-platform/meta/loading/lazyload/__dir__.ini deleted file mode 100644 index 44f1f1ce96d8..000000000000 --- a/testing/web-platform/meta/loading/lazyload/__dir__.ini +++ /dev/null @@ -1 +0,0 @@ -prefs: [dom.image-lazy-loading.enabled:true]