Remove Style::PendingResources
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Sep 2016 18:50:21 +0000 (18:50 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Sep 2016 18:50:21 +0000 (18:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161574

Reviewed by Andreas Kling.

RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.

* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::loadSubimages):

    Load external SVG resources along with any image resources.

* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::styleImage):
(WebCore::CSSToStyleMap::mapFillImage):
(WebCore::CSSToStyleMap::mapNinePieceImage):
* css/CSSToStyleMap.h:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertStyleImage):
(WebCore::StyleBuilderConverter::convertShapeValue):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueCursor):
(WebCore::StyleBuilderCustom::applyValueContent):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::clear):
(WebCore::StyleResolver::styleImage):
(WebCore::StyleResolver::createFilterOperations):
(WebCore::StyleResolver::loadPendingResources):
(WebCore::StyleResolver::State::ensurePendingResources): Deleted.
(WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
(WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::State::takePendingResources): Deleted.
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
(WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
* platform/graphics/filters/FilterOperation.h:
(WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::StyleCachedImage):
* style/StylePendingResources.cpp:
(WebCore::Style::loadPendingResources):

    Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
    separately wasn't necessary or a meaningful optimization.

(WebCore::Style::loadPendingImages): Deleted.
(WebCore::Style::loadPendingSVGFilters): Deleted.
* style/StylePendingResources.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFilterImageValue.cpp
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/css/CSSToStyleMap.h
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/platform/graphics/filters/FilterOperation.cpp
Source/WebCore/platform/graphics/filters/FilterOperation.h
Source/WebCore/rendering/style/StyleCachedImage.cpp
Source/WebCore/style/StylePendingResources.cpp
Source/WebCore/style/StylePendingResources.h

index 704b752..3b6a121 100644 (file)
@@ -1,5 +1,57 @@
 2016-09-04  Antti Koivisto  <antti@apple.com>
 
+        Remove Style::PendingResources
+        https://bugs.webkit.org/show_bug.cgi?id=161574
+
+        Reviewed by Andreas Kling.
+
+        RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
+
+        * css/CSSFilterImageValue.cpp:
+        (WebCore::CSSFilterImageValue::loadSubimages):
+
+            Load external SVG resources along with any image resources.
+
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::styleImage):
+        (WebCore::CSSToStyleMap::mapFillImage):
+        (WebCore::CSSToStyleMap::mapNinePieceImage):
+        * css/CSSToStyleMap.h:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertStyleImage):
+        (WebCore::StyleBuilderConverter::convertShapeValue):
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyValueCursor):
+        (WebCore::StyleBuilderCustom::applyValueContent):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::clear):
+        (WebCore::StyleResolver::styleImage):
+        (WebCore::StyleResolver::createFilterOperations):
+        (WebCore::StyleResolver::loadPendingResources):
+        (WebCore::StyleResolver::State::ensurePendingResources): Deleted.
+        (WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
+        (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::State::takePendingResources): Deleted.
+        * platform/graphics/filters/FilterOperation.cpp:
+        (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
+        (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
+        * platform/graphics/filters/FilterOperation.h:
+        (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
+        * rendering/style/StyleCachedImage.cpp:
+        (WebCore::StyleCachedImage::StyleCachedImage):
+        * style/StylePendingResources.cpp:
+        (WebCore::Style::loadPendingResources):
+
+            Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
+            separately wasn't necessary or a meaningful optimization.
+
+        (WebCore::Style::loadPendingImages): Deleted.
+        (WebCore::Style::loadPendingSVGFilters): Deleted.
+        * style/StylePendingResources.h:
+
+2016-09-04  Antti Koivisto  <antti@apple.com>
+
         Reverse ownership relation of StyleCachedImage and CSSImageValue
         https://bugs.webkit.org/show_bug.cgi?id=161447
 
index 01a6df9..e5f5ef8 100644 (file)
@@ -30,6 +30,7 @@
 #include "CSSImageValue.h"
 #include "CachedImage.h"
 #include "CachedResourceLoader.h"
+#include "CachedSVGDocumentReference.h"
 #include "CrossfadeGeneratedImage.h"
 #include "FilterEffectRenderer.h"
 #include "ImageBuffer.h"
@@ -96,6 +97,13 @@ void CSSFilterImageValue::loadSubimages(CachedResourceLoader& cachedResourceLoad
             m_cachedImage->addClient(&m_filterSubimageObserver);
     }
 
+    for (auto& filterOperation : m_filterOperations.operations()) {
+        if (!is<ReferenceFilterOperation>(filterOperation.get()))
+            continue;
+        auto& referenceFilterOperation = downcast<ReferenceFilterOperation>(*filterOperation);
+        referenceFilterOperation.loadExternalDocumentIfNeeded(cachedResourceLoader, options);
+    }
+
     m_filterSubimageObserver.setReady(true);
 }
 
index f207cda..16dd2f0 100644 (file)
@@ -66,9 +66,9 @@ bool CSSToStyleMap::useSVGZoomRules() const
     return m_resolver->useSVGZoomRules();
 }
 
-RefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue& value)
+RefPtr<StyleImage> CSSToStyleMap::styleImage(CSSValue& value)
 {
-    return m_resolver->styleImage(propertyId, value);
+    return m_resolver->styleImage(value);
 }
 
 void CSSToStyleMap::mapFillAttachment(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
@@ -155,7 +155,7 @@ void CSSToStyleMap::mapFillImage(CSSPropertyID propertyID, FillLayer& layer, CSS
         return;
     }
 
-    layer.setImage(styleImage(propertyID, value));
+    layer.setImage(styleImage(value));
 }
 
 void CSSToStyleMap::mapFillRepeatX(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
@@ -557,18 +557,9 @@ void CSSToStyleMap::mapNinePieceImage(CSSPropertyID property, CSSValue* value, N
     // Retrieve the border image value.
     CSSValueList& borderImage = downcast<CSSValueList>(*value);
 
-    // Set the image (this kicks off the load).
-    CSSPropertyID imageProperty;
-    if (property == CSSPropertyWebkitBorderImage)
-        imageProperty = CSSPropertyBorderImageSource;
-    else if (property == CSSPropertyWebkitMaskBoxImage)
-        imageProperty = CSSPropertyWebkitMaskBoxImageSource;
-    else
-        imageProperty = property;
-
     for (auto& current : borderImage) {
         if (is<CSSImageValue>(current.get()) || is<CSSImageGeneratorValue>(current.get()) || is<CSSImageSetValue>(current.get()))
-            image.setImage(styleImage(imageProperty, current.get()));
+            image.setImage(styleImage(current.get()));
         else if (is<CSSBorderImageSliceValue>(current.get()))
             mapNinePieceImageSlice(current, image);
         else if (is<CSSValueList>(current.get())) {
index fd4dfa4..d5cbdae 100644 (file)
@@ -87,7 +87,7 @@ private:
     // FIXME: This should be part of some sort of StyleImageCache object which
     // is held by the StyleResolver, and likely provided to this object
     // during the resolve.
-    RefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue&);
+    RefPtr<StyleImage> styleImage(CSSValue&);
 
     StyleResolver* m_resolver;
 };
index 5015ea0..cf4fd72 100644 (file)
@@ -408,7 +408,7 @@ inline NinePieceImage StyleBuilderConverter::convertBorderMask(StyleResolver& st
 template <CSSPropertyID property>
 inline PassRefPtr<StyleImage> StyleBuilderConverter::convertStyleImage(StyleResolver& styleResolver, CSSValue& value)
 {
-    return styleResolver.styleImage(property, value);
+    return styleResolver.styleImage(value);
 }
 
 inline TransformOperations StyleBuilderConverter::convertTransform(StyleResolver& styleResolver, CSSValue& value)
@@ -741,7 +741,7 @@ inline PassRefPtr<ShapeValue> StyleBuilderConverter::convertShapeValue(StyleReso
     }
 
     if (isImageShape(value))
-        return ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, value));
+        return ShapeValue::createImageValue(styleResolver.styleImage(value));
 
     RefPtr<BasicShape> shape;
     CSSBoxType referenceBox = BoxMissing;
index 7a17290..777a361 100644 (file)
@@ -1147,7 +1147,7 @@ inline void StyleBuilderCustom::applyValueCursor(StyleResolver& styleResolver, C
     for (auto& item : list) {
         if (is<CSSCursorImageValue>(item.get())) {
             auto& image = downcast<CSSCursorImageValue>(item.get());
-            styleResolver.style()->addCursor(styleResolver.styleImage(CSSPropertyCursor, image), image.hotSpot());
+            styleResolver.style()->addCursor(styleResolver.styleImage(image), image.hotSpot());
             continue;
         }
 
@@ -1314,12 +1314,12 @@ inline void StyleBuilderCustom::applyValueContent(StyleResolver& styleResolver,
                 styleResolver.style()->setContent(StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(item.get())), didSet);
             didSet = true;
         } else if (is<CSSImageSetValue>(item.get())) {
-            styleResolver.style()->setContent(styleResolver.styleCachedImageFromValue(CSSPropertyContent, item), didSet);
+            styleResolver.style()->setContent(StyleCachedImage::create(item), didSet);
             didSet = true;
         }
 
         if (is<CSSImageValue>(item.get())) {
-            styleResolver.style()->setContent(styleResolver.styleCachedImageFromValue(CSSPropertyContent, item), didSet);
+            styleResolver.style()->setContent(StyleCachedImage::create(item), didSet);
             didSet = true;
             continue;
         }
index f4123bb..74892bb 100644 (file)
@@ -189,7 +189,6 @@ inline void StyleResolver::State::clear()
     m_parentStyle = nullptr;
     m_ownedParentStyle = nullptr;
     m_regionForStyling = nullptr;
-    m_pendingResources = nullptr;
     m_cssToLengthConversionData = CSSToLengthConversionData();
 }
 
@@ -378,13 +377,6 @@ void StyleResolver::State::setParentStyle(std::unique_ptr<RenderStyle> parentSty
     m_parentStyle = m_ownedParentStyle.get();
 }
 
-Style::PendingResources& StyleResolver::State::ensurePendingResources()
-{
-    if (!m_pendingResources)
-        m_pendingResources = std::make_unique<Style::PendingResources>();
-    return *m_pendingResources;
-}
-
 static inline bool isAtShadowBoundary(const Element& element)
 {
     auto* parentNode = element.parentNode();
@@ -1700,40 +1692,25 @@ RefPtr<CSSValue> StyleResolver::resolvedVariableValue(CSSPropertyID propID, cons
     return parser.parseVariableDependentValue(propID, value, m_state.style()->customProperties(), m_state.style()->direction(), m_state.style()->writingMode());
 }
 
-RefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue& value)
+RefPtr<StyleImage> StyleResolver::styleImage(CSSValue& value)
 {
     if (is<CSSImageGeneratorValue>(value)) {
         if (is<CSSGradientValue>(value))
-            return styleGeneratedImageFromValue(property, *downcast<CSSGradientValue>(value).gradientWithStylesResolved(this));
-        return styleGeneratedImageFromValue(property, downcast<CSSImageGeneratorValue>(value));
+            return StyleGeneratedImage::create(*downcast<CSSGradientValue>(value).gradientWithStylesResolved(this));
+
+        if (is<CSSFilterImageValue>(value)) {
+            // FilterImage needs to calculate FilterOperations.
+            downcast<CSSFilterImageValue>(value).createFilterOperations(this);
+        }
+        return StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(value));
     }
 
     if (is<CSSImageValue>(value) || is<CSSImageSetValue>(value) || is<CSSCursorImageValue>(value))
-        return styleCachedImageFromValue(property, value);
+        return StyleCachedImage::create(value);
 
     return nullptr;
 }
 
-Ref<StyleCachedImage> StyleResolver::styleCachedImageFromValue(CSSPropertyID property, CSSValue& value)
-{
-    auto image = StyleCachedImage::create(value);
-    if (image->isPending())
-        m_state.ensurePendingResources().pendingImages.set(property, &value);
-    return image;
-}
-
-Ref<StyleGeneratedImage> StyleResolver::styleGeneratedImageFromValue(CSSPropertyID property, CSSImageGeneratorValue& value)
-{
-    if (is<CSSFilterImageValue>(value)) {
-        // FilterImage needs to calculate FilterOperations.
-        downcast<CSSFilterImageValue>(value).createFilterOperations(this);
-    }
-    if (value.isPending())
-        m_state.ensurePendingResources().pendingImages.set(property, &value);
-
-    return StyleGeneratedImage::create(value);
-}
-
 #if ENABLE(IOS_TEXT_AUTOSIZING)
 void StyleResolver::checkForTextSizeAdjust(RenderStyle* style)
 {
@@ -1968,9 +1945,6 @@ bool StyleResolver::createFilterOperations(const CSSValue& inValue, FilterOperat
             URL url = m_state.document().completeURL(cssUrl);
 
             RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(cssUrl, url.fragmentIdentifier());
-            if (SVGURIReference::isExternalURIReference(cssUrl, m_state.document()))
-                state.ensurePendingResources().pendingSVGFilters.append(operation);
-
             operations.operations().append(operation);
             continue;
         }
@@ -2078,8 +2052,7 @@ void StyleResolver::loadPendingResources()
     RELEASE_ASSERT(!m_inLoadPendingImages);
     TemporaryChange<bool> changeInLoadPendingImages(m_inLoadPendingImages, true);
 
-    if (auto pendingResources = state().takePendingResources())
-        Style::loadPendingResources(*pendingResources, document(), *style(), m_state.element());
+    Style::loadPendingResources(*style(), document(), m_state.element());
 }
 
 inline StyleResolver::MatchedProperties::MatchedProperties()
index 22e1be6..d41eed8 100644 (file)
@@ -76,7 +76,6 @@ class StyleCachedImage;
 class StyleGeneratedImage;
 class StyleImage;
 class StyleKeyframe;
-class StylePendingImage;
 class StyleProperties;
 class StyleRule;
 class StyleRuleKeyframes;
@@ -407,9 +406,6 @@ public:
 
         bool useSVGZoomRules() const { return m_element && m_element->isSVGElement(); }
 
-        Style::PendingResources& ensurePendingResources();
-        std::unique_ptr<Style::PendingResources> takePendingResources() { return WTFMove(m_pendingResources); }
-
         const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
 
         CascadeLevel cascadeLevel() const { return m_cascadeLevel; }
@@ -446,7 +442,6 @@ public:
         FillLayer m_backgroundData { BackgroundFillLayer };
         Color m_backgroundColor;
 
-        std::unique_ptr<Style::PendingResources> m_pendingResources;
         CSSToLengthConversionData m_cssToLengthConversionData;
         
         CascadeLevel m_cascadeLevel { UserAgentLevel };
@@ -459,9 +454,7 @@ public:
     State& state() { return m_state; }
     const State& state() const { return m_state; }
 
-    RefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue&);
-    Ref<StyleCachedImage> styleCachedImageFromValue(CSSPropertyID, CSSValue&);
-    Ref<StyleGeneratedImage> styleGeneratedImageFromValue(CSSPropertyID, CSSImageGeneratorValue&);
+    RefPtr<StyleImage> styleImage(CSSValue&);
 
     bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle(); }
     bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle(); }
