Bug 91515
Summary: | SVGUseElement does not allow foreignObject as ancestor of SVGSVGElement | ||
---|---|---|---|
Product: | WebKit | Reporter: | Dirk Schulze <krit> |
Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | hesamse, sabouhallawa, zimmermann |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Dirk Schulze
If a use element references an SVGSVGElement or document, it is not allowed to have a foreignObject as decedent. This is not disallowed according to SVG spac http://www.w3.org/TR/SVG/struct.html#UseElement:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<svg id="svg">
<foreignObject>
<p xmlns="http://www.w3.org/1999/xhtml">Test</p>
</foreignObject>
</svg>
</defs>
<use xlink:href="#svg"/>
</svg>
It doesn't matter if the SVG element is in a defs section or not. In both cases the foreignObject and it's content get ignored. Other ancestors get drawn.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Nikolas Zimmermann
True. We disallow it on purpose because of potential problems involved with fO. It needs to be well-tested, that's all.
There are new types of cycles references that we need to take care about, when enabling that, and this is where it gets hairy.
foo.svg, contains <symbol id="symbol"><fO> <iframe src="other.html"/></fO></symbol>
blub.svg references the "symbol". other.html includes foo.svg as html:img. ... -> cycle
Or consider the case when the <fO> contains <div style="background-image: blub.svg"...
We basically need to extend cycle detection to all HTML elements/attributes that can reference other files.
If you feel challenged feel free to start on this, otherwise I'd leave this non-implemented.
hesamse
Any updates?
Said Abou-Hallawa
The above test case works in FireFox but it doe not work in WebKit or Chrome.
The foreignObject and its descendants are removed by removeDisallowedElementsFromSubtree() because foreignObjectTag is not one of the allowed tags createAllowedElementSet. But even adding it will not solve the problem because the HTML <p> element will be removed because its tag is not allowed.
To fix this we need to reimplement removeDisallowedElementsFromSubtree() and, as Nikolas mentioned above, we need to extend the cycle detection to all HTML elements in case any of them reference other files.