mustang2247 / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

SVG ClipPaths not correctly registered by GUID on Flash side after being processed #432

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Porting JessyInk (Issue 391) has shown the following issue. In JessyInk SVG
ClipPaths are used, such as:

<clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipoutline1">
      <path
         d="M 54.1,12.5 L 12.9,54.7 C -2.7,70.3 23,69 32.3,74.9 C 36.6,77.7
18.5,81.3 22.2,85 C 25.8,88.7 43.9,92.1 47.5,95.7 C 51.1,99.4 40.2,103.3
43.8,107 C 47.3,110.7 55.7,107.2 57.2,115.6 C 58.3,121.8 72.6,118.7
79,113.4 C 83,110 72.1,110 75.7,106.3 C 84.7,97.2 92.7,102.2 96,93.8 C
97.8,89.3 82.4,86.1 86.5,83.2 C 96.3,76.3 132.3,72.8 115.7,56.2 L 73,12.5 C
67.7,7.5 59,7.5 54.1,12.5 z M 44.2,77.2 C 45.1,77.2 75,81.2 63.5,84.3 C
59.1,85.5 38.9,77.2 44.2,77.2 z M 101.4,93.8 C 101.4,95.9 117.7,97.1
116.8,93.3 C 115.5,86.9 103.2,87.4 101.4,93.8 z M 31.9,104.9 C 35.6,108.1
41.2,104.2 43,99.7 C 39.4,95 26.1,100 31.9,104.9 z M 99.4,98.2 C 94.8,102.4
100.2,106.8 104.7,103.9 C 105.9,103.1 104.6,99.2 99.4,98.2 z"
         id="outline1" />
    </clipPath>

After the page has loaded, when we try to get an attribute on this node, we
internally get an error that the clipPath node can't be fetched by GUID.

Investigating, it looks like the issue is that clipPaths are removed from
the page, cloned, and then changed to address issue 345. However, the new
cloned node is not then re-registered by GUID so it is not available later.
The problem area is in SVGNode on line 1158:

if (node) {
                       this.removeMask();

                       var newMask:SVGNode = node.clone();
                       newMask.isMask = true;

                       addSVGChildMask(newMask);
                       clipSprite.mask = newMask.topSprite;

                       newMask.topSprite.visible = true;
                       clipSprite.cacheAsBitmap = true;
                       // We need to cacheAsBitmap for group and path nodes
                       // to fix a strange problem with a path on line 336
                       // of samples/svg-files/juanmontoya_lingerie.svg
                       // Without cacheAsBitmap, this path is not clipped
by the
                       // group node mask on line 329.
                       // Issue 345: cacheAsBitmap should only be used when
                       // necessary due to its large memory consumption.
                       if (this is SVGPathNode || this is SVGGroupNode) {
                           newMask.topSprite.cacheAsBitmap = true;
                       }
                   }

Original issue reported on code.google.com by bradneub...@gmail.com on 30 Nov 2009 at 10:12

GoogleCodeExporter commented 8 years ago
This is a regression probably caused by issue 345.

Original comment by bradneub...@gmail.com on 30 Nov 2009 at 10:41

GoogleCodeExporter commented 8 years ago

Original comment by bradneub...@gmail.com on 30 Nov 2009 at 11:04

GoogleCodeExporter commented 8 years ago
I have put this clip path in a simple svg file and retrieved it after loading:

document.getElementById('svgobj').contentDocument.getElementById('clipoutline1')

[_SVGClipPath] nodeName=clipPath _nodeXML=clippath _handler=Object

Maybe I am not understanding what the problem is. Could you provide a more 
specific
test case?

Could you explain why you think this is a regression caused by Issue 345? I 
don't see
the connection.

Original comment by grick23@gmail.com on 1 Dec 2009 at 2:31

GoogleCodeExporter commented 8 years ago
I should know better; I'll make a reduced test case :)

Original comment by bradneub...@gmail.com on 1 Dec 2009 at 3:11

GoogleCodeExporter commented 8 years ago
Very strange; I'm trying to make a reduced test case but I can't seem to 
replicate
the issue any more. There is possibly a timing bug going on. Until I see it 
again I
am going to mark this issue INVALID.

Original comment by bradneub...@gmail.com on 1 Dec 2009 at 5:46