index 4c1704d..035e45b 100644 (file)
 #include "FilterOperation.h"
 
 #include "AnimationUtilities.h"
+#include "CachedResourceLoader.h"
 #include "CachedSVGDocumentReference.h"
 #include "FilterEffect.h"
+#include "SVGURIReference.h"
 #include "TextStream.h"
 
 namespace WebCore {
@@ -59,12 +61,15 @@ bool ReferenceFilterOperation::operator==(const FilterOperation& operation) cons
     
     return m_url == downcast<ReferenceFilterOperation>(operation).m_url;
 }
-    
-CachedSVGDocumentReference* ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference()
+
+void ReferenceFilterOperation::loadExternalDocumentIfNeeded(CachedResourceLoader& cachedResourceLoader, const ResourceLoaderOptions& options)
 {
-    if (!m_cachedSVGDocumentReference)
-        m_cachedSVGDocumentReference = std::make_unique<CachedSVGDocumentReference>(m_url);
-    return m_cachedSVGDocumentReference.get();
+    if (m_cachedSVGDocumentReference)
+        return;
+    if (!SVGURIReference::isExternalURIReference(m_url, *cachedResourceLoader.document()))
+        return;
+    m_cachedSVGDocumentReference = std::make_unique<CachedSVGDocumentReference>(m_url);
+    m_cachedSVGDocumentReference->load(cachedResourceLoader, options);
 }
 
 void ReferenceFilterOperation::setFilterEffect(PassRefPtr<FilterEffect> filterEffect)
