| Index: Source/core/layout/LayoutBox.cpp
|
| diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
|
| index 2a122f6b790c015e80886a9b36a752d39729caae..c68e9d1a31ae2c62ced5fbe02223c209b8f34bda 100644
|
| --- a/Source/core/layout/LayoutBox.cpp
|
| +++ b/Source/core/layout/LayoutBox.cpp
|
| @@ -1342,6 +1342,31 @@ void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*)
|
| invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false);
|
| }
|
|
|
| +ResourcePriority LayoutBox::updatePriority(Resource*)
|
| +{
|
| + 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()))
|
|
|