<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>91515</bug_id>
          
          <creation_ts>2012-07-17 10:10:34 -0700</creation_ts>
          <short_desc>SVGUseElement does not allow foreignObject as ancestor of SVGSVGElement</short_desc>
          <delta_ts>2026-05-11 02:34:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>43911</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dirk Schulze">krit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>hesamse</cc>
    
    <cc>karlcow</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>671349</commentid>
    <comment_count>0</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2012-07-17 10:10:34 -0700</bug_when>
    <thetext>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:

&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;
&lt;defs&gt;
  &lt;svg id=&quot;svg&quot;&gt;
    &lt;foreignObject&gt;
      &lt;p xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;Test&lt;/p&gt;
    &lt;/foreignObject&gt;
  &lt;/svg&gt;
&lt;/defs&gt;
&lt;use xlink:href=&quot;#svg&quot;/&gt;
&lt;/svg&gt; 

It doesn&apos;t matter if the SVG element is in a defs section or not. In both cases the foreignObject and it&apos;s content get ignored. Other ancestors get drawn.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>672032</commentid>
    <comment_count>1</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-07-17 23:40:38 -0700</bug_when>
    <thetext>True. We disallow it on purpose because of potential problems involved with fO. It needs to be well-tested, that&apos;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 &lt;symbol id=&quot;symbol&quot;&gt;&lt;fO&gt; &lt;iframe src=&quot;other.html&quot;/&gt;&lt;/fO&gt;&lt;/symbol&gt;
blub.svg references the &quot;symbol&quot;. other.html includes foo.svg as html:img. ... -&gt; cycle

Or consider the case when the &lt;fO&gt; contains &lt;div style=&quot;background-image: blub.svg&quot;...

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&apos;d leave this non-implemented.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1692327</commentid>
    <comment_count>2</comment_count>
    <who name="hesamse">hesamse</who>
    <bug_when>2020-09-27 01:10:53 -0700</bug_when>
    <thetext>Any updates?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1692581</commentid>
    <comment_count>3</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2020-09-28 10:03:39 -0700</bug_when>
    <thetext>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 &lt;p&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2209666</commentid>
    <comment_count>4</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-05-11 02:33:29 -0700</bug_when>
    <thetext>This is a duplicate of Bug 43911
&lt;foreignObject&gt; descendants are stripped from &lt;use&gt; shadow trees</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2209667</commentid>
    <comment_count>5</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-05-11 02:34:05 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 43911 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>