Title: [132836] branches/chromium/1271

Diff

Copied: branches/chromium/1271/LayoutTests/css3/filters/reference-filter-update-after-remove-expected.txt (from rev 132528, trunk/LayoutTests/css3/filters/reference-filter-update-after-remove-expected.txt) (0 => 132836)


--- branches/chromium/1271/LayoutTests/css3/filters/reference-filter-update-after-remove-expected.txt	                        (rev 0)
+++ branches/chromium/1271/LayoutTests/css3/filters/reference-filter-update-after-remove-expected.txt	2012-10-29 19:06:51 UTC (rev 132836)
@@ -0,0 +1 @@
+If you can read this, the test passed.

Copied: branches/chromium/1271/LayoutTests/css3/filters/reference-filter-update-after-remove.html (from rev 132528, trunk/LayoutTests/css3/filters/reference-filter-update-after-remove.html) (0 => 132836)


--- branches/chromium/1271/LayoutTests/css3/filters/reference-filter-update-after-remove.html	                        (rev 0)
+++ branches/chromium/1271/LayoutTests/css3/filters/reference-filter-update-after-remove.html	2012-10-29 19:06:51 UTC (rev 132836)
@@ -0,0 +1,35 @@
+<script>
+internals.settings.setCSSVariablesEnabled(true);
+</script>
+<style>
+body {
+    -webkit-var-a: url(1);
+    -webkit-filter: -webkit-var(a);
+}
+body::first-letter {
+    cursor: inherit;
+}
+</style>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText(false);
+}
+function init() {
+  var docElement = document.documentElement;
+  rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
+  docElement.appendChild(rect);
+  text = document.createTextNode("If you can read this, the test passed.");
+  docElement.appendChild(text);
+  setTimeout("edit();", 20);
+}
+document.addEventListener("DOMContentLoaded", init, false);
+function edit() {
+  document.designMode = "on";
+  r = document.createRange();
+  r.selectNodeContents(rect);
+  window.getSelection().addRange(r);
+  window.getSelection().deleteFromDocument();
+  if (window.testRunner) testRunner.notifyDone();
+}
+</script>

Copied: branches/chromium/1271/Source/WebCore/css/CachedSVGDocumentReference.h (from rev 132528, trunk/Source/WebCore/css/CachedSVGDocumentReference.h) (0 => 132836)


--- branches/chromium/1271/Source/WebCore/css/CachedSVGDocumentReference.h	                        (rev 0)
+++ branches/chromium/1271/Source/WebCore/css/CachedSVGDocumentReference.h	2012-10-29 19:06:51 UTC (rev 132836)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedSVGDocumentReference_h
+#define CachedSVGDocumentReference_h
+
+#if ENABLE(SVG) && ENABLE(CSS_FILTERS)
+#include "CachedResourceHandle.h"
+#include "FilterOperation.h"
+
+namespace WebCore {
+
+class CachedSVGDocument;
+
+class CachedSVGDocumentReference : public ReferenceFilterOperation::Data, public CachedSVGDocumentClient {
+public:
+    CachedSVGDocumentReference(CachedSVGDocument* document) : m_document(document) { m_document->addClient(this); }
+    virtual ~CachedSVGDocumentReference() { m_document->removeClient(this); }
+    CachedSVGDocument* document() { return m_document.get(); }
+private:
+    CachedResourceHandle<CachedSVGDocument> m_document;
+};
+
+};
+
+#endif
+
+#endif

Modified: branches/chromium/1271/Source/WebCore/css/StyleResolver.cpp (132835 => 132836)


--- branches/chromium/1271/Source/WebCore/css/StyleResolver.cpp	2012-10-29 19:01:41 UTC (rev 132835)
+++ branches/chromium/1271/Source/WebCore/css/StyleResolver.cpp	2012-10-29 19:06:51 UTC (rev 132836)
@@ -139,6 +139,7 @@
 
 #if ENABLE(SVG)
 #include "CachedSVGDocument.h"
+#include "CachedSVGDocumentReference.h"
 #include "SVGDocument.h"
 #include "SVGElement.h"
 #include "SVGNames.h"
@@ -5198,7 +5199,7 @@
                 continue;
 
             // Stash the CachedSVGDocument on the reference filter.
-            referenceFilter->setData(cachedDocument);
+            referenceFilter->setData(adoptPtr(new CachedSVGDocumentReference(cachedDocument)));
         }
     }
     m_pendingSVGDocuments.clear();
