Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1036)

Unified Diff: Source/core/layout/LayoutBlock.cpp

Issue 1304063016: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | Source/core/layout/LayoutBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBlock.cpp
diff --git a/Source/core/layout/LayoutBlock.cpp b/Source/core/layout/LayoutBlock.cpp
index 8f3982221cd98f6a9bac99f64d783e0bb9c03cbf..33964ebaa692fbb33c561ace9c0b7c50b4921c86 100644
--- a/Source/core/layout/LayoutBlock.cpp
+++ b/Source/core/layout/LayoutBlock.cpp
@@ -33,7 +33,6 @@
#include "core/editing/EditingUtilities.h"
#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
-#include "core/fetch/ResourceLoadPriorityOptimizer.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
@@ -157,38 +156,6 @@ static void removeBlockFromDescendantAndContainerMaps(LayoutBlock* block, Tracke
}
}
-static void appendImageIfNotNull(Vector<ImageResource*>& imageResources, const StyleImage* styleImage)
-{
- if (styleImage && styleImage->cachedImage()) {
- ImageResource* imageResource = styleImage->cachedImage();
- if (imageResource && !imageResource->isLoaded())
- imageResources.append(styleImage->cachedImage());
- }
-}
-
-static void appendLayers(Vector<ImageResource*>& images, const FillLayer& styleLayer)
-{
- for (const FillLayer* layer = &styleLayer; layer; layer = layer->next())
- appendImageIfNotNull(images, layer->image());
-}
-
-static void appendImagesFromStyle(Vector<ImageResource*>& images, const ComputedStyle& blockStyle)
-{
- appendLayers(images, blockStyle.backgroundLayers());
- appendLayers(images, blockStyle.maskLayers());
-
- const ContentData* contentData = blockStyle.contentData();
- if (contentData && contentData->isImage())
- appendImageIfNotNull(images, toImageContentData(contentData)->image());
- if (blockStyle.boxReflect())
- appendImageIfNotNull(images, blockStyle.boxReflect()->mask().image());
- appendImageIfNotNull(images, blockStyle.listStyleImage());
- appendImageIfNotNull(images, blockStyle.borderImageSource());
- appendImageIfNotNull(images, blockStyle.maskBoxImageSource());
- if (blockStyle.shapeOutside())
- appendImageIfNotNull(images, blockStyle.shapeOutside()->image());
-}
-
void LayoutBlock::removeFromGlobalMaps()
{
if (gPercentHeightDescendantsMap)
@@ -322,15 +289,6 @@ void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
// It's possible for our border/padding to change, but for the overall logical width of the block to
// end up being the same. We keep track of this change so in layoutBlock, we can know to set relayoutChildren=true.
m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && needsLayout() && borderOrPaddingLogicalWidthChanged(*oldStyle, newStyle);
-
- // If the style has unloaded images, want to notify the ResourceLoadPriorityOptimizer so that
- // network priorities can be set.
- Vector<ImageResource*> images;
- appendImagesFromStyle(images, newStyle);
- if (images.isEmpty())
- ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayoutObject(this);
- else
- ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addLayoutObject(this);
}
void LayoutBlock::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& childPaintInvalidationState)
@@ -914,39 +872,6 @@ void LayoutBlock::layout()
invalidateBackgroundObscurationStatus();
}
-bool LayoutBlock::updateImageLoadingPriorities()
-{
- Vector<ImageResource*> images;
- appendImagesFromStyle(images, styleRef());
-
- if (images.isEmpty())
- return false;
-
- LayoutRect viewBounds = viewRect();
- LayoutRect objectBounds(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);
-
- ResourceLoadPriorityOptimizer::VisibilityStatus status = isVisible ?
- ResourceLoadPriorityOptimizer::Visible : ResourceLoadPriorityOptimizer::NotVisible;
-
- LayoutRect screenArea;
- if (!objectBounds.isEmpty()) {
- screenArea = viewBounds;
- screenArea.intersect(objectBounds);
- }
-
- for (auto* imageResource : images)
- ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->notifyImageResourceVisibility(imageResource, status, screenArea);
-
- return true;
-}
-
bool LayoutBlock::widthAvailableToChildrenHasChanged()
{
bool widthAvailableToChildrenHasChanged = m_widthAvailableToChildrenChanged;
« no previous file with comments | « Source/core/layout/LayoutBlock.h ('k') | Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698