| Index: Source/core/rendering/RenderBlock.cpp
|
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
|
| index bcd258cdd0ecbd3ebae51eeb4c0992ed0ec2a925..e2b2b845cff6a4b745213cffe70e5f19a707ec20 100644
|
| --- a/Source/core/rendering/RenderBlock.cpp
|
| +++ b/Source/core/rendering/RenderBlock.cpp
|
| @@ -32,6 +32,7 @@
|
| #include "core/dom/shadow/ShadowRoot.h"
|
| #include "core/editing/Editor.h"
|
| #include "core/editing/FrameSelection.h"
|
| +#include "core/fetch/ResourceLoadPriorityOptimizer.h"
|
| #include "core/frame/Frame.h"
|
| #include "core/frame/FrameView.h"
|
| #include "core/page/Page.h"
|
| @@ -60,6 +61,8 @@
|
| #include "core/rendering/RenderView.h"
|
| #include "core/rendering/shapes/ShapeInsideInfo.h"
|
| #include "core/rendering/shapes/ShapeOutsideInfo.h"
|
| +#include "core/rendering/style/ContentData.h"
|
| +#include "core/rendering/style/RenderStyle.h"
|
| #include "platform/geometry/FloatQuad.h"
|
| #include "platform/geometry/TransformState.h"
|
| #include "wtf/StdLibExtras.h"
|
| @@ -1254,6 +1257,67 @@ void RenderBlock::layout()
|
| invalidateBackgroundObscurationStatus();
|
| }
|
|
|
| +void RenderBlock::didLayout(ResourceLoadPriorityOptimizer& optimizer)
|
| +{
|
| + RenderBox::didLayout(optimizer);
|
| + updateStyleImageLoadingPriorities(optimizer);
|
| +}
|
| +
|
| +void RenderBlock::didScroll(ResourceLoadPriorityOptimizer& optimizer)
|
| +{
|
| + RenderBox::didScroll(optimizer);
|
| + updateStyleImageLoadingPriorities(optimizer);
|
| +}
|
| +
|
| +void RenderBlock::updateStyleImageLoadingPriorities(ResourceLoadPriorityOptimizer& optimizer)
|
| +{
|
| + RenderStyle* blockStyle = style();
|
| +
|
| + if (blockStyle) {
|
| + LayoutRect objectBounds = absoluteContentBox();
|
| + LayoutRect viewBounds = viewRect();
|
| +
|
| + ResourceLoadPriorityOptimizer::VisibilityStatus status = viewBounds.intersects(objectBounds) ?
|
| + ResourceLoadPriorityOptimizer::Visible : ResourceLoadPriorityOptimizer::NotVisible;
|
| +
|
| + for (FillLayer* layer = blockStyle->accessBackgroundLayers(); layer; layer = layer->next()) {
|
| + if (layer->image()) {
|
| + ImageResource* img = layer->image()->cachedImage();
|
| + if (img) {
|
| + optimizer.notifyImageResourceVisibility(img, status);
|
| + }
|
| + }
|
| + }
|
| + for (FillLayer* layer = blockStyle->accessMaskLayers(); layer; layer = layer->next()) {
|
| + if (layer->image()) {
|
| + ImageResource* img = layer->image()->cachedImage();
|
| + if (img) {
|
| + optimizer.notifyImageResourceVisibility(img, status);
|
| + }
|
| + }
|
| + }
|
| + ContentData* contentData = const_cast<ContentData*>(blockStyle->contentData());
|
| + if (contentData && contentData->isImage()) {
|
| + ImageContentData* imageContentData = static_cast<ImageContentData*>(contentData);
|
| + if (imageContentData->image() && imageContentData->image()->cachedImage())
|
| + optimizer.notifyImageResourceVisibility(imageContentData->image()->cachedImage(), status);
|
| + }
|
| + if (blockStyle->boxReflect()) {
|
| + if (blockStyle->boxReflect()->mask().image()) {
|
| + if (blockStyle->boxReflect()->mask().image()->cachedImage()) {
|
| + optimizer.notifyImageResourceVisibility(blockStyle->boxReflect()->mask().image()->cachedImage(), status);
|
| + }
|
| + }
|
| + }
|
| + if (blockStyle->listStyleImage() && blockStyle->listStyleImage()->cachedImage())
|
| + optimizer.notifyImageResourceVisibility(blockStyle->listStyleImage()->cachedImage(), status);
|
| + if (blockStyle->borderImageSource() && blockStyle->borderImageSource()->cachedImage())
|
| + optimizer.notifyImageResourceVisibility(blockStyle->borderImageSource()->cachedImage(), status);
|
| + if (blockStyle->maskBoxImageSource() && blockStyle->maskBoxImageSource()->cachedImage())
|
| + optimizer.notifyImageResourceVisibility(blockStyle->maskBoxImageSource()->cachedImage(), status);
|
| + }
|
| +}
|
| +
|
| void RenderBlock::relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset)
|
| {
|
| LayoutUnit left = isHorizontalWritingMode() ? offset.width() : offset.height();
|
|
|