| Index: Source/core/layout/LayoutImage.cpp | 
| diff --git a/Source/core/layout/LayoutImage.cpp b/Source/core/layout/LayoutImage.cpp | 
| index d93280a590121c736797572bd0154ec2b1a3282f..da2e2b9017fb170f3c29de4a777b622ee82e1ab7 100644 | 
| --- a/Source/core/layout/LayoutImage.cpp | 
| +++ b/Source/core/layout/LayoutImage.cpp | 
| @@ -39,6 +39,7 @@ | 
| #include "core/html/HTMLInputElement.h" | 
| #include "core/html/HTMLMapElement.h" | 
| #include "core/layout/HitTestResult.h" | 
| +#include "core/layout/LayoutPart.h" | 
| #include "core/layout/LayoutView.h" | 
| #include "core/layout/PaintInfo.h" | 
| #include "core/layout/TextRunConstructor.h" | 
| @@ -175,6 +176,30 @@ void LayoutImage::invalidatePaintAndMarkForLayoutIfNeeded() | 
| contentChanged(ImageChanged); | 
| } | 
|  | 
| +bool LayoutImage::intersectsVisibleViewport() | 
| +{ | 
| +    LayoutRect rect = visualOverflowRect(); | 
| +    LayoutView* layoutView = view(); | 
| +    while (layoutView->frame()->ownerLayoutObject()) | 
| +        layoutView = layoutView->frame()->ownerLayoutObject()->view(); | 
| +    mapRectToPaintInvalidationBacking(layoutView, rect, 0); | 
| +    return rect.intersects(LayoutRect(layoutView->frameView()->visualViewportRect())); | 
| +} | 
| + | 
| +PaintInvalidationReason LayoutImage::invalidatePaintIfNeeded(PaintInvalidationState& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContainer) | 
| +{ | 
| +    if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 
| +        return LayoutReplaced::invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationContainer); | 
| + | 
| +    if (!imageResource() || !imageResource()->image() || !imageResource()->image()->maybeAnimated() | 
| +        || intersectsVisibleViewport()) { | 
| +        return LayoutReplaced::invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationContainer); | 
| +    } | 
| + | 
| +    return PaintInvalidationDelayedFull; | 
| +} | 
| + | 
| + | 
| void LayoutImage::notifyFinished(Resource* newImage) | 
| { | 
| if (!m_imageResource) | 
|  |