summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc b/chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc
index 2678cc365a5..db0a913e6da 100644
--- a/chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc
+++ b/chromium/third_party/blink/renderer/core/loader/lazy_image_helper.cc
@@ -8,6 +8,7 @@
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/frame_owner.h"
+#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
@@ -74,12 +75,6 @@ void LazyImageHelper::StartMonitoring(blink::Element* element) {
if (auto* html_image = DynamicTo<HTMLImageElement>(element)) {
LoadingAttributeValue effective_loading_attr = GetLoadingAttributeValue(
html_image->FastGetAttribute(html_names::kLoadingAttr));
- // If the 'lazyload' feature policy is enforced, the attribute value
- // loading='eager' is considered as 'auto'.
- if (effective_loading_attr == LoadingAttributeValue::kEager &&
- document->IsLazyLoadPolicyEnforced()) {
- effective_loading_attr = LoadingAttributeValue::kAuto;
- }
DCHECK_NE(effective_loading_attr, LoadingAttributeValue::kEager);
if (effective_loading_attr == LoadingAttributeValue::kAuto) {
deferral_message = DeferralMessage::kLoadEventsDeferred;
@@ -109,7 +104,7 @@ LazyImageHelper::DetermineEligibilityAndTrackVisibilityMetrics(
// Do not lazyload image elements when JavaScript is disabled, regardless of
// the `loading` attribute.
- if (!frame.GetDocument()->CanExecuteScripts(kNotAboutToExecuteScript))
+ if (!frame.DomWindow()->CanExecuteScripts(kNotAboutToExecuteScript))
return LazyImageHelper::Eligibility::kDisabled;
const auto lazy_load_image_setting = frame.GetLazyLoadImageSetting();
@@ -128,8 +123,7 @@ LazyImageHelper::DetermineEligibilityAndTrackVisibilityMetrics(
}
}
- if (loading_attr == LoadingAttributeValue::kEager &&
- !frame.GetDocument()->IsLazyLoadPolicyEnforced()) {
+ if (loading_attr == LoadingAttributeValue::kEager) {
UseCounter::Count(frame.GetDocument(),
WebFeature::kLazyLoadImageLoadingAttributeEager);
return LazyImageHelper::Eligibility::kDisabled;