Title: [110692] trunk
Revision
110692
Author
[email protected]
Date
2012-03-14 05:00:44 -0700 (Wed, 14 Mar 2012)

Log Message

2012-03-14  Nikolas Zimmermann  <[email protected]>

        External <use> xlink:href references do not work
        https://bugs.webkit.org/show_bug.cgi?id=12499

        Reviewed by Zoltan Herczeg.

        Rebaseline tests after r110676 using Generic RGB Profile on Lion, and update them after my fixes.
        Replace xml:id with id everywhere, to make the new tiny tests work.

        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.png:
        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt:
        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.png:
        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt:
        * platform/mac/svg/batik/filters/feTile-expected.png:
        * platform/mac/svg/batik/filters/filterRegions-expected.png:
        * platform/mac/svg/batik/text/textEffect-expected.png:
        * platform/mac/svg/batik/text/textEffect3-expected.png:
        * platform/mac/svg/dynamic-updates/SVGUseElement-svgdom-href1-prop-expected.png:
        * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t.svg:
        * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t.svg:
        * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t.svg:
        * svg/custom/use-external-crash-expected.txt: Added.
        * svg/custom/use-external-crash.svg: Added.

2012-03-14  Nikolas Zimmermann  <[email protected]>

        External <use> xlink:href references do not work
        https://bugs.webkit.org/show_bug.cgi?id=12499

        Reviewed by Zoltan Herczeg.

        Follow-up fix after r110676.
        Assertions are firing due last minute changes in isExternalURIReference.

        Fix detecting local resources properly, when the given iri contains a /complex/path.
        Use document->completeURL() instead, and compare with the document->url() to decide
        if its a local reference or not.

        If an external document load fails with an error (eg. file missing) don't assert
        in debug builds, instead handle it gracefully.

        I decided to clean the code up as well, to make it more safe & obvious.

        Test: svg/custom/use-external-crash.svg

        * svg/SVGURIReference.cpp:
        (WebCore::SVGURIReference::targetElementFromIRIString):
        * svg/SVGURIReference.h:
        (WebCore::SVGURIReference::isExternalURIReference):
        * svg/SVGUseElement.cpp:
        (WebCore::SVGUseElement::externalDocument):
        (WebCore::SVGUseElement::buildPendingResource):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (110691 => 110692)


--- trunk/LayoutTests/ChangeLog	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/LayoutTests/ChangeLog	2012-03-14 12:00:44 UTC (rev 110692)
@@ -1,3 +1,28 @@
+2012-03-14  Nikolas Zimmermann  <[email protected]>
+
+        External <use> xlink:href references do not work
+        https://bugs.webkit.org/show_bug.cgi?id=12499
+
+        Reviewed by Zoltan Herczeg.
+
+        Rebaseline tests after r110676 using Generic RGB Profile on Lion, and update them after my fixes.
+        Replace xml:id with id everywhere, to make the new tiny tests work.
+
+        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.png:
+        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.png:
+        * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt:
+        * platform/mac/svg/batik/filters/feTile-expected.png:
+        * platform/mac/svg/batik/filters/filterRegions-expected.png:
+        * platform/mac/svg/batik/text/textEffect-expected.png:
+        * platform/mac/svg/batik/text/textEffect3-expected.png:
+        * platform/mac/svg/dynamic-updates/SVGUseElement-svgdom-href1-prop-expected.png:
+        * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t.svg:
+        * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t.svg:
+        * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t.svg:
+        * svg/custom/use-external-crash-expected.txt: Added.
+        * svg/custom/use-external-crash.svg: Added.
+
 2012-03-14  Ádám Kallai  <[email protected]>
 
         [Qt] Rebaseline after r110667.

Modified: trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt (110691 => 110692)


--- trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt	2012-03-14 12:00:44 UTC (rev 110692)
@@ -3,10 +3,13 @@
 layer at (0,0) size 800x600
   RenderSVGRoot {svg} at (0,0) size 800x600
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
-    RenderSVGContainer {g} at (150,25) size 484x452
-      RenderSVGContainer {g} at (150,25) size 34x34
+    RenderSVGContainer {g} at (150,25) size 502x452
+      RenderSVGContainer {g} at (150,25) size 502x77
         RenderSVGPath {circle} at (150,25) size 34x34 [fill={[type=SOLID] [color=#FF7F00]}] [cx=100.00] [cy=25.00] [r=10.00]
-        RenderSVGContainer {use} at (0,0) size 0x0 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,25.00)}]
+        RenderSVGContainer {use} at (614,64) size 38x38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,25.00)}]
+          RenderSVGContainer {g} at (614,64) size 38x38
+            RenderSVGContainer {g} at (0,0) size 0x0 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,25.00)}]
+            RenderSVGPath {circle} at (614,64) size 38x38 [stroke={[type=SOLID] [color=#808080] [stroke width=2.00] [line cap=ROUND] [dash array={4.00}]}] [fill={[type=SOLID] [color=#FFFF00]}] [cx=380.00] [cy=25.00] [r=10.00]
       RenderSVGText {text} at (100,257) size 280x28 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 280x28
           chunk 1 (middle anchor) text run 1 at (100.20,280.00) startOffset 0 endOffset 28 width 279.60: "This text should be visible."

Modified: trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt (110691 => 110692)


--- trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt	2012-03-14 12:00:44 UTC (rev 110692)
@@ -3,9 +3,12 @@
 layer at (0,0) size 800x600
   RenderSVGRoot {svg} at (0,0) size 800x600
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
-    RenderSVGContainer {g} at (166,25) size 484x452
-      RenderSVGContainer {g} at (616,25) size 34x34
-        RenderSVGContainer {use} at (0,0) size 0x0 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,25.00)}]
+    RenderSVGContainer {g} at (148,25) size 502x452
+      RenderSVGContainer {g} at (148,25) size 502x77
+        RenderSVGContainer {use} at (148,64) size 37x38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,25.00)}]
+          RenderSVGContainer {g} at (148,64) size 37x38
+            RenderSVGPath {circle} at (148,64) size 37x38 [stroke={[type=SOLID] [color=#808080] [stroke width=2.00] [line cap=ROUND] [dash array={4.00}]}] [fill={[type=SOLID] [color=#FF7F00]}] [cx=100.00] [cy=25.00] [r=10.00]
+            RenderSVGContainer {g} at (0,0) size 0x0 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,25.00)}]
         RenderSVGPath {circle} at (616,25) size 34x34 [fill={[type=SOLID] [color=#FFFF00]}] [cx=380.00] [cy=25.00] [r=10.00]
       RenderSVGText {text} at (100,257) size 280x28 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 280x28

Modified: trunk/LayoutTests/platform/mac/svg/batik/filters/feTile-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/batik/filters/filterRegions-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/batik/text/textEffect-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/batik/text/textEffect3-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/dynamic-updates/SVGUseElement-svgdom-href1-prop-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t.svg (110691 => 110692)


--- trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t.svg	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t.svg	2012-03-14 12:00:44 UTC (rev 110692)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg version="1.2" baseProfile="tiny" xml:id="svg-root" width="100%" height="100%"
+<svg version="1.2" baseProfile="tiny" id="svg-root" width="100%" height="100%"
   viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xe="http://www.w3.org/2001/xml-events">
   <!--======================================================================-->
@@ -21,7 +21,7 @@
       </p>
     </d:OperatorScript>
   </SVGTestCase>
-  <title xml:id="test-title">$RCSfile: struct-use-recursion-01-t.svg,v $</title>
+  <title id="test-title">$RCSfile: struct-use-recursion-01-t.svg,v $</title>
   <defs>
     <font-face
       font-family="SVGFreeSansASCII"
@@ -31,24 +31,24 @@
       </font-face-src>
     </font-face>
   </defs>
-  <g xml:id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
 
-    <g xml:id="group-1">
-      <circle xml:id="circle-1" cx='100' cy='25' r='10' fill='#FF7F00' />
-      <use xml:id="use-1" x="0" y="25" xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
+    <g id="group-1">
+      <circle id="circle-1" cx='100' cy='25' r='10' fill='#FF7F00' />
+      <use id="use-1" x="0" y="25" xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
     </g>
-    <g xml:id="group-2">
-      <circle xml:id="circle-2" cx='380' cy='25' r='10' fill='#FFFF00' />
-      <use xml:id="use-2" x="0" y="25"  xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
+    <g id="group-2">
+      <circle id="circle-2" cx='380' cy='25' r='10' fill='#FFFF00' />
+      <use id="use-2" x="0" y="25"  xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
     </g>
 
-    <text xml:id="pass" x="240" y="280" text-anchor="middle" fill="green" font-size="24">This text should be visible.</text>
+    <text id="pass" x="240" y="280" text-anchor="middle" fill="green" font-size="24">This text should be visible.</text>
 
   </g>
   <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
-    <text xml:id="revision" x="10" y="340" stroke="none"
+    <text id="revision" x="10" y="340" stroke="none"
       fill="black">$Revision: 1.5 $</text>
   </g>
-  <rect xml:id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
 
 </svg>

Modified: trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t.svg (110691 => 110692)


--- trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t.svg	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t.svg	2012-03-14 12:00:44 UTC (rev 110692)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg version="1.2" baseProfile="tiny" xml:id="svg-root" width="100%" height="100%"
+<svg version="1.2" baseProfile="tiny" id="svg-root" width="100%" height="100%"
   viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xe="http://www.w3.org/2001/xml-events">
   <!--======================================================================-->
@@ -24,7 +24,7 @@
       </p>
     </d:OperatorScript>
   </SVGTestCase>
-  <title xml:id="test-title">$RCSfile: struct-use-recursion-02-t.svg,v $</title>
+  <title id="test-title">$RCSfile: struct-use-recursion-02-t.svg,v $</title>
   <defs>
     <font-face
       font-family="SVGFreeSansASCII"
@@ -34,20 +34,20 @@
       </font-face-src>
     </font-face>
   </defs>
-  <g xml:id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
 
-    <g xml:id="group-1">
-      <circle xml:id="circle-1" cx='100' cy='25' r='10' fill='#FF7F00' />
-      <use xml:id="use-1" x="0" y="25" xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
+    <g id="group-1">
+      <circle id="circle-1" cx='100' cy='25' r='10' fill='#FF7F00' />
+      <use id="use-1" x="0" y="25" xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
     </g>
 
-    <text xml:id="pass" x="240" y="280" text-anchor="middle" fill="green" font-size="24">This text should be visible.</text>
+    <text id="pass" x="240" y="280" text-anchor="middle" fill="green" font-size="24">This text should be visible.</text>
 
   </g>
   <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
-    <text xml:id="revision" x="10" y="340" stroke="none"
+    <text id="revision" x="10" y="340" stroke="none"
       fill="black">$Revision: 1.5 $</text>
   </g>
-  <rect xml:id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
 
 </svg>

Modified: trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t.svg (110691 => 110692)


--- trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t.svg	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/LayoutTests/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t.svg	2012-03-14 12:00:44 UTC (rev 110692)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg version="1.2" baseProfile="tiny" xml:id="svg-root" width="100%" height="100%"
+<svg version="1.2" baseProfile="tiny" id="svg-root" width="100%" height="100%"
   viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xe="http://www.w3.org/2001/xml-events">
   <!--======================================================================-->
@@ -24,7 +24,7 @@
       </p>
     </d:OperatorScript>
   </SVGTestCase>
-  <title xml:id="test-title">$RCSfile: struct-use-recursion-03-t.svg,v $</title>
+  <title id="test-title">$RCSfile: struct-use-recursion-03-t.svg,v $</title>
   <defs>
     <font-face
       font-family="SVGFreeSansASCII"
@@ -34,20 +34,20 @@
       </font-face-src>
     </font-face>
   </defs>
-  <g xml:id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
 
-    <g xml:id="group-2">
-      <use xml:id="use-2" x="0" y="25"  xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
-      <circle xml:id="circle-2" cx='380' cy='25' r='10' fill='#FFFF00' />
+    <g id="group-2">
+      <use id="use-2" x="0" y="25"  xlink:href="" stroke="gray" stroke-width="2" stroke-dasharray="4" stroke-linecap="round"/>
+      <circle id="circle-2" cx='380' cy='25' r='10' fill='#FFFF00' />
     </g>
 
-    <text xml:id="pass" x="240" y="280" text-anchor="middle" fill="green" font-size="24">This text should be visible.</text>
+    <text id="pass" x="240" y="280" text-anchor="middle" fill="green" font-size="24">This text should be visible.</text>
 
   </g>
   <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
-    <text xml:id="revision" x="10" y="340" stroke="none"
+    <text id="revision" x="10" y="340" stroke="none"
       fill="black">$Revision: 1.5 $</text>
   </g>
-  <rect xml:id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
 
 </svg>

Added: trunk/LayoutTests/svg/custom/use-external-crash-expected.txt (0 => 110692)


--- trunk/LayoutTests/svg/custom/use-external-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/use-external-crash-expected.txt	2012-03-14 12:00:44 UTC (rev 110692)
@@ -0,0 +1,2 @@
+PASS if it doesn't assert in debug builds.
+

Added: trunk/LayoutTests/svg/custom/use-external-crash.svg (0 => 110692)


--- trunk/LayoutTests/svg/custom/use-external-crash.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/use-external-crash.svg	2012-03-14 12:00:44 UTC (rev 110692)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs><text>PASS if it doesn't assert in debug builds.</text></defs>
+<use xlink:href=""
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+if (window.gcController)
+    gcController.collect();
+</script>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (110691 => 110692)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 12:00:44 UTC (rev 110692)
@@ -1,3 +1,32 @@
+2012-03-14  Nikolas Zimmermann  <[email protected]>
+
+        External <use> xlink:href references do not work
+        https://bugs.webkit.org/show_bug.cgi?id=12499
+
+        Reviewed by Zoltan Herczeg.
+
+        Follow-up fix after r110676.
+        Assertions are firing due last minute changes in isExternalURIReference.
+
+        Fix detecting local resources properly, when the given iri contains a /complex/path.
+        Use document->completeURL() instead, and compare with the document->url() to decide
+        if its a local reference or not.
+
+        If an external document load fails with an error (eg. file missing) don't assert
+        in debug builds, instead handle it gracefully.
+
+        I decided to clean the code up as well, to make it more safe & obvious.
+
+        Test: svg/custom/use-external-crash.svg
+
+        * svg/SVGURIReference.cpp:
+        (WebCore::SVGURIReference::targetElementFromIRIString):
+        * svg/SVGURIReference.h:
+        (WebCore::SVGURIReference::isExternalURIReference):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::externalDocument):
+        (WebCore::SVGUseElement::buildPendingResource):
+
 2012-03-14  Lars Knudsen  <[email protected]>
 
         3D transformed surfaces with z>0 gets cropped

Modified: trunk/Source/WebCore/svg/SVGURIReference.cpp (110691 => 110692)


--- trunk/Source/WebCore/svg/SVGURIReference.cpp	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/Source/WebCore/svg/SVGURIReference.cpp	2012-03-14 12:00:44 UTC (rev 110692)
@@ -87,23 +87,21 @@
     if (url == KURL())
         return 0;
 
-    // If we're requesting an external resources, and externalDocument is non-zero, the load already succeeded.
-    // Go ahead and check if the externalDocuments URL matches the expected URL, that we resolved using the
-    // host document before in urlFromIRIStringWithFragmentIdentifier(). For internal resources, the same
-    // assumption must hold true, just with the host documents URL, not the external documents URL.
-    if (!equalIgnoringFragmentIdentifier(url, externalDocument ? externalDocument->url() : document->url()))
-        return 0;
-
     if (fragmentIdentifier)
         *fragmentIdentifier = id;
 
     if (id.isEmpty())
         return 0;
 
-    if (externalDocument)
+    if (externalDocument) {
+        // Enforce that the referenced url matches the url of the document that we've loaded for it!
+        ASSERT(equalIgnoringFragmentIdentifier(url, externalDocument->url()));
         return externalDocument->getElementById(id);
+    }
+
+    // Exit early if the referenced url is external, and we have no externalDocument given.
     if (isExternalURIReference(iri, document))
-        return 0; // Non-existing external resource
+        return 0;
 
     return document->getElementById(id);
 }

Modified: trunk/Source/WebCore/svg/SVGURIReference.h (110691 => 110692)


--- trunk/Source/WebCore/svg/SVGURIReference.h	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/Source/WebCore/svg/SVGURIReference.h	2012-03-14 12:00:44 UTC (rev 110692)
@@ -42,17 +42,16 @@
     static String fragmentIdentifierFromIRIString(const String&, Document*);
     static Element* targetElementFromIRIString(const String&, Document*, String* = 0, Document* = 0);
 
-    static inline bool isExternalURIReference(const String& uri, Document* baseDocument)
+    static inline bool isExternalURIReference(const String& uri, Document* document)
     {
-        if (uri.startsWith("#"))
+        // If the URI matches our documents URL, early exit, we're dealing with a local reference.
+        ASSERT(document);
+        KURL url = ""
+        if (equalIgnoringFragmentIdentifier(url, document->url()))
             return false;
 
-        size_t startOfFragmentIdentifier = uri.find('#');
-        // If the target document is the base document but its path is given in format href=""
-        // then we should handle it as internal.
-        if (uri.substring(0, startOfFragmentIdentifier) != baseDocument->url().lastPathComponent())
-            return true;
-        return false;
+        // If the URI doesn't contain a base string, just see if it starts with a fragment-identifier.
+        return uri.find('#') != notFound;
     }
 
 protected:

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (110691 => 110692)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2012-03-14 11:56:47 UTC (rev 110691)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2012-03-14 12:00:44 UTC (rev 110692)
@@ -198,6 +198,9 @@
 Document* SVGUseElement::externalDocument() const
 {
     if (m_cachedDocument && m_cachedDocument->isLoaded()) {
+        // Gracefully handle error condition.
+        if (m_cachedDocument->errorOccurred())
+            return 0;
         ASSERT(m_cachedDocument->document());
         return m_cachedDocument->document();
     }
@@ -400,6 +403,10 @@
     String id;
     Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id, externalDocument());
     if (!target) {
+        // If we can't find the target of an external element, just give up.
+        // We can't observe if the target somewhen enters the external document, nor should we do it.
+        if (externalDocument())
+            return;
         if (hasPendingResources() || id.isEmpty())
             return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to