| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| index ad71db13458161a2ef732ee814a8300450a65c6b..2852e51bd4b59ce7431c9bd8e6d5d0a9d1c4897d 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
|
| @@ -1356,6 +1356,31 @@ void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*)
|
| invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false);
|
| }
|
|
|
| +ResourcePriority LayoutBox::computeResourcePriority() const
|
| +{
|
| + LayoutRect viewBounds = viewRect();
|
| + LayoutRect objectBounds = LayoutRect(absoluteContentBox());
|
| +
|
| + // The object bounds might be empty right now, so intersects will fail since it doesn't deal
|
| + // with empty rects. Use LayoutRect::contains in that case.
|
| + bool isVisible;
|
| + if (!objectBounds.isEmpty())
|
| + isVisible = viewBounds.intersects(objectBounds);
|
| + else
|
| + isVisible = viewBounds.contains(objectBounds);
|
| +
|
| + LayoutRect screenRect;
|
| + if (!objectBounds.isEmpty()) {
|
| + screenRect = viewBounds;
|
| + screenRect.intersect(objectBounds);
|
| + }
|
| +
|
| + int screenArea = 0;
|
| + if (!screenRect.isEmpty() && isVisible)
|
| + screenArea = static_cast<uint32_t>(screenRect.width() * screenRect.height());
|
| + return ResourcePriority(isVisible ? ResourcePriority::Visible : ResourcePriority::NotVisible, screenArea);
|
| +}
|
| +
|
| bool LayoutBox::invalidatePaintOfLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground)
|
| {
|
| if (drawingBackground && (isDocumentElement() || backgroundStolenForBeingBody()))
|
|
|