LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Mar 2006 23:47:58 +0000 (23:47 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Mar 2006 23:47:58 +0000 (23:47 +0000)
        Reviewed by Eric.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8026
          A particular animated SVG crashes in filter code
          <rdar://problem/4494775> A particular animated SVG crashes in filter code

        * svg/custom/empty-merge-expected.checksum: Added.
        * svg/custom/empty-merge-expected.png: Added.
        * svg/custom/empty-merge-expected.txt: Added.
        * svg/custom/empty-merge.svg: Added.

WebCore:

        Reviewed by Eric.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8026
          A particular animated SVG crashes in filter code
          <rdar://problem/4494775> A particular animated SVG crashes in filter code

        - fix some code that is not handling references correctly for GC

        Test: svg/custom/empty-merge.svg

        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
        (WebCore::KCanvasFilterQuartz::KCanvasFilterQuartz): Use KWQRetainNSRelease to
        properly retain a reference to an Objective-C object in a C++ class.
        (WebCore::KCanvasFilterQuartz::~KCanvasFilterQuartz): Use KWQRelease instead of
        release.
        (WebCore::KCanvasFilterQuartz::prepareFilter): Use KWQRetain instead of retain.
        (WebCore::KCanvasFilterQuartz::applyFilter): Use KWQRelease instead of release.
        (WebCore::KCanvasFilterQuartz::imageForName): Use objectForKey: instead of
        valueForKey: on the dictionary to sidestep a bug in valueForKey: on empty strings
        and because what we're doing with a dictionary here has nothing to do with
        key value encoding.

        * kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
        (WebCore::KRenderingDeviceContextQuartz::~KRenderingDeviceContextQuartz):
        Use KWQRelease instead of release.
        (WebCore::KRenderingDeviceContextQuartz::nsGraphicsContext): Use KWQRetain
        instead of retain to properly retain a reference to an Objective-C object
        in a C++ class.

        * platform/mac/ImageMac.mm:
        (WebCore::Image::invalidateNativeData): Use CFRelease instead of release.
        (WebCore::Image::getNSImage): Use KWQRetainNSRelease to properly retain
        a reference to an Objective-C object in a C++ class.

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/empty-merge-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/empty-merge-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/empty-merge-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/empty-merge.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/kcanvas/device/quartz/KCanvasFilterQuartz.mm
WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.mm
WebCore/platform/mac/ImageMac.mm

index 579f7a3f7d5e4a379487a7fd93df1537bc87567f..16fbe00801b586024e4a04b7408d982a52b68f15 100644 (file)
@@ -1,3 +1,16 @@
+2006-03-29  Darin Adler  <darin@apple.com>
+
+        Reviewed by Eric.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8026
+          A particular animated SVG crashes in filter code
+          <rdar://problem/4494775> A particular animated SVG crashes in filter code
+
+        * svg/custom/empty-merge-expected.checksum: Added.
+        * svg/custom/empty-merge-expected.png: Added.
+        * svg/custom/empty-merge-expected.txt: Added.
+        * svg/custom/empty-merge.svg: Added.
+
 2006-03-29  Geoffrey Garen  <ggaren@apple.com>
 
         - Layout test for <rdar://problem/4477126> TOT REGRESSION: with
diff --git a/LayoutTests/svg/custom/empty-merge-expected.checksum b/LayoutTests/svg/custom/empty-merge-expected.checksum
new file mode 100644 (file)
index 0000000..76a0ce7
--- /dev/null
@@ -0,0 +1,2 @@
+d73791f973c72efa8e996b1630f872cb
+\ No newline at end of file
diff --git a/LayoutTests/svg/custom/empty-merge-expected.png b/LayoutTests/svg/custom/empty-merge-expected.png
new file mode 100644 (file)
index 0000000..b543645
Binary files /dev/null and b/LayoutTests/svg/custom/empty-merge-expected.png differ
diff --git a/LayoutTests/svg/custom/empty-merge-expected.txt b/LayoutTests/svg/custom/empty-merge-expected.txt
new file mode 100644 (file)
index 0000000..8d98b64
--- /dev/null
@@ -0,0 +1,7 @@
+KCanvasResource {id="MyFilter" [type=FILTER]  [bounding box=at (0,0) size 100x100] [bounding box mode=0] [effect bounding box mode=0] [effects=[[type=MERGE]  [subregion="at (0,0) size 100x100"][merge inputs=[]]]]}
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (46.56,-0.94) size 191.76x191.76
+      KCanvasItem {rect} at (48.44,0.94) size 189.88x189.88 [stroke={[type=SOLID] [color=#0000FF]}] [fill={[type=SOLID] [color=#888888]}] [data="M1.00,1.00L101.00,1.00L101.00,101.00L1.00,101.00"]
+      KCanvasContainer {g} at (46.56,-0.94) size 189.88x189.88 [filter=#MyFilter]
+        KCanvasItem {rect} at (46.56,-0.94) size 189.88x189.88 [stroke={[type=SOLID] [color=#0000FF]}] [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
diff --git a/LayoutTests/svg/custom/empty-merge.svg b/LayoutTests/svg/custom/empty-merge.svg
new file mode 100644 (file)
index 0000000..80467f4
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
+              "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="7.5cm" height="5cm" viewBox="0 0 100 100"
+     xmlns="http://www.w3.org/2000/svg" version="1.1">
+  <title>TestCase for empty feMerge component</title>
+  <defs>
+    <filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
+      <feMerge>
+        <feMergeNode/>
+      </feMerge>
+    </filter>
+  </defs>
+  <rect x="1" y="1" width="100" height="100" fill="#888888" stroke="blue" />
+  <g filter="url(#MyFilter)" >
+    <rect fill="green" stroke="blue" x="0" y="0" width="100" height="100"/>
+  </g>
+</svg>
index 3572257a3fad5c4a993fd52bcf19fcd1ff853e6b..47989b13e39add830e720a31fa20175892b16c1f 100644 (file)
@@ -1,3 +1,39 @@
+2006-03-29  Darin Adler  <darin@apple.com>
+
+        Reviewed by Eric.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8026
+          A particular animated SVG crashes in filter code
+          <rdar://problem/4494775> A particular animated SVG crashes in filter code
+
+        - fix some code that is not handling references correctly for GC
+
+        Test: svg/custom/empty-merge.svg
+
+        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
+        (WebCore::KCanvasFilterQuartz::KCanvasFilterQuartz): Use KWQRetainNSRelease to
+        properly retain a reference to an Objective-C object in a C++ class.
+        (WebCore::KCanvasFilterQuartz::~KCanvasFilterQuartz): Use KWQRelease instead of
+        release.
+        (WebCore::KCanvasFilterQuartz::prepareFilter): Use KWQRetain instead of retain.
+        (WebCore::KCanvasFilterQuartz::applyFilter): Use KWQRelease instead of release.
+        (WebCore::KCanvasFilterQuartz::imageForName): Use objectForKey: instead of
+        valueForKey: on the dictionary to sidestep a bug in valueForKey: on empty strings
+        and because what we're doing with a dictionary here has nothing to do with
+        key value encoding.
+
+        * kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
+        (WebCore::KRenderingDeviceContextQuartz::~KRenderingDeviceContextQuartz):
+        Use KWQRelease instead of release.
+        (WebCore::KRenderingDeviceContextQuartz::nsGraphicsContext): Use KWQRetain
+        instead of retain to properly retain a reference to an Objective-C object
+        in a C++ class.
+
+        * platform/mac/ImageMac.mm:
+        (WebCore::Image::invalidateNativeData): Use CFRelease instead of release.
+        (WebCore::Image::getNSImage): Use KWQRetainNSRelease to properly retain
+        a reference to an Objective-C object in a C++ class.
+
 2006-03-29  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin.
index 9f03c6129cae9d00e069374f465c8157d5ccd405..e8ec2f6a67190f605449636a63eb3076f55911a7 100644 (file)
 #if SVG_SUPPORT
 #import "KCanvasFilterQuartz.h"
 
+#import "BlockExceptions.h"
 #import "CachedImage.h"
+#import "FoundationExtras.h"
 #import "Image.h"
 #import "IntRect.h"
 #import "KCanvasMatrix.h"
 #import "KCanvasRenderingStyle.h"
 #import "KRenderingDeviceQuartz.h"
-#import "BlockExceptions.h"
 #import "QuartzSupport.h"
 #import "WKArithmeticFilter.h"
 #import "WKDiffuseLightingFilter.h"
@@ -69,14 +70,16 @@ static inline CIVector *ciVector(FloatPoint point)
     return [CIVector vectorWithX:point.x() Y:point.y()];
 }
 
-KCanvasFilterQuartz::KCanvasFilterQuartz() : m_filterCIContext(0), m_filterCGLayer(0), m_imagesByName(0)
+KCanvasFilterQuartz::KCanvasFilterQuartz() : m_filterCIContext(0), m_filterCGLayer(0)
 {
-    m_imagesByName = [[NSMutableDictionary alloc] init];
+    m_imagesByName = KWQRetainNSRelease([[NSMutableDictionary alloc] init]);
 }
 
 KCanvasFilterQuartz::~KCanvasFilterQuartz()
 {
-    [m_imagesByName release];
+    ASSERT(!m_filterCGLayer);
+    ASSERT(!m_filterCIContext);
+    KWQRelease(m_imagesByName);
 }
 
 void KCanvasFilterQuartz::prepareFilter(const FloatRect &bbox)
@@ -93,7 +96,7 @@ void KCanvasFilterQuartz::prepareFilter(const FloatRect &bbox)
     if (useSoftware)
         contextOptions = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], kCIContextUseSoftwareRenderer, nil];
     
-    m_filterCIContext = [[CIContext contextWithCGContext:cgContext options:contextOptions] retain];
+    m_filterCIContext = KWQRetain([CIContext contextWithCGContext:cgContext options:contextOptions]);
     m_filterCGLayer = [m_filterCIContext createCGLayerWithSize:CGRect(bbox).size info:NULL];
     
     KRenderingDeviceContext *filterContext = new KRenderingDeviceContextQuartz(CGLayerGetContext(m_filterCGLayer));
@@ -130,7 +133,10 @@ void KCanvasFilterQuartz::applyFilter(const FloatRect &bbox)
     }
     
     CGLayerRelease(m_filterCGLayer);
-    [m_filterCIContext release];
+    m_filterCGLayer = 0;
+
+    KWQRelease(m_filterCIContext);
+    m_filterCIContext = 0;
 }
 
 NSArray *KCanvasFilterQuartz::getCIFilterStack(CIImage *inputImage)
@@ -153,7 +159,7 @@ NSArray *KCanvasFilterQuartz::getCIFilterStack(CIImage *inputImage)
 
 CIImage *KCanvasFilterQuartz::imageForName(const DeprecatedString& name) const
 {
-    return [m_imagesByName valueForKey:name.getNSString()];
+    return [m_imagesByName objectForKey:name.getNSString()];
 }
 
 void KCanvasFilterQuartz::setImageForName(CIImage *image, const DeprecatedString &name)
index e11176225ee9291570c072a675a86d806609a000..4a655a59c20cdae586f674cd0ae51177fb16b912 100644 (file)
 
 #include "config.h"
 #if SVG_SUPPORT
-#import "KCanvasPathQuartz.h"
 #import "KRenderingDeviceQuartz.h"
-#import "KCanvasMaskerQuartz.h"
-#import "KCanvasResourcesQuartz.h"
-#import "KCanvasFilterQuartz.h"
-#import "KRenderingPaintServerQuartz.h"
-#import "QuartzSupport.h"
 
-#import "kcanvas/KCanvas.h"
-#import "KCanvasMatrix.h"
+#import "FoundationExtras.h"
+#import "KCanvasFilterQuartz.h"
 #import "KCanvasItemQuartz.h"
+#import "KCanvasMaskerQuartz.h"
+#import "KCanvasMatrix.h"
+#import "KCanvasPathQuartz.h"
+#import "KCanvasResourcesQuartz.h"
 #import "KRenderingFillPainter.h"
+#import "KRenderingPaintServerQuartz.h"
 #import "KRenderingStrokePainter.h"
-
-#import <AppKit/NSGraphicsContext.h>
-
 #import "Logging.h"
+#import "QuartzSupport.h"
+#import "RenderCanvas.h"
+#import <Cocoa/Cocoa.h>
 
 namespace WebCore {
 
@@ -53,7 +52,7 @@ KRenderingDeviceContextQuartz::KRenderingDeviceContextQuartz(CGContextRef contex
 KRenderingDeviceContextQuartz::~KRenderingDeviceContextQuartz()
 {
     CGContextRelease(m_cgContext);
-    [m_nsGraphicsContext release];
+    KWQRelease(m_nsGraphicsContext);
 }
 
 KCanvasMatrix KRenderingDeviceContextQuartz::concatCTM(const KCanvasMatrix &worldMatrix)
@@ -94,7 +93,7 @@ void KRenderingDeviceContextQuartz::addPath(const KCanvasPath *path)
 NSGraphicsContext *KRenderingDeviceContextQuartz::nsGraphicsContext()
 {
     if (!m_nsGraphicsContext && m_cgContext)
-        m_nsGraphicsContext = [[NSGraphicsContext graphicsContextWithGraphicsPort:m_cgContext flipped:YES] retain];
+        m_nsGraphicsContext = KWQRetain([NSGraphicsContext graphicsContextWithGraphicsPort:m_cgContext flipped:YES]);
     return m_nsGraphicsContext;
 }
 
index 13b58b58022c14c762314a89c30c8ef44082fd41..8f2b9e0d9bf17164fac128229000af071cef6759 100644 (file)
  */
 
 #import "config.h"
-#import <kxmlcore/Vector.h>
+#import "Image.h"
+
 #import "DeprecatedArray.h"
-#import "IntSize.h"
 #import "FloatRect.h"
-#import "Image.h"
+#import "FoundationExtras.h"
+#import "IntSize.h"
 #import "PDFDocumentImage.h"
 #import "PlatformString.h"
-
 #import "WebCoreImageRendererFactory.h"
+#import <kxmlcore/Vector.h>
 
 namespace WebCore {
 
@@ -71,7 +72,7 @@ void Image::invalidateNativeData()
         return;
 
     if (m_nsImage) {
-        [m_nsImage release];
+        CFRelease(m_nsImage);
         m_nsImage = 0;
     }
 
@@ -194,7 +195,7 @@ NSImage* Image::getNSImage()
     if (!data)
         return 0;
     
-    m_nsImage = [[NSImage alloc] initWithData:(NSData*)data];
+    m_nsImage = KWQRetainNSRelease([[NSImage alloc] initWithData:(NSData*)data]);
     return m_nsImage;
 }