Title: [274852] trunk
Revision
274852
Author
[email protected]
Date
2021-03-23 00:02:33 -0700 (Tue, 23 Mar 2021)

Log Message

SVG links navigate only to internal animation elements and <view> anchors
https://bugs.webkit.org/show_bug.cgi?id=223161

Reviewed by Ryosuke Niwa.

Source/WebCore:

The specs for the SVG anchor element <a> have changed in SVG2.

Link: https://svgwg.org/svg2-draft/linking.html#Links

After deprecating the xlink namespace, the SVG anchor element <a> became
very similar to HTML’s <a> element. They both use attributes in the default
namespace.

* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):

LayoutTests:

* svg/hixie/links/003.xml:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274851 => 274852)


--- trunk/LayoutTests/ChangeLog	2021-03-23 06:37:31 UTC (rev 274851)
+++ trunk/LayoutTests/ChangeLog	2021-03-23 07:02:33 UTC (rev 274852)
@@ -1,3 +1,12 @@
+2021-03-23  Said Abou-Hallawa  <[email protected]>
+
+        SVG links navigate only to internal animation elements and <view> anchors
+        https://bugs.webkit.org/show_bug.cgi?id=223161
+
+        Reviewed by Ryosuke Niwa.
+
+        * svg/hixie/links/003.xml:
+
 2021-03-22  Venky Dass  <[email protected]>
 
         Nullptr crash in  WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing.

Modified: trunk/LayoutTests/svg/hixie/links/003.xml (274851 => 274852)


--- trunk/LayoutTests/svg/hixie/links/003.xml	2021-03-23 06:37:31 UTC (rev 274851)
+++ trunk/LayoutTests/svg/hixie/links/003.xml	2021-03-23 07:02:33 UTC (rev 274852)
@@ -19,7 +19,7 @@
  
 function checkNoNavigation()
 {
-  var result = location.hash == '' ? 'PASS' : 'FAIL';
+  var result = location.hash != '' ? 'PASS' : 'FAIL';
   document.documentElement.appendChild(document.createTextNode(result));
   if (window.testRunner)
     testRunner.notifyDone();
@@ -39,14 +39,9 @@
 }
 ]]>
 </script>
-   <!-- Spec says that <a> can only link to animation elements,
-        otherwise it is invalid; that known attributes with
-        unsupported values are treated as if they hadn't been
-        specified when rendering; that if the attribute is not
-        specified, the effect is as if an empty value ("") was
-        specified; and that an empty attribute value (xlink:href=""
-        means that no link traversal occurs upon activation of the 'a'
-        element. So. Nothing should happen if you click it: -->
+   <!-- SVG 2 uses attributes in the default namespace that are
+        consistent with HTML links, and deprecates the XLink
+        attributes. -->
    <a xlink:href="" id="link">
     <circle cx="50" cy="50" r="50" fill="blue"/>
    </a>

Modified: trunk/Source/WebCore/ChangeLog (274851 => 274852)


--- trunk/Source/WebCore/ChangeLog	2021-03-23 06:37:31 UTC (rev 274851)
+++ trunk/Source/WebCore/ChangeLog	2021-03-23 07:02:33 UTC (rev 274852)
@@ -1,3 +1,21 @@
+2021-03-23  Said Abou-Hallawa  <[email protected]>
+
+        SVG links navigate only to internal animation elements and <view> anchors
+        https://bugs.webkit.org/show_bug.cgi?id=223161
+
+        Reviewed by Ryosuke Niwa.
+
+        The specs for the SVG anchor element <a> have changed in SVG2.
+
+        Link: https://svgwg.org/svg2-draft/linking.html#Links
+
+        After deprecating the xlink namespace, the SVG anchor element <a> became
+        very similar to HTML’s <a> element. They both use attributes in the default
+        namespace.
+
+        * svg/SVGAElement.cpp:
+        (WebCore::SVGAElement::defaultEventHandler):
+
 2021-03-22  Venky Dass  <[email protected]>
 
         Nullptr crash in  WebCore::RenderObject::RenderObjectBitfields::isLineBreak() where a NULL check is missing.

Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (274851 => 274852)


--- trunk/Source/WebCore/svg/SVGAElement.cpp	2021-03-23 06:37:31 UTC (rev 274851)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp	2021-03-23 07:02:33 UTC (rev 274852)
@@ -130,9 +130,6 @@
                     event.setDefaultHandled();
                     return;
                 }
-                // Only allow navigation to internal <view> anchors.
-                if (targetElement && !targetElement->hasTagName(SVGNames::viewTag))
-                    return;
             }
 
             String target = this->target();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to