Title: [205421] trunk/Source/WebCore
Revision
205421
Author
an...@apple.com
Date
2016-09-04 11:50:21 -0700 (Sun, 04 Sep 2016)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205420 => 205421)


--- trunk/Source/WebCore/ChangeLog	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/ChangeLog	2016-09-04 18:50:21 UTC (rev 205421)
@@ -1,5 +1,57 @@
 2016-09-04  Antti Koivisto  <an...@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  <an...@apple.com>
+
         Reverse ownership relation of StyleCachedImage and CSSImageValue
         https://bugs.webkit.org/show_bug.cgi?id=161447
 

Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (205420 => 205421)


--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp	2016-09-04 18:50:21 UTC (rev 205421)
@@ -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 @@
             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);
 }
 

Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (205420 => 205421)


--- trunk/Source/WebCore/css/CSSToStyleMap.cpp	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp	2016-09-04 18:50:21 UTC (rev 205421)
@@ -66,9 +66,9 @@
     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 @@
         return;
     }
 
-    layer.setImage(styleImage(propertyID, value));
+    layer.setImage(styleImage(value));
 }
 
 void CSSToStyleMap::mapFillRepeatX(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
@@ -557,18 +557,9 @@
     // 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())) {

Modified: trunk/Source/WebCore/css/CSSToStyleMap.h (205420 => 205421)


--- trunk/Source/WebCore/css/CSSToStyleMap.h	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/CSSToStyleMap.h	2016-09-04 18:50:21 UTC (rev 205421)
@@ -87,7 +87,7 @@
     // 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;
 };

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (205420 => 205421)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2016-09-04 18:50:21 UTC (rev 205421)
@@ -408,7 +408,7 @@
 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 @@
     }
 
     if (isImageShape(value))
-        return ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, value));
+        return ShapeValue::createImageValue(styleResolver.styleImage(value));
 
     RefPtr<BasicShape> shape;
     CSSBoxType referenceBox = BoxMissing;

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (205420 => 205421)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2016-09-04 18:50:21 UTC (rev 205421)
@@ -1147,7 +1147,7 @@
     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 @@
                 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;
         }

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (205420 => 205421)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2016-09-04 18:50:21 UTC (rev 205421)
@@ -189,7 +189,6 @@
     m_parentStyle = nullptr;
     m_ownedParentStyle = nullptr;
     m_regionForStyling = nullptr;
-    m_pendingResources = nullptr;
     m_cssToLengthConversionData = CSSToLengthConversionData();
 }
 
@@ -378,13 +377,6 @@
     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 @@
     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 @@
             URL url = ""
 
             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 @@
     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()

Modified: trunk/Source/WebCore/css/StyleResolver.h (205420 => 205421)


--- trunk/Source/WebCore/css/StyleResolver.h	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleResolver.h	2016-09-04 18:50:21 UTC (rev 205421)
@@ -76,7 +76,6 @@
 class StyleGeneratedImage;
 class StyleImage;
 class StyleKeyframe;
-class StylePendingImage;
 class StyleProperties;
 class StyleRule;
 class StyleRuleKeyframes;
@@ -407,9 +406,6 @@
 
         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 @@
         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 @@
     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(); }

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp (205420 => 205421)


--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp	2016-09-04 18:50:21 UTC (rev 205421)
@@ -27,8 +27,10 @@
 #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 @@
     
     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)

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h (205420 => 205421)


--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2016-09-04 18:50:21 UTC (rev 205421)
@@ -42,8 +42,10 @@
 
 // CSS Filters
 
+class CachedResourceLoader;
 class CachedSVGDocumentReference;
 class FilterEffect;
+struct ResourceLoaderOptions;
 
 class FilterOperation : public RefCounted<FilterOperation> {
 public:
@@ -184,8 +186,9 @@
     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>);

Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp (205420 => 205421)


--- trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp	2016-09-04 18:50:21 UTC (rev 205421)
@@ -38,6 +38,10 @@
     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()

Modified: trunk/Source/WebCore/style/StylePendingResources.cpp (205420 => 205421)


--- trunk/Source/WebCore/style/StylePendingResources.cpp	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/style/StylePendingResources.cpp	2016-09-04 18:50:21 UTC (rev 205421)
@@ -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 @@
     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;
+    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);
         }
-        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();
-        }
     }
-}
 
-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
 }
 
 }

Modified: trunk/Source/WebCore/style/StylePendingResources.h (205420 => 205421)


--- trunk/Source/WebCore/style/StylePendingResources.h	2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/style/StylePendingResources.h	2016-09-04 18:50:21 UTC (rev 205421)
@@ -25,13 +25,8 @@
 
 #pragma once
 
-#include "CSSPropertyNames.h"
-#include "FilterOperations.h"
-#include <wtf/HashMap.h>
-
 namespace WebCore {
 
-class CSSValue;
 class Document;
 class Element;
 class RenderStyle;
@@ -38,14 +33,7 @@
 
 namespace Style {
 
-struct PendingResources {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    HashMap<CSSPropertyID, RefPtr<CSSValue>> pendingImages;
-    Vector<RefPtr<ReferenceFilterOperation>> pendingSVGFilters;
-};
+void loadPendingResources(RenderStyle&, Document&, const Element*);
 
-void loadPendingResources(const PendingResources&, Document&, RenderStyle&, const Element*);
-
 }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to