Title: [264789] trunk
Revision
264789
Author
[email protected]
Date
2020-07-23 14:05:27 -0700 (Thu, 23 Jul 2020)

Log Message

Add support for SVGAElement's rel / relList attributes
https://bugs.webkit.org/show_bug.cgi?id=214690

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT tests that are now passing.

* web-platform-tests/dom/lists/DOMTokenList-coverage-for-attributes-expected.txt:
* web-platform-tests/svg/idlharness.window-expected.txt:
* web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt:
* web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt:

Source/WebCore:

Add support for SVGAElement's rel / relList attributes:
https://www.w3.org/TR/SVG/linking.html#InterfaceSVGAElement

No new tests, rebaselined existing tests.

* svg/SVGAElement.cpp:
(WebCore::SVGAElement::parseAttribute):
(WebCore::SVGAElement::relList const):
* svg/SVGAElement.h:
* svg/SVGAElement.idl:
* svg/svgattrs.in:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (264788 => 264789)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-23 21:05:27 UTC (rev 264789)
@@ -1,3 +1,17 @@
+2020-07-23  Chris Dumez  <[email protected]>
+
+        Add support for SVGAElement's rel / relList attributes
+        https://bugs.webkit.org/show_bug.cgi?id=214690
+
+        Reviewed by Darin Adler.
+
+        Rebaseline WPT tests that are now passing.
+
+        * web-platform-tests/dom/lists/DOMTokenList-coverage-for-attributes-expected.txt:
+        * web-platform-tests/svg/idlharness.window-expected.txt:
+        * web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt:
+        * web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt:
+
 2020-07-23  Clark Wang  <[email protected]>
 
         Added PeriodicWave constructor according to spec

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-coverage-for-attributes-expected.txt (264788 => 264789)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-coverage-for-attributes-expected.txt	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-coverage-for-attributes-expected.txt	2020-07-23 21:05:27 UTC (rev 264789)
@@ -41,7 +41,7 @@
 PASS output.relList in http://www.w3.org/1999/xhtml namespace should be undefined. 
 PASS td.relList in http://www.w3.org/1999/xhtml namespace should be undefined. 
 PASS th.relList in http://www.w3.org/1999/xhtml namespace should be undefined. 
-FAIL a.relList in http://www.w3.org/2000/svg namespace should be DOMTokenList. assert_class_string: expected "[object DOMTokenList]" but got "[object Undefined]"
+PASS a.relList in http://www.w3.org/2000/svg namespace should be DOMTokenList. 
 PASS area.relList in http://www.w3.org/2000/svg namespace should be undefined. 
 PASS link.relList in http://www.w3.org/2000/svg namespace should be undefined. 
 PASS iframe.relList in http://www.w3.org/2000/svg namespace should be undefined. 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/idlharness.window-expected.txt (264788 => 264789)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/idlharness.window-expected.txt	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/idlharness.window-expected.txt	2020-07-23 21:05:27 UTC (rev 264789)
@@ -1614,8 +1614,8 @@
 PASS SVGAElement interface: attribute target 
 FAIL SVGAElement interface: attribute download assert_true: The prototype object must have a property "download" expected true got false
 FAIL SVGAElement interface: attribute ping assert_true: The prototype object must have a property "ping" expected true got false
-FAIL SVGAElement interface: attribute rel assert_true: The prototype object must have a property "rel" expected true got false
-FAIL SVGAElement interface: attribute relList assert_true: The prototype object must have a property "relList" expected true got false
+PASS SVGAElement interface: attribute rel 
+PASS SVGAElement interface: attribute relList 
 FAIL SVGAElement interface: attribute hreflang assert_true: The prototype object must have a property "hreflang" expected true got false
 FAIL SVGAElement interface: attribute type assert_true: The prototype object must have a property "type" expected true got false
 FAIL SVGAElement interface: attribute text assert_true: The prototype object must have a property "text" expected true got false
@@ -1626,8 +1626,8 @@
 PASS SVGAElement interface: objects.a must inherit property "target" with the proper type 
 FAIL SVGAElement interface: objects.a must inherit property "download" with the proper type assert_inherits: property "download" not found in prototype chain
 FAIL SVGAElement interface: objects.a must inherit property "ping" with the proper type assert_inherits: property "ping" not found in prototype chain
-FAIL SVGAElement interface: objects.a must inherit property "rel" with the proper type assert_inherits: property "rel" not found in prototype chain
-FAIL SVGAElement interface: objects.a must inherit property "relList" with the proper type assert_inherits: property "relList" not found in prototype chain
+PASS SVGAElement interface: objects.a must inherit property "rel" with the proper type 
+PASS SVGAElement interface: objects.a must inherit property "relList" with the proper type 
 FAIL SVGAElement interface: objects.a must inherit property "hreflang" with the proper type assert_inherits: property "hreflang" not found in prototype chain
 FAIL SVGAElement interface: objects.a must inherit property "type" with the proper type assert_inherits: property "type" not found in prototype chain
 FAIL SVGAElement interface: objects.a must inherit property "text" with the proper type assert_inherits: property "text" not found in prototype chain

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt (264788 => 264789)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/linking/scripted/a.rel-getter-01-expected.txt	2020-07-23 21:05:27 UTC (rev 264789)
@@ -1,4 +1,4 @@
 
 PASS SVGAElement.rel getter 