@@ -5533,7 +5534,7 @@
                 if (!svgDocumentValue->loadRequested())
                     m_pendingSVGDocuments.set(operation.get(), svgDocumentValue);
                 else
-                    operation->setData(svgDocumentValue->cachedSVGDocument());
+                    operation->setData(adoptPtr(new CachedSVGDocumentReference(svgDocumentValue->cachedSVGDocument())));
             }
             operations.operations().append(operation);
 #endif

Modified: branches/chromium/1271/Source/WebCore/platform/graphics/filters/FilterOperation.h (132835 => 132836)


--- branches/chromium/1271/Source/WebCore/platform/graphics/filters/FilterOperation.h	2012-10-29 19:01:41 UTC (rev 132835)
+++ branches/chromium/1271/Source/WebCore/platform/graphics/filters/FilterOperation.h	2012-10-29 19:06:51 UTC (rev 132836)
@@ -161,14 +161,19 @@
         return adoptRef(new ReferenceFilterOperation(url, fragment, type));
     }
 
+    class Data {
+    public:
+        virtual ~Data() { }
+    };
+
     virtual bool affectsOpacity() const { return true; }
     virtual bool movesPixels() const { return true; }
 
     const String& url() const { return m_url; }
     const String& fragment() const { return m_fragment; }
 
-    void* data() const { return m_data; }
-    void setData(void* data) { m_data = data; }
+    Data* data() const { return m_data.get(); }
+    void setData(PassOwnPtr<Data> data) { m_data = data; }
 
 private:
 
@@ -184,13 +189,12 @@
         : FilterOperation(type)
         , m_url(url)
         , m_fragment(fragment)
-        , m_data(0)
     {
     }
 
     String m_url;
     String m_fragment;
-    void* m_data;
+    OwnPtr<Data> m_data;
 };
 
 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color matrix effect.

Modified: branches/chromium/1271/Source/WebCore/rendering/FilterEffectRenderer.cpp (132835 => 132836)


--- branches/chromium/1271/Source/WebCore/rendering/FilterEffectRenderer.cpp	2012-10-29 19:01:41 UTC (rev 132835)
+++ branches/chromium/1271/Source/WebCore/rendering/FilterEffectRenderer.cpp	2012-10-29 19:06:51 UTC (rev 132836)
@@ -54,6 +54,7 @@
 
 #if ENABLE(SVG)
 #include "CachedSVGDocument.h"
+#include "CachedSVGDocumentReference.h"
 #include "SVGElement.h"
 #include "SVGFilterPrimitiveStandardAttributes.h"
 #include "SourceAlpha.h"
@@ -140,7 +141,8 @@
 PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(Document* document, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* op)
 {
 #if ENABLE(SVG)
-    CachedSVGDocument* cachedSVGDocument = static_cast<CachedSVGDocument*>(op->data());
+    CachedSVGDocumentReference* cachedSVGDocumentReference = static_cast<CachedSVGDocumentReference*>(op->data());
+    CachedSVGDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : 0;
 
     // If we have an SVG document, this is an external reference. Otherwise
     // we look up the referenced node in the current document.

Modified: branches/chromium/1271/Source/WebCore/rendering/RenderLayerFilterInfo.cpp (132835 => 132836)


--- branches/chromium/1271/Source/WebCore/rendering/RenderLayerFilterInfo.cpp	2012-10-29 19:01:41 UTC (rev 132835)
+++ branches/chromium/1271/Source/WebCore/rendering/RenderLayerFilterInfo.cpp	2012-10-29 19:06:51 UTC (rev 132836)
@@ -37,6 +37,7 @@
 
 #if ENABLE(SVG)
 #include "CachedSVGDocument.h"
+#include "CachedSVGDocumentReference.h"
 #include "SVGElement.h"
 #include "SVGFilter.h"
 #include "SVGFilterPrimitiveStandardAttributes.h"
@@ -129,7 +130,8 @@
         if (filterOperation->getOperationType() != FilterOperation::REFERENCE)
             continue;
         ReferenceFilterOperation* referenceFilterOperation = static_cast<ReferenceFilterOperation*>(filterOperation.get());
-        CachedSVGDocument* cachedSVGDocument = static_cast<CachedSVGDocument*>(referenceFilterOperation->data());
+        CachedSVGDocumentReference* documentReference = static_cast<CachedSVGDocumentReference*>(referenceFilterOperation->data());
+        CachedSVGDocument* cachedSVGDocument = documentReference ? documentReference->document() : 0;
 
         if (cachedSVGDocument) {
             // Reference is external; wait for notifyFinished().
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to