<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[28991] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/28991">28991</a></dd>
<dt>Author</dt> <dd>rwlbuis@webkit.org</dd>
<dt>Date</dt> <dd>2007-12-26 00:40:55 -0800 (Wed, 26 Dec 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Eric.

        http://bugs.webkit.org/show_bug.cgi?id=15514
        &lt;clipPath&gt; with &lt;use&gt; not respected
        http://bugs.webkit.org/show_bug.cgi?id=16557
        SVG circle elements have been clipped away completely, instead of partially.

        Add toClipPath to get clip path data for the clipping paths. Implement it for &lt;use&gt;, thereby allowing clip paths using use.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoresvgSVGClipPathElementcpp">trunk/WebCore/svg/SVGClipPathElement.cpp</a></li>
<li><a href="#trunkWebCoresvgSVGStyledTransformableElementh">trunk/WebCore/svg/SVGStyledTransformableElement.h</a></li>
<li><a href="#trunkWebCoresvgSVGUseElementcpp">trunk/WebCore/svg/SVGUseElement.cpp</a></li>
<li><a href="#trunkWebCoresvgSVGUseElementh">trunk/WebCore/svg/SVGUseElement.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguseexpectedchecksum">trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.checksum</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguseexpectedpng">trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.png</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguseexpectedtxt">trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencingusesvg">trunk/LayoutTests/svg/custom/clip-path-referencing-use.svg</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguse2expectedchecksum">trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.checksum</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguse2expectedpng">trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.png</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguse2expectedtxt">trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgcustomclippathreferencinguse2svg">trunk/LayoutTests/svg/custom/clip-path-referencing-use2.svg</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (28990 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-12-26 07:25:09 UTC (rev 28990)
+++ trunk/LayoutTests/ChangeLog        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2007-12-25  Rob Buis  &lt;buis@kde.org&gt;
+
+        Reviewed by Eric.
+
+        Testcases for:
+        http://bugs.webkit.org/show_bug.cgi?id=15514
+        &lt;clipPath&gt; with &lt;use&gt; not respected
+        http://bugs.webkit.org/show_bug.cgi?id=16557
+        SVG circle elements have been clipped away completely, instead of partially.
+
+        * svg/custom/clip-path-referencing-use-expected.checksum: Added.
+        * svg/custom/clip-path-referencing-use-expected.png: Added.
+        * svg/custom/clip-path-referencing-use-expected.txt: Added.
+        * svg/custom/clip-path-referencing-use.svg: Added.
+        * svg/custom/clip-path-referencing-use2-expected.checksum: Added.
+        * svg/custom/clip-path-referencing-use2-expected.png: Added.
+        * svg/custom/clip-path-referencing-use2-expected.txt: Added.
+        * svg/custom/clip-path-referencing-use2.svg: Added.
+
</ins><span class="cx"> 2007-12-25  David Smith  &lt;catfish.man@gmail.com&gt; and Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver.
</span></span></pre></div>
<a id="trunkLayoutTestssvgcustomclippathreferencinguseexpectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.checksum (0 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.checksum                                (rev 0)
+++ trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.checksum        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ac0cbe8c013197ab31e32dae7bd897ce
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestssvgcustomclippathreferencinguseexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + application/octet-stream
</span><a id="trunkLayoutTestssvgcustomclippathreferencinguseexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.txt (0 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.txt                                (rev 0)
+++ trunk/LayoutTests/svg/custom/clip-path-referencing-use-expected.txt        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+KCanvasResource {id=&quot;clip&quot; [type=CLIPPER] [clip data=[[winding=NON-ZERO] [path=M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00]]]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 602x200
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data=&quot;M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00&quot;]
+    RenderSVGContainer {g} at (0,0) size 200x200 [clip path=&quot;#clip&quot;]
+      RenderPath {rect} at (0,0) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data=&quot;M0.00,0.00L200.00,0.00L200.00,200.00L0.00,200.00&quot;]
+      RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data=&quot;M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00&quot;]
+    RenderSVGText {text} at (10,120) size 489x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 489x18
+        chunk 1 text run 1 at (10.00,120.00) startOffset 0 endOffset 76 width 489.00: &quot;The graphic above uses a 100x100 clipPath referencing a rectangle using use.&quot;
+    RenderSVGText {text} at (10,140) size 592x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 592x18
+        chunk 1 text run 1 at (10.00,140.00) startOffset 0 endOffset 92 width 592.00: &quot;It should clip the 200x200 red rectangle out and leave a 100x100 green rectangle. Bug 16557.&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustomclippathreferencingusesvg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use.svg (0 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/clip-path-referencing-use.svg                                (rev 0)
+++ trunk/LayoutTests/svg/custom/clip-path-referencing-use.svg        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&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;rect id=&quot;rect&quot; width=&quot;100&quot; height=&quot;100&quot; /&gt;
+    &lt;clipPath id=&quot;clip&quot;&gt;
+      &lt;use xlink:href=&quot;#rect&quot; /&gt;
+    &lt;/clipPath&gt;
+  &lt;/defs&gt;
+
+  &lt;g clip-path=&quot;url(#clip)&quot;&gt;
+    &lt;rect width=&quot;200&quot; height=&quot;200&quot; fill=&quot;red&quot; /&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;green&quot; /&gt;
+  &lt;/g&gt;
+
+  &lt;text x=&quot;10&quot; y=&quot;120&quot;&gt;The graphic above uses a 100x100 clipPath referencing a rectangle using use.&lt;/text&gt;
+   &lt;text x=&quot;10&quot; y=&quot;140&quot;&gt;It should clip the 200x200 red rectangle out and leave a 100x100 green rectangle. Bug 16557. &lt;/text&gt;
+&lt;/svg&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustomclippathreferencinguse2expectedchecksum"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.checksum (0 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.checksum                                (rev 0)
+++ trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.checksum        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+029d25db037c3b869bab36b95c245ec1
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestssvgcustomclippathreferencinguse2expectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx">   + application/octet-stream
</span><a id="trunkLayoutTestssvgcustomclippathreferencinguse2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.txt (0 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/svg/custom/clip-path-referencing-use2-expected.txt        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+CONSOLE MESSAGE: line 1: Error: Not allowed to use indirect reference in &lt;clip-path&gt;
+CONSOLE MESSAGE: line 1: Error: Not allowed to use indirect reference in &lt;clip-path&gt;
+KCanvasResource {id=&quot;clip&quot; [type=CLIPPER] [clip data=[[winding=EVEN-ODD] [path=M0.00,0.00L0.00,0.00L0.00,0.00L0.00,0.00]]]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 598x144
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderPath {rect} at (0,0) size 50x50 [fill={[type=SOLID] [color=#000000]}] [data=&quot;M0.00,0.00L50.00,0.00L50.00,50.00L0.00,50.00&quot;]
+      RenderSVGContainer {use} at (0,0) size 50x50
+        RenderSVGContainer {g} at (0,0) size 50x50
+          RenderPath {rect} at (0,0) size 50x50 [fill={[type=SOLID] [color=#000000]}] [data=&quot;M0.00,0.00L50.00,0.00L50.00,50.00L0.00,50.00&quot;]
+    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data=&quot;M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00&quot;]
+    RenderSVGContainer {g} at (0,0) size 100x100 [clip path=&quot;#clip&quot;]
+      RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data=&quot;M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00&quot;]
+    RenderSVGText {text} at (10,120) size 377x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 377x18
+        chunk 1 text run 1 at (10.00,120.00) startOffset 0 endOffset 56 width 377.00: &quot;The graphic above should show a 100x100 green rectangle.&quot;
+    RenderSVGText {text} at (10,140) size 588x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,-14) size 588x18
+        chunk 1 text run 1 at (10.00,140.00) startOffset 0 endOffset 96 width 588.00: &quot;The red rectangle should not show since it uses a clipping path that uses an indirect reference.&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustomclippathreferencinguse2svg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/clip-path-referencing-use2.svg (0 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/clip-path-referencing-use2.svg                                (rev 0)
+++ trunk/LayoutTests/svg/custom/clip-path-referencing-use2.svg        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&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;rect width=&quot;50&quot; height=&quot;50&quot; id=&quot;rect&quot;/&gt;
+    &lt;use id=&quot;use&quot; xlink:href=&quot;#rect&quot;/&gt;
+    &lt;clipPath id=&quot;clip&quot;&gt;
+      &lt;use xlink:href=&quot;#use&quot; /&gt;
+    &lt;/clipPath&gt;
+  &lt;/defs&gt;
+
+  &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;green&quot; /&gt;
+  &lt;g clip-path=&quot;url(#clip)&quot;&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot; /&gt;
+  &lt;/g&gt;
+
+  &lt;text x=&quot;10&quot; y=&quot;120&quot;&gt;The graphic above should show a 100x100 green rectangle.&lt;/text&gt;
+   &lt;text x=&quot;10&quot; y=&quot;140&quot;&gt;The red rectangle should not show since it uses a clipping path that uses an indirect reference.&lt;/text&gt;
+&lt;/svg&gt;
+
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (28990 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-12-26 07:25:09 UTC (rev 28990)
+++ trunk/WebCore/ChangeLog        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2007-12-25  Rob Buis  &lt;buis@kde.org&gt;
+
+        Reviewed by Eric.
+
+        http://bugs.webkit.org/show_bug.cgi?id=15514
+        &lt;clipPath&gt; with &lt;use&gt; not respected
+        http://bugs.webkit.org/show_bug.cgi?id=16557
+        SVG circle elements have been clipped away completely, instead of partially.
+
+        Add toClipPath to get clip path data for the clipping paths. Implement it for &lt;use&gt;, thereby allowing clip paths using use.
+
+        * svg/SVGClipPathElement.cpp:
+        (WebCore::SVGClipPathElement::canvasResource):
+        * svg/SVGStyledTransformableElement.h:
+        (WebCore::SVGStyledTransformableElement::toClipPath):
+        * svg/SVGUseElement.cpp:
+        (WebCore::isDirectReference):
+        (WebCore::SVGUseElement::toClipPath):
+        * svg/SVGUseElement.h:
+
</ins><span class="cx"> 2007-12-25  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Eric Seidel.
</span></span></pre></div>
<a id="trunkWebCoresvgSVGClipPathElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/svg/SVGClipPathElement.cpp (28990 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/svg/SVGClipPathElement.cpp        2007-12-26 07:25:09 UTC (rev 28990)
+++ trunk/WebCore/svg/SVGClipPathElement.cpp        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">         if (n-&gt;isSVGElement() &amp;&amp; static_cast&lt;SVGElement*&gt;(n)-&gt;isStyledTransformable()) {
</span><span class="cx">             SVGStyledTransformableElement* styled = static_cast&lt;SVGStyledTransformableElement*&gt;(n);
</span><span class="cx">             RenderStyle* pathStyle = document()-&gt;styleSelector()-&gt;styleForElement(styled, clipPathStyle);
</span><del>-            Path pathData = styled-&gt;toPathData();
</del><ins>+            Path pathData = styled-&gt;toClipPath();
</ins><span class="cx">             // FIXME: How do we know the element has done a layout?
</span><span class="cx">             pathData.transform(styled-&gt;animatedLocalTransform());
</span><span class="cx">             if (!pathData.isEmpty())
</span></span></pre></div>
<a id="trunkWebCoresvgSVGStyledTransformableElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/svg/SVGStyledTransformableElement.h (28990 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/svg/SVGStyledTransformableElement.h        2007-12-26 07:25:09 UTC (rev 28990)
+++ trunk/WebCore/svg/SVGStyledTransformableElement.h        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">     Copyright (C) 2004, 2005 Nikolas Zimmermann &lt;wildfox@kde.org&gt;
</span><del>-                  2004, 2005, 2006 Rob Buis &lt;buis@kde.org&gt;
</del><ins>+                  2004, 2005, 2006, 2007 Rob Buis &lt;buis@kde.org&gt;
</ins><span class="cx"> 
</span><span class="cx">     This file is part of the KDE project
</span><span class="cx"> 
</span><span class="lines">@@ -53,11 +53,12 @@
</span><span class="cx">         virtual FloatRect getBBox() const;
</span><span class="cx"> 
</span><span class="cx">         virtual void parseMappedAttribute(MappedAttribute*);
</span><del>-        
</del><ins>+
</ins><span class="cx">         // &quot;base class&quot; methods for all the elements which render as paths
</span><span class="cx">         virtual Path toPathData() const { return Path(); }
</span><ins>+        virtual Path toClipPath() const { return toPathData(); }
</ins><span class="cx">         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
</span><del>-        
</del><ins>+
</ins><span class="cx">         virtual void notifyAttributeChange() const;
</span><span class="cx"> 
</span><span class="cx">     protected:
</span></span></pre></div>
<a id="trunkWebCoresvgSVGUseElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/svg/SVGUseElement.cpp (28990 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/svg/SVGUseElement.cpp        2007-12-26 07:25:09 UTC (rev 28990)
+++ trunk/WebCore/svg/SVGUseElement.cpp        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -377,6 +377,34 @@
</span><span class="cx">         m_shadowTreeRootElement-&gt;detach();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool isDirectReference(Node* n)
+{
+    return n-&gt;hasTagName(SVGNames::pathTag) ||
+           n-&gt;hasTagName(SVGNames::rectTag) ||
+           n-&gt;hasTagName(SVGNames::circleTag) ||
+           n-&gt;hasTagName(SVGNames::ellipseTag) ||
+           n-&gt;hasTagName(SVGNames::polygonTag) ||
+           n-&gt;hasTagName(SVGNames::polylineTag) ||
+           n-&gt;hasTagName(SVGNames::textTag);
+}
+
+Path SVGUseElement::toClipPath() const
+{
+    if (!m_shadowTreeRootElement)
+        const_cast&lt;SVGUseElement*&gt;(this)-&gt;buildPendingResource();
+
+    Node* n = m_shadowTreeRootElement-&gt;firstChild();
+    if (n-&gt;isSVGElement() &amp;&amp; static_cast&lt;SVGElement*&gt;(n)-&gt;isStyledTransformable()) {
+        if (!isDirectReference(n))
+            // Spec: Indirect references are an error (14.3.5)
+            document()-&gt;accessSVGExtensions()-&gt;reportError(&quot;Not allowed to use indirect reference in &lt;clip-path&gt;&quot;);
+        else
+            return static_cast&lt;SVGStyledTransformableElement*&gt;(n)-&gt;toClipPath();
+    }
+
+    return Path();
+}
+
</ins><span class="cx"> void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool&amp; foundProblem)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(target);
</span></span></pre></div>
<a id="trunkWebCoresvgSVGUseElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/svg/SVGUseElement.h (28990 => 28991)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/svg/SVGUseElement.h        2007-12-26 07:25:09 UTC (rev 28990)
+++ trunk/WebCore/svg/SVGUseElement.h        2007-12-26 08:40:55 UTC (rev 28991)
</span><span class="lines">@@ -67,6 +67,8 @@
</span><span class="cx">         virtual void attach();
</span><span class="cx">         virtual void detach();
</span><span class="cx"> 
</span><ins>+        virtual Path toClipPath() const;
+
</ins><span class="cx">     protected:
</span><span class="cx">         virtual const SVGElement* contextElement() const { return this; }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>