Title: [262360] trunk
Revision
262360
Author
[email protected]
Date
2020-05-31 03:40:13 -0700 (Sun, 31 May 2020)

Log Message

Implement named item condition for images
https://bugs.webkit.org/show_bug.cgi?id=212473

Patch by Rob Buis <[email protected]> on 2020-05-31
Reviewed by Maciej Stachowiak.

LayoutTests/imported/w3c:

Update improved test expectation.

* web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06-expected.txt:

Source/WebCore:

Implement named item condition for images, not only should we
check there are both an id and a name attribute, but also that
the name attribute is non-empty [1].

Behavior matches Chrome and Firefox.

[1] https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter

Test: imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06.html

* html/HTMLNameCollection.cpp:
(WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):

LayoutTests:

Update test expectation.

* fast/dom/HTMLDocument/document-special-properties-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262359 => 262360)


--- trunk/LayoutTests/ChangeLog	2020-05-31 08:36:54 UTC (rev 262359)
+++ trunk/LayoutTests/ChangeLog	2020-05-31 10:40:13 UTC (rev 262360)
@@ -1,3 +1,14 @@
+2020-05-31  Rob Buis  <[email protected]>
+
+        Implement named item condition for images
+        https://bugs.webkit.org/show_bug.cgi?id=212473
+
+        Reviewed by Maciej Stachowiak.
+
+        Update test expectation.
+
+        * fast/dom/HTMLDocument/document-special-properties-expected.txt:
+
 2020-05-31  Myles C. Maxfield  <[email protected]>
 
         Rebaseline imported/w3c/web-platform-tests/encoding/single-byte-decoder.html

Modified: trunk/LayoutTests/fast/dom/HTMLDocument/document-special-properties-expected.txt (262359 => 262360)


--- trunk/LayoutTests/fast/dom/HTMLDocument/document-special-properties-expected.txt	2020-05-31 08:36:54 UTC (rev 262359)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/document-special-properties-expected.txt	2020-05-31 10:40:13 UTC (rev 262360)
@@ -11,7 +11,7 @@
 Image by id (multiple): undefined
 Image by id/name mixed: collection(2) IMG(name) IMG(name)
 Image by id, name present (unique): single IMG(id,name)
-Image by id, empty name present (unique): single IMG(id)
+Image by id, empty name present (unique): undefined
 Image by id, name present (multiple): collection(2) IMG(id,name) IMG(id,name)
 Image by name, id present (unique): single IMG(id,name)
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (262359 => 262360)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-05-31 08:36:54 UTC (rev 262359)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-05-31 10:40:13 UTC (rev 262360)
@@ -1,5 +1,16 @@
 2020-05-31  Rob Buis  <[email protected]>
 
+        Implement named item condition for images
+        https://bugs.webkit.org/show_bug.cgi?id=212473
+
+        Reviewed by Maciej Stachowiak.
+
+        Update improved test expectation.
+
+        * web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06-expected.txt:
+
+2020-05-31  Rob Buis  <[email protected]>
+
         <area> needs to be connected in order to navigate
         https://bugs.webkit.org/show_bug.cgi?id=177357
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06-expected.txt (262359 => 262360)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06-expected.txt	2020-05-31 08:36:54 UTC (rev 262359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06-expected.txt	2020-05-31 10:40:13 UTC (rev 262360)
@@ -2,7 +2,7 @@
 PASS If there is one img, it should be returned (name) 
 PASS If there are two imgs, a collection should be returned. (name) 
 PASS If there is one img, it should not be returned (id) 
-FAIL If there are two imgs, nothing should be returned. (id) assert_false: "test4" in document should be false expected false got true
+PASS If there are two imgs, nothing should be returned. (id) 
 PASS If there are two imgs, the one with a name should be returned. (name and id) 
 PASS If there are two imgs, the one with a name should be returned. (id and name) 
 PASS A name should affect getting an img by id 

Modified: trunk/Source/WebCore/ChangeLog (262359 => 262360)


--- trunk/Source/WebCore/ChangeLog	2020-05-31 08:36:54 UTC (rev 262359)
+++ trunk/Source/WebCore/ChangeLog	2020-05-31 10:40:13 UTC (rev 262360)
@@ -1,5 +1,25 @@
 2020-05-31  Rob Buis  <[email protected]>
 
+        Implement named item condition for images
+        https://bugs.webkit.org/show_bug.cgi?id=212473
+
+        Reviewed by Maciej Stachowiak.
+
+        Implement named item condition for images, not only should we
+        check there are both an id and a name attribute, but also that
+        the name attribute is non-empty [1].
+
+        Behavior matches Chrome and Firefox.
+
+        [1] https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter
+
+        Test: imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06.html
+
+        * html/HTMLNameCollection.cpp:
+        (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
+
+2020-05-31  Rob Buis  <[email protected]>
+
         <area> needs to be connected in order to navigate
         https://bugs.webkit.org/show_bug.cgi?id=177357
 

Modified: trunk/Source/WebCore/html/HTMLNameCollection.cpp (262359 => 262360)


--- trunk/Source/WebCore/html/HTMLNameCollection.cpp	2020-05-31 08:36:54 UTC (rev 262359)
+++ trunk/Source/WebCore/html/HTMLNameCollection.cpp	2020-05-31 10:40:13 UTC (rev 262360)
@@ -68,7 +68,7 @@
     // FIXME: We need to fix HTMLImageElement to update the hash map for us when the name attribute is removed.
     return isObjectElementForDocumentNameCollection(element)
         || is<HTMLAppletElement>(element)
-        || (is<HTMLImageElement>(element) && element.hasName());
+        || (is<HTMLImageElement>(element) && element.hasName() && !element.getNameAttribute().isEmpty());
 }
 
 bool DocumentNameCollection::elementMatchesIfNameAttributeMatch(const Element& element)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to