Changeset 269481 in webkit
- Timestamp:
- Nov 5, 2020, 3:27:47 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-names-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/TreeScopeOrderedMap.cpp (modified) (1 diff)
-
Source/WebCore/dom/TreeScopeOrderedMap.h (modified) (1 diff)
-
Source/WebCore/html/HTMLDocument.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r269477 r269481 1 2020-11-05 Chris Dumez <cdumez@apple.com> 2 3 Add implementation for Object.getOwnPropertyNames() on HTMLDocument 4 https://bugs.webkit.org/show_bug.cgi?id=218625 5 6 Reviewed by Geoffrey Garen. 7 8 Rebaseline test now that more checks are passing. The checks we are failing are failing 9 in Blink & Gecko also. The checks are are now passing are also passing in Blink & Gecko. 10 11 * web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-names-expected.txt: 12 1 13 2020-11-05 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-names-expected.txt
r267646 r269481 1 1 2 FAIL An embed name appears in a document's property names if the embed is exposed. assert_true: expected true got false 3 PASS An embed name does not appears in a document's property names if the embed is inside another embed. 4 FAIL A form name appears in a document's property names. assert_true: expected true got false 5 FAIL An iframe name appears in a document's property names. assert_true: expected true got false 6 FAIL An img name appears in a document's property names when the img has no id. assert_true: expected true got false 2 PASS An embed name appears in a document's property names if the embed is exposed. 3 FAIL An embed name does not appears in a document's property names if the embed is inside another embed. assert_false: expected false got true 4 PASS A form name appears in a document's property names. 5 PASS An iframe name appears in a document's property names. 6 PASS An img name appears in a document's property names when the img has no id. 7 7 FAIL An object name appears in a document's property names if the object is exposed. assert_true: expected true got false 8 8 FAIL An object id appears in a document's property names if the object is exposed. assert_true: expected true got false 9 PASS An object name does not appear in a document's property names if the object is inside another object. 10 PASS An object id does not appear in a document's property names if the object is inside another object. 11 FAIL An img name appears in a document's property names when the img has an id. assert_true: expected true got false 12 FAIL An img id appears in a document's property names when the img has a name. assert_true: expected true got false 9 FAIL An object name does not appear in a document's property names if the object is inside another object. assert_false: expected false got true 10 FAIL An object id does not appear in a document's property names if the object is inside another object. assert_false: expected false got true 11 PASS An img name appears in a document's property names when the img has an id. 12 PASS An img id appears in a document's property names when the img has a name. 13 13 PASS An img id does not appear in a document's property names when the img has no name. 14 FAIL A document's property names can include integer strings. assert_true: expected true got false 14 PASS A document's property names can include integer strings. 15 15 PASS A template name does not appear in a document's property names. 16 16 PASS An img name does not appear in a document's property names when the img is in a template's document fragment. 17 FAIL A document's property names appear in tree order. assert_ equals: expected 0 but got -117 FAIL A document's property names appear in tree order. assert_greater_than: expected a number greater than 5 but got 0 18 18 -
trunk/Source/WebCore/ChangeLog
r269477 r269481 1 2020-11-05 Chris Dumez <cdumez@apple.com> 2 3 Add implementation for Object.getOwnPropertyNames() on HTMLDocument 4 https://bugs.webkit.org/show_bug.cgi?id=218625 5 6 Reviewed by Geoffrey Garen. 7 8 Add implementation for Object.getOwnPropertyNames() on HTMLDocument so that it properly 9 returns names of the properties that would be returned by the named property getter. 10 This aligns our behavior with Blink and Gecko. 11 12 No new tests, rebaselined existing test. 13 14 * dom/TreeScopeOrderedMap.cpp: 15 (WebCore::TreeScopeOrderedMap::keys const): 16 * dom/TreeScopeOrderedMap.h: 17 * html/HTMLDocument.cpp: 18 (WebCore::HTMLDocument::supportedPropertyNames const): 19 1 20 2020-11-05 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebCore/dom/TreeScopeOrderedMap.cpp
r259990 r269481 217 217 } 218 218 219 const Vector<AtomString> TreeScopeOrderedMap::keys() const 220 { 221 Vector<AtomString> result; 222 result.reserveInitialCapacity(m_map.size()); 223 for (auto* key : m_map.keys()) 224 result.uncheckedAppend(const_cast<AtomStringImpl*>(key)); 225 return result; 226 } 227 219 228 } // namespace WebCore -
trunk/Source/WebCore/dom/TreeScopeOrderedMap.h
r254087 r269481 66 66 const Vector<Element*>* getAllElementsById(const AtomStringImpl&, const TreeScope&) const; 67 67 68 const Vector<AtomString> keys() const; 69 68 70 private: 69 71 template <typename KeyMatchingFunction> -
trunk/Source/WebCore/html/HTMLDocument.cpp
r268114 r269481 141 141 Vector<AtomString> HTMLDocument::supportedPropertyNames() const 142 142 { 143 // https://html.spec.whatwg.org/multipage/dom.html#dom-document-namedItem-which 144 // 145 // ... The supported property names of a Document object document at any moment consist of the following, in 146 // tree order according to the element that contributed them, ignoring later duplicates, and with values from 147 // id attributes coming before values from name attributes when the same element contributes both: 148 // 149 // - the value of the name content attribute for all applet, exposed embed, form, iframe, img, and exposed 150 // object elements that have a non-empty name content attribute and are in a document tree with document 151 // as their root; 152 // - the value of the id content attribute for all applet and exposed object elements that have a non-empty 153 // id content attribute and are in a document tree with document as their root; and 154 // - the value of the id content attribute for all img elements that have both a non-empty id content attribute 155 // and a non-empty name content attribute, and are in a document tree with document as their root. 156 157 // FIXME: Implement. 158 return { }; 143 auto properties = m_documentNamedItem.keys(); 144 // The specification says these should be sorted in document order but this would be expensive 145 // and other browser engines do not comply with this part of the specification. For now, just 146 // do an alphabetical sort to get consistent results. 147 std::sort(properties.begin(), properties.end(), WTF::codePointCompareLessThan); 148 return properties; 159 149 } 160 150
Note:
See TracChangeset
for help on using the changeset viewer.