-FAIL Test anchor's rel getter assert_equals: expected (string) "noreferrer" but got (undefined) undefined
+PASS Test anchor's rel getter 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt (264788 => 264789)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/linking/scripted/rellist-feature-detection-expected.txt	2020-07-23 21:05:27 UTC (rev 264789)
@@ -1,3 +1,3 @@
 
-FAIL Make sure that relList based feature detection is working undefined is not an object (evaluating 'element.relList.contains')
+PASS Make sure that relList based feature detection is working 
 

Modified: trunk/Source/WebCore/ChangeLog (264788 => 264789)


--- trunk/Source/WebCore/ChangeLog	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/ChangeLog	2020-07-23 21:05:27 UTC (rev 264789)
@@ -1,3 +1,22 @@
+2020-07-23  Chris Dumez  <[email protected]>
+
+        Add support for SVGAElement's rel / relList attributes
+        https://bugs.webkit.org/show_bug.cgi?id=214690
+
+        Reviewed by Darin Adler.
+
+        Add support for SVGAElement's rel / relList attributes:
+        https://www.w3.org/TR/SVG/linking.html#InterfaceSVGAElement
+
+        No new tests, rebaselined existing tests.
+
+        * svg/SVGAElement.cpp:
+        (WebCore::SVGAElement::parseAttribute):
+        (WebCore::SVGAElement::relList const):
+        * svg/SVGAElement.h:
+        * svg/SVGAElement.idl:
+        * svg/svgattrs.in:
+
 2020-07-23  Yusuke Suzuki  <[email protected]>
 
         Add exception check for WebCore createRejectedPromiseWithTypeError

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (264788 => 264789)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2020-07-23 21:05:27 UTC (rev 264789)
@@ -319,15 +319,15 @@
     return m_linkRelations.contains(relation);
 }
 