index dc3bf88..321a5f3 100644 (file)
@@ -42,8 +42,10 @@ namespace WebCore {
 
 // CSS Filters
 
+class CachedResourceLoader;
 class CachedSVGDocumentReference;
 class FilterEffect;
+struct ResourceLoaderOptions;
 
 class FilterOperation : public RefCounted<FilterOperation> {
 public:
@@ -184,8 +186,9 @@ public:
     const String& url() const { return m_url; }
     const String& fragment() const { return m_fragment; }
 
+    void loadExternalDocumentIfNeeded(CachedResourceLoader&, const ResourceLoaderOptions&);
+
     CachedSVGDocumentReference* cachedSVGDocumentReference() const { return m_cachedSVGDocumentReference.get(); }
-    CachedSVGDocumentReference* getOrCreateCachedSVGDocumentReference();
 
     FilterEffect* filterEffect() const { return m_filterEffect.get(); }
     void setFilterEffect(PassRefPtr<FilterEffect>);
index 285f405..c5a6b0d 100644 (file)
@@ -38,6 +38,10 @@ StyleCachedImage::StyleCachedImage(CSSValue& cssValue)
     ASSERT(is<CSSImageValue>(m_cssValue) || is<CSSImageSetValue>(m_cssValue) || is<CSSCursorImageValue>(m_cssValue));
 
     m_isCachedImage = true;
+
+    // CSSImageValue doesn't get invalidated so we can grab the CachedImage immediately if it exists.
+    if (is<CSSImageValue>(m_cssValue))
+        m_cachedImage = downcast<CSSImageValue>(m_cssValue.get()).cachedImage();
 }
 
 StyleCachedImage::~StyleCachedImage()
index 7a9e985..9596469 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "CSSCursorImageValue.h"
 #include "CachedResourceLoader.h"
-#include "CachedSVGDocumentReference.h"
 #include "ContentData.h"
 #include "CursorData.h"
 #include "CursorList.h"
@@ -60,82 +59,37 @@ static void loadPendingImage(Document& document, const StyleImage* styleImage, c
     const_cast<StyleImage&>(*styleImage).load(document.cachedResourceLoader(), options);
 }
 
-static void loadPendingImages(const PendingResources& pendingResources, Document& document, RenderStyle& style, const Element* element)
+void loadPendingResources(RenderStyle& style, Document& document, const Element* element)
 {
-    for (auto currentProperty : pendingResources.pendingImages.keys()) {
-        switch (currentProperty) {
-        case CSSPropertyBackgroundImage: {
-            for (auto* backgroundLayer = &style.ensureBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next())
-                loadPendingImage(document, backgroundLayer->image(), element);
-            break;
-        }
-        case CSSPropertyContent: {
-            for (auto* contentData = const_cast<ContentData*>(style.contentData()); contentData; contentData = contentData->next()) {
-                if (is<ImageContentData>(*contentData)) {
-                    auto& styleImage = downcast<ImageContentData>(*contentData).image();
-                    loadPendingImage(document, &styleImage, element);
-                }
-            }
-            break;
-        }
-        case CSSPropertyCursor: {
-            if (auto* cursorList = style.cursors()) {
-                for (size_t i = 0; i < cursorList->size(); ++i)
-                    loadPendingImage(document, cursorList->at(i).image(), element);
-            }
-            break;
-        }
-        case CSSPropertyListStyleImage: {
-            loadPendingImage(document, style.listStyleImage(), element);
-            break;
-        }
-        case CSSPropertyBorderImageSource: {
-            loadPendingImage(document, style.borderImageSource(), element);
-            break;
-        }
-        case CSSPropertyWebkitBoxReflect: {
-            if (auto* reflection = style.boxReflect())
-                loadPendingImage(document, reflection->mask().image(), element);
-            break;
-        }
-        case CSSPropertyWebkitMaskBoxImageSource: {
-            loadPendingImage(document, style.maskBoxImageSource(), element);
-            break;
-        }
-        case CSSPropertyWebkitMaskImage: {
-            for (auto* maskLayer = &style.ensureMaskLayers(); maskLayer; maskLayer = maskLayer->next())
-                loadPendingImage(document, maskLayer->image(), element);
-            break;
-        }
-#if ENABLE(CSS_SHAPES)
-        case CSSPropertyWebkitShapeOutside: {
-            if (style.shapeOutside())
-                loadPendingImage(document, style.shapeOutside()->image(), element, LoadPolicy::ShapeOutside);
-            break;
-        }
-#endif
-        default:
-            ASSERT_NOT_REACHED();
+    for (auto* backgroundLayer = style.backgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next())
+        loadPendingImage(document, backgroundLayer->image(), element);
+
+    for (auto* contentData = style.contentData(); contentData; contentData = contentData->next()) {
+        if (is<ImageContentData>(*contentData)) {
+            auto& styleImage = downcast<ImageContentData>(*contentData).image();
+            loadPendingImage(document, &styleImage, element);
         }
     }
-}
 
-static void loadPendingSVGFilters(const PendingResources& pendingResources, Document& document, const Element* element)
-{
-    if (pendingResources.pendingSVGFilters.isEmpty())
-        return;
+    if (auto* cursorList = style.cursors()) {
+        for (size_t i = 0; i < cursorList->size(); ++i)
+            loadPendingImage(document, cursorList->at(i).image(), element);
+    }
 
-    ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
-    options.contentSecurityPolicyImposition = element && element->isInUserAgentShadowTree() ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck;
+    loadPendingImage(document, style.listStyleImage(), element);
+    loadPendingImage(document, style.borderImageSource(), element);
+    loadPendingImage(document, style.maskBoxImageSource(), element);
 
-    for (auto& filterOperation : pendingResources.pendingSVGFilters)
-        filterOperation->getOrCreateCachedSVGDocumentReference()->load(document.cachedResourceLoader(), options);
-}
+    if (auto* reflection = style.boxReflect())
+        loadPendingImage(document, reflection->mask().image(), element);
 
-void loadPendingResources(const PendingResources& pendingResources, Document& document, RenderStyle& style, const Element* element)
-{
-    loadPendingImages(pendingResources, document, style, element);
-    loadPendingSVGFilters(pendingResources, document, element);
+    for (auto* maskLayer = style.maskLayers(); maskLayer; maskLayer = maskLayer->next())
+        loadPendingImage(document, maskLayer->image(), element);
+
+#if ENABLE(CSS_SHAPES)
+    if (style.shapeOutside())
+        loadPendingImage(document, style.shapeOutside()->image(), element, LoadPolicy::ShapeOutside);
+#endif
 }
 
 }
index 68bc1fd..18ecdc0 100644 (file)
 
 #pragma once
 
-#include "CSSPropertyNames.h"
-#include "FilterOperations.h"
-#include <wtf/HashMap.h>
-
 namespace WebCore {
 
-class CSSValue;
 class Document;
 class Element;
 class RenderStyle;
 
 namespace Style {
 
-struct PendingResources {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    HashMap<CSSPropertyID, RefPtr<CSSValue>> pendingImages;
-    Vector<RefPtr<ReferenceFilterOperation>> pendingSVGFilters;
-};
-
-void loadPendingResources(const PendingResources&, Document&, RenderStyle&, const Element*);
+void loadPendingResources(RenderStyle&, Document&, const Element*);
 
 }
 }