Revert use of SVG <mask> elements for -webkit-mask-image (r176798, r177494, r186180)
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2015 01:11:49 +0000 (01:11 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2015 01:11:49 +0000 (01:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146653

Fixes rdar://problem/21435233.

This patch reverts r186180, but keeps the layout test.

This feature caused a number of regressions (bugs 141857, 146509, 146561), added new layering violations, and
was not being maintained, so revert it.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource): Deleted.
* loader/cache/CachedResourceRequest.h:
(WebCore::CachedResourceRequest::acceptOverride): Deleted.
(WebCore::CachedResourceRequest::setAcceptOverride): Deleted.
* loader/cache/CachedSVGDocumentReference.cpp:
(WebCore::CachedSVGDocumentReference::load): Deleted.
* loader/cache/CachedSVGDocumentReference.h:
(WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType): Deleted.
* platform/graphics/MaskImageOperation.cpp:
(WebCore::MaskImageOperation::ensureCachedSVGDocumentReference):
(WebCore::MaskImageOperation::notifyFinished):

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

Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/loader/cache/CachedSVGDocumentReference.cpp
Source/WebCore/loader/cache/CachedSVGDocumentReference.h
Source/WebCore/platform/graphics/MaskImageOperation.cpp

index 260584a..a4bf239 100644 (file)
@@ -1,3 +1,28 @@
+2015-07-06  Simon Fraser  <simon.fraser@apple.com>
+
+        Revert use of SVG <mask> elements for -webkit-mask-image (r176798, r177494, r186180)
+        https://bugs.webkit.org/show_bug.cgi?id=146653
+        
+        Fixes rdar://problem/21435233.
+
+        This patch reverts r186180, but keeps the layout test.
+
+        This feature caused a number of regressions (bugs 141857, 146509, 146561), added new layering violations, and
+        was not being maintained, so revert it.
+        
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource): Deleted.
+        * loader/cache/CachedResourceRequest.h:
+        (WebCore::CachedResourceRequest::acceptOverride): Deleted.
+        (WebCore::CachedResourceRequest::setAcceptOverride): Deleted.
+        * loader/cache/CachedSVGDocumentReference.cpp:
+        (WebCore::CachedSVGDocumentReference::load): Deleted.
+        * loader/cache/CachedSVGDocumentReference.h:
+        (WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType): Deleted.
+        * platform/graphics/MaskImageOperation.cpp:
+        (WebCore::MaskImageOperation::ensureCachedSVGDocumentReference):
+        (WebCore::MaskImageOperation::notifyFinished):
+
 2015-07-06  Daniel Bates  <dabates@apple.com>
 
         Fix the Windows build following <https://trac.webkit.org/changeset/186388>
index 09e9784..cc5551b 100644 (file)
@@ -564,9 +564,6 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
         resource->setLoadPriority(request.priority());
 
     if ((policy != Use || resource->stillNeedsLoad()) && CachedResourceRequest::NoDefer == request.defer()) {
-        if (request.acceptOverride())
-            resource->setAccept(request.acceptOverride().value());
-
         resource->load(*this, request.options());
 
         // We don't support immediate loads, but we do support immediate failure.
index 6f46b67..41dcddc 100644 (file)
@@ -53,14 +53,12 @@ public:
     const ResourceLoaderOptions& options() const { return m_options; }
     void setOptions(const ResourceLoaderOptions& options) { m_options = options; }
     const Optional<ResourceLoadPriority>& priority() const { return m_priority; }
-    const Optional<String>& acceptOverride() const { return m_acceptOverride; }
     bool forPreload() const { return m_forPreload; }
     void setForPreload(bool forPreload) { m_forPreload = forPreload; }
     DeferOption defer() const { return m_defer; }
     void setDefer(DeferOption defer) { m_defer = defer; }
     void setInitiator(PassRefPtr<Element>);
     void setInitiator(const AtomicString& name);
-    void setAcceptOverride(const String& accept) { m_acceptOverride = accept; }
     const AtomicString& initiatorName() const;
 
     void setInitiator(DocumentLoader&);
@@ -71,7 +69,6 @@ private:
     String m_charset;
     ResourceLoaderOptions m_options;
     Optional<ResourceLoadPriority> m_priority;
-    Optional<String> m_acceptOverride;
     bool m_forPreload;
     DeferOption m_defer;
     RefPtr<Element> m_initiatorElement;
index 86360e2..8ccaf79 100644 (file)
@@ -60,8 +60,6 @@ void CachedSVGDocumentReference::load(CachedResourceLoader& loader, const Resour
 
     CachedResourceRequest request(ResourceRequest(loader.document()->completeURL(m_url)), options);
     request.setInitiator(cachedResourceRequestInitiators().css);
-    if (m_acceptsAnyImageType)
-        request.setAcceptOverride("image/*");
     m_document = loader.requestSVGDocument(request);
     if (m_document) {
         m_document->setCanReuse(m_canReuseResource);
index a975ada..92bf395 100644 (file)
@@ -44,7 +44,6 @@ public:
 
     void load(CachedResourceLoader&, const ResourceLoaderOptions&);
     bool loadRequested() const { return m_loadRequested; }
-    void setAcceptsAnyImageType() { m_acceptsAnyImageType = true; }
 
     CachedSVGDocument* document() { return m_document.get(); }
 
@@ -54,7 +53,6 @@ private:
     bool m_loadRequested;
     CachedSVGDocumentClient* m_additionalDocumentClient;
     bool m_canReuseResource;
-    bool m_acceptsAnyImageType { false };
 };
 
 };
index e8f7230..46142e3 100644 (file)
@@ -193,12 +193,8 @@ CachedSVGDocumentReference* MaskImageOperation::ensureCachedSVGDocumentReference
     if (image())
         return nullptr;
 
-    if (!m_cachedSVGDocumentReference.get()) {
+    if (!m_cachedSVGDocumentReference.get())
         m_cachedSVGDocumentReference = std::make_unique<CachedSVGDocumentReference>(m_url, this, false);
-        // FIXME: For some strange reason we load all mask resources using CachedSVGDocument.
-        //        This requires overriding SVG mime type in Accept header or server may reject the request.
-        m_cachedSVGDocumentReference->setAcceptsAnyImageType();
-    }
     return m_cachedSVGDocumentReference.get();
 }
 
@@ -223,10 +219,9 @@ void MaskImageOperation::notifyFinished(CachedResource* resource)
             }
         }
     }
-
+    
     // If no valid mask was found, this is not a valid SVG document or it specified an invalid fragment identifier.
     // Fallback to the normal way of loading the document in an Image object.
-    // FIXME: This is silly.
     if (!validMaskFound) {
         // Get the resource loader, acquire the resource buffer and load it into an image.
         ASSERT(cachedSVGDocument->loader());