-DOMTokenList& HTMLAnchorElement::relList() const
+DOMTokenList& HTMLAnchorElement::relList()
 {
     if (!m_relList) {
-        m_relList = makeUnique<DOMTokenList>(const_cast<HTMLAnchorElement&>(*this), HTMLNames::relAttr, [](Document&, StringView token) {
+        m_relList = makeUnique<DOMTokenList>(*this, HTMLNames::relAttr, [](Document&, StringView token) {
 #if USE(SYSTEM_PREVIEW)
-            return equalIgnoringASCIICase(token, "noreferrer") || equalIgnoringASCIICase(token, "noopener") || equalIgnoringASCIICase(token, "ar");
-#else
+            if (equalIgnoringASCIICase(token, "ar"))
+                return true;
+#endif
             return equalIgnoringASCIICase(token, "noreferrer") || equalIgnoringASCIICase(token, "noopener");
-#endif
         });
     }
     return *m_relList;
@@ -382,7 +382,7 @@
 }
 
 #if USE(SYSTEM_PREVIEW)
-bool HTMLAnchorElement::isSystemPreviewLink() const
+bool HTMLAnchorElement::isSystemPreviewLink()
 {
     if (!RuntimeEnabledFeatures::sharedFeatures().systemPreviewEnabled())
         return false;

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.h (264788 => 264789)


--- trunk/Source/WebCore/html/HTMLAnchorElement.h	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.h	2020-07-23 21:05:27 UTC (rev 264789)
@@ -67,10 +67,10 @@
     
     SharedStringHash visitedLinkHash() const;
 
-    WEBCORE_EXPORT DOMTokenList& relList() const;
+    WEBCORE_EXPORT DOMTokenList& relList();
 
 #if USE(SYSTEM_PREVIEW)
-    WEBCORE_EXPORT bool isSystemPreviewLink() const;
+    WEBCORE_EXPORT bool isSystemPreviewLink();
 #endif
 
     void setReferrerPolicyForBindings(const AtomString&);
@@ -126,7 +126,7 @@
     // This is computed only once and must not be affected by subsequent URL changes.
     mutable Markable<SharedStringHash, SharedStringHashMarkableTraits> m_storedVisitedLinkHash;
 
-    mutable std::unique_ptr<DOMTokenList> m_relList;
+    std::unique_ptr<DOMTokenList> m_relList;
 };
 
 inline SharedStringHash HTMLAnchorElement::visitedLinkHash() const

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (264788 => 264789)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2020-07-23 21:05:27 UTC (rev 264789)
@@ -885,7 +885,7 @@
     if (!RuntimeEnabledFeatures::sharedFeatures().systemPreviewEnabled())
         return false;
 
-    const auto* parent = parentElement();
+    auto* parent = parentElement();
     if (is<HTMLAnchorElement>(parent))
         return downcast<HTMLAnchorElement>(parent)->isSystemPreviewLink();
     if (is<HTMLPictureElement>(parent))

Modified: trunk/Source/WebCore/html/HTMLPictureElement.cpp (264788 => 264789)


--- trunk/Source/WebCore/html/HTMLPictureElement.cpp	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/html/HTMLPictureElement.cpp	2020-07-23 21:05:27 UTC (rev 264789)
@@ -65,12 +65,12 @@
 }
 
 #if USE(SYSTEM_PREVIEW)
-bool HTMLPictureElement::isSystemPreviewImage() const
+bool HTMLPictureElement::isSystemPreviewImage()
 {
     if (!RuntimeEnabledFeatures::sharedFeatures().systemPreviewEnabled())
         return false;
 
-    const auto* parent = parentElement();
+    auto* parent = parentElement();
     if (!is<HTMLAnchorElement>(parent))
         return false;
     return downcast<HTMLAnchorElement>(parent)->isSystemPreviewLink();

Modified: trunk/Source/WebCore/html/HTMLPictureElement.h (264788 => 264789)


--- trunk/Source/WebCore/html/HTMLPictureElement.h	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/html/HTMLPictureElement.h	2020-07-23 21:05:27 UTC (rev 264789)
@@ -38,7 +38,7 @@
     void sourcesChanged();
 
 #if USE(SYSTEM_PREVIEW)
-    WEBCORE_EXPORT bool isSystemPreviewImage() const;
+    WEBCORE_EXPORT bool isSystemPreviewImage();
 #endif
 
 private:

Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (264788 => 264789)


--- trunk/Source/WebCore/svg/SVGAElement.cpp	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp	2020-07-23 21:05:27 UTC (rev 264789)
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "SVGAElement.h"
 
+#include "DOMTokenList.h"
 #include "Document.h"
 #include "EventHandler.h"
 #include "Frame.h"
@@ -79,6 +80,9 @@
     if (name == SVGNames::targetAttr) {
         m_target->setBaseValInternal(value);
         return;
+    } else if (name == SVGNames::relAttr) {
+        if (m_relList)
+            m_relList->associatedAttributeValueChanged(value);
     }
 
     SVGGraphicsElement::parseAttribute(name, value);
@@ -220,4 +224,18 @@
     return *m_storedVisitedLinkHash;
 }
 
+DOMTokenList& SVGAElement::relList()
+{
+    if (!m_relList) {
+        m_relList = makeUnique<DOMTokenList>(*this, SVGNames::relAttr, [](Document&, StringView token) {
+#if USE(SYSTEM_PREVIEW)
+            if (equalIgnoringASCIICase(token, "ar"))
+                return true;
+#endif
+            return equalIgnoringASCIICase(token, "noreferrer") || equalIgnoringASCIICase(token, "noopener");
+        });
+    }
+    return *m_relList;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGAElement.h (264788 => 264789)


--- trunk/Source/WebCore/svg/SVGAElement.h	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/svg/SVGAElement.h	2020-07-23 21:05:27 UTC (rev 264789)
@@ -28,6 +28,8 @@
 
 namespace WebCore {
 
+class DOMTokenList;
+
 class SVGAElement final : public SVGGraphicsElement, public SVGURIReference {
     WTF_MAKE_ISO_ALLOCATED(SVGAElement);
 public:
@@ -38,6 +40,8 @@
 
     SharedStringHash visitedLinkHash() const;
 
+    DOMTokenList& relList();
+
 private:
     SVGAElement(const QualifiedName&, Document&);
 
@@ -68,6 +72,8 @@
 
     // This is computed only once and must not be affected by subsequent URL changes.
     mutable Optional<SharedStringHash> m_storedVisitedLinkHash;
+
+    std::unique_ptr<DOMTokenList> m_relList;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/svg/SVGAElement.idl (264788 => 264789)


--- trunk/Source/WebCore/svg/SVGAElement.idl	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/svg/SVGAElement.idl	2020-07-23 21:05:27 UTC (rev 264789)
@@ -25,6 +25,9 @@
 
 interface SVGAElement : SVGGraphicsElement {
     readonly attribute SVGAnimatedString target;
+
+    [Reflect] attribute DOMString rel;
+    [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
 };
 
 SVGAElement implements SVGURIReference;

Modified: trunk/Source/WebCore/svg/svgattrs.in (264788 => 264789)


--- trunk/Source/WebCore/svg/svgattrs.in	2020-07-23 20:37:39 UTC (rev 264788)
+++ trunk/Source/WebCore/svg/svgattrs.in	2020-07-23 21:05:27 UTC (rev 264789)
@@ -159,6 +159,7 @@
 radius
 refX
 refY
+rel
 rendering-intent
 repeatCount
 repeatDur
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to