2006-09-27 Eric Seidel <eric@eseidel.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Sep 2006 19:29:34 +0000 (19:29 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Sep 2006 19:29:34 +0000 (19:29 +0000)
        Reviewed by darin.

        Change our invalid-fill error behavior to match Opera (and soon Firefox)
        http://bugzilla.opendarwin.org/show_bug.cgi?id=11017

        * ksvg2/misc/KCanvasRenderingStyle.cpp:
        (WebCore::KSVGPainterFactory::isFilled):
        (WebCore::KSVGPainterFactory::fillPaintServer):
        (WebCore::KSVGPainterFactory::isStroked):
        (WebCore::KSVGPainterFactory::strokePaintServer):

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/invalid-fill-expected.checksum
LayoutTests/svg/custom/invalid-fill-expected.png
LayoutTests/svg/custom/invalid-fill-expected.txt
LayoutTests/svg/custom/invalid-fill.svg
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/ksvg2/misc/KCanvasRenderingStyle.cpp

index 528536e6327286d0ec5f452b2786c705d95eeccc..61c1478c53eae23ea6c64bc39c8a082f699bea16 100644 (file)
@@ -1,3 +1,15 @@
+2006-09-27  Eric Seidel  <eric@eseidel.com>
+
+        Reviewed by darin.
+        
+        Updated test (and results) for new invalid fill behavior.
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=11017
+
+        * svg/custom/invalid-fill-expected.checksum:
+        * svg/custom/invalid-fill-expected.png:
+        * svg/custom/invalid-fill-expected.txt:
+        * svg/custom/invalid-fill.svg:
+
 2006-09-26  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by john
index a1c53b4f20b6b2d4c0fcb2c825079d5f42fd977a..1c3cb0e0d3132455ff59d7f9aa32f117f15faec9 100644 (file)
@@ -1 +1 @@
-75b9edcc5ab52f142a4d753fe5e036ed
\ No newline at end of file
+990395834523505015e0a73e1769f835
\ No newline at end of file
index 0b9f59c28e94d20029cd658f8b6309f0022d2ab4..4ca293f0c31a2ea70f00a91940e9363527268891 100644 (file)
Binary files a/LayoutTests/svg/custom/invalid-fill-expected.png and b/LayoutTests/svg/custom/invalid-fill-expected.png differ
index 971ced1ec6141c9ac8c8181808dd97f27109d06c..c4b6ef3a6f0c4684896380dff8599ef680eec2ce 100644 (file)
@@ -2,9 +2,12 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
     KCanvasContainer {svg} at (0,0) size 100x100
       KCanvasContainer {g} at (0,0) size 100x100
-        KCanvasItem {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
-        KCanvasItem {rect} at (0,0) size 100x100 [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+        KCanvasItem {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+        KCanvasItem {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
         KCanvasContainer {g} at (0,0) size 0x0
+          RenderSVGText {text} at (0,0) size 800x18
+            RenderText {#text} at (0,0) size 223x18
+              text run at (0,0) width 223: "The above rect should be BLACK."
           RenderSVGText {text} at (0,0) size 800x18
             RenderText {#text} at (0,0) size 667x18
               text run at (0,0) width 667: "SVG 1.1 FULL says there should be a \"highly perceivable error\" message when an invalid fill url is used."
@@ -12,6 +15,6 @@ layer at (0,0) size 800x600
             RenderText {#text} at (0,0) size 468x18
               text run at (0,0) width 468: "Browsers don't display such an error, instead use some sort of fill-fallback."
           RenderSVGText {text} at (0,0) size 800x18
-            RenderText {#text} at (0,0) size 636x18
-              text run at (0,0) width 561: "Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'none' (as of writing). "
-              text run at (561,0) width 75: "Bug 11017."
+            RenderText {#text} at (0,0) size 546x18
+              text run at (0,0) width 471: "Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'black'. "
+              text run at (471,0) width 75: "Bug 11017."
index e4ffd578d1bc4b93b3c583f27fc45832a4a473f3..07a7f0f4ba9ca2736e36e56881fbcca100f5ec10 100644 (file)
@@ -1,12 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <svg xmlns="http://www.w3.org/2000/svg">
-  <g fill="red">
-    <rect width="100" height="100" fill="green"/>
+  <g fill="orange">
+    <rect width="100" height="100" fill="red"/>
     <rect width="100" height="100" fill="url(#notthere)"/>
     <g fill="black">
-      <text x="10" y="130">SVG 1.1 FULL says there should be a "highly perceivable error" message when an invalid fill url is used.</text>
-      <text x="10" y="150">Browsers don't display such an error, instead use some sort of fill-fallback.</text>
-      <text x="10" y="170">Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'none' (as of writing).  Bug 11017.</text>
+      <text x="10" y="130">The above rect should be BLACK.</text>
+      <text x="10" y="150">SVG 1.1 FULL says there should be a "highly perceivable error" message when an invalid fill url is used.</text>
+      <text x="10" y="170">Browsers don't display such an error, instead use some sort of fill-fallback.</text>
+      <text x="10" y="190">Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'black'.  Bug 11017.</text>
     </g>
   </g>
 </svg>
index 119c3608e1333eecada86cdfb6f188b28f120170..5608bbcd337aaa1c122cda2eaa637757cf377821 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-27  Eric Seidel  <eric@eseidel.com>
+
+        Reviewed by darin.
+
+        Change our invalid-fill error behavior to match Opera (and soon Firefox)
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=11017
+
+        * ksvg2/misc/KCanvasRenderingStyle.cpp:
+        (WebCore::KSVGPainterFactory::isFilled):
+        (WebCore::KSVGPainterFactory::fillPaintServer):
+        (WebCore::KSVGPainterFactory::isStroked):
+        (WebCore::KSVGPainterFactory::strokePaintServer):
+
 2006-09-27  Brady Eidson  <beidson@apple.com>
 
         Build fix
index f6f4e6b30ea8e539a32919bd5ccd1926546825a9..2fca700c04c33bd52379ad02e334afed91b365bb 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index be52d49074e433c7e846c6fbda472120edbedf05..e6580279e6e080e607b3cfe3b5dc4631cefa06f4 100644 (file)
@@ -51,63 +51,63 @@ static KRenderingPaintServerSolid* sharedSolidPaintServer()
     return _sharedSolidPaintServer;
 }
 
-bool KSVGPainterFactory::isFilled(const RenderStyle *style)
+bool KSVGPainterFactory::isFilled(const RenderStylestyle)
 {
-    SVGPaint *fill = style->svgStyle()->fillPaint();
+    SVGPaintfill = style->svgStyle()->fillPaint();
     if (fill && fill->paintType() == SVGPaint::SVG_PAINTTYPE_NONE)
         return false;
     return true;
 }
 
-KRenderingPaintServer *KSVGPainterFactory::fillPaintServer(const RenderStyle* style, const RenderObject* item)
+KRenderingPaintServerKSVGPainterFactory::fillPaintServer(const RenderStyle* style, const RenderObject* item)
 {
     if (!isFilled(style))
         return 0;
 
-    SVGPaint *fill = style->svgStyle()->fillPaint();
+    SVGPaintfill = style->svgStyle()->fillPaint();
 
-    KRenderingPaintServer *fillPaintServer;
-    if (!fill) {
-        // initial value (black)
-        fillPaintServer = sharedSolidPaintServer();
-        static_cast<KRenderingPaintServerSolid *>(fillPaintServer)->setColor(Color::black);
-    } else if (fill->paintType() == SVGPaint::SVG_PAINTTYPE_URI) {
-        String id(fill->uri());
-        fillPaintServer = getPaintServerById(item->document(), AtomicString(id.substring(1)));
+    KRenderingPaintServer* fillPaintServer = 0;
+    if (fill && fill->paintType() == SVGPaint::SVG_PAINTTYPE_URI) {
+        fillPaintServer = getPaintServerById(item->document(), AtomicString(fill->uri().substring(1)));
         if (item && fillPaintServer && item->isRenderPath())
             fillPaintServer->addClient(static_cast<const RenderPath*>(item));
-    } else {
+    } else if (fill) {
         fillPaintServer = sharedSolidPaintServer();
-        KRenderingPaintServerSolid *fillPaintServerSolid = static_cast<KRenderingPaintServerSolid *>(fillPaintServer);
+        KRenderingPaintServerSolid* fillPaintServerSolid = static_cast<KRenderingPaintServerSolid*>(fillPaintServer);
         if (fill->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
             fillPaintServerSolid->setColor(style->color());
         else
             fillPaintServerSolid->setColor(fill->color());
     }
+    
+    if (!fillPaintServer) {
+        // default value (black), see bug 11017
+        fillPaintServer = sharedSolidPaintServer();
+        static_cast<KRenderingPaintServerSolid *>(fillPaintServer)->setColor(Color::black);
+    }
 
     return fillPaintServer;
 }
 
 
-bool KSVGPainterFactory::isStroked(const RenderStyle *style)
+bool KSVGPainterFactory::isStroked(const RenderStylestyle)
 {
-    SVGPaint *stroke = style->svgStyle()->strokePaint();
+    SVGPaintstroke = style->svgStyle()->strokePaint();
     if (!stroke || stroke->paintType() == SVGPaint::SVG_PAINTTYPE_NONE)
         return false;
     return true;
 }
 
-KRenderingPaintServer *KSVGPainterFactory::strokePaintServer(const RenderStyle* style, const RenderObject* item)
+KRenderingPaintServerKSVGPainterFactory::strokePaintServer(const RenderStyle* style, const RenderObject* item)
 {
     if (!isStroked(style))
         return 0;
 
-    SVGPaint *stroke = style->svgStyle()->strokePaint();
+    SVGPaintstroke = style->svgStyle()->strokePaint();
 
-    KRenderingPaintServer *strokePaintServer;
+    KRenderingPaintServer* strokePaintServer = 0;
     if (stroke && stroke->paintType() == SVGPaint::SVG_PAINTTYPE_URI) {
-        String id(stroke->uri());
-        strokePaintServer = getPaintServerById(item->document(), AtomicString(id.substring(1)));
+        strokePaintServer = getPaintServerById(item->document(), AtomicString(stroke->uri().substring(1)));
         if(item && strokePaintServer && item->isRenderPath())
             strokePaintServer->addClient(static_cast<const RenderPath*>(item));
     } else {