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

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

Issue 1378743002: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better names / cleanup Created 5 years, 2 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
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index dc1db87fd18b0ef7e3968202b6d9981dddcd5c17..53c56d1ed6f0409650b2e9f16d481cf43380d478 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -34,7 +34,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"
@@ -159,38 +158,6 @@ static void removeBlockFromDescendantAndContainerMaps(LayoutBlock* block, Tracke
}
}
-static void appendImageIfNotNull(WillBeHeapVector<RawPtrWillBeMember<ImageResource>>& imageResources, const StyleImage* styleImage)
-{
- if (styleImage && styleImage->cachedImage()) {
- ImageResource* imageResource = styleImage->cachedImage();
- if (imageResource && !imageResource->isLoaded())
- imageResources.append(styleImage->cachedImage());
- }
-}
-
-static void appendLayers(WillBeHeapVector<RawPtrWillBeMember<ImageResource>>& images, const FillLayer& styleLayer)
-{
- for (const FillLayer* layer = &styleLayer; layer; layer = layer->next())
- appendImageIfNotNull(images, layer->image());
-}
-
-static void appendImagesFromStyle(WillBeHeapVector<RawPtrWillBeMember<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)
@@ -330,15 +297,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.
- WillBeHeapVector<RawPtrWillBeMember<ImageResource>> images;
- appendImagesFromStyle(images, newStyle);
- if (images.isEmpty())
- ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayoutObject(this);
- else
- ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addLayoutObject(this);
}
void LayoutBlock::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& childPaintInvalidationState)
@@ -947,39 +905,6 @@ void LayoutBlock::layout()
invalidateBackgroundObscurationStatus();
}
-bool LayoutBlock::updateImageLoadingPriorities()
-{
- WillBeHeapVector<RawPtrWillBeMember<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 | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698