Changeset 206285 in webkit
- Timestamp:
- Sep 22, 2016 6:54:05 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r206266 r206285 1 2016-09-22 Chris Dumez <cdumez@apple.com> 2 3 [ShadowDOM] Add support for Node.getRootNode(options) 4 https://bugs.webkit.org/show_bug.cgi?id=162457 5 6 Reviewed by Ryosuke Niwa. 7 8 Rebaseline existing W3C DOM tests now that more checks are passing. 9 10 * web-platform-tests/dom/interfaces-expected.txt: 11 * web-platform-tests/dom/nodes/rootNode-expected.txt: 12 1 13 2016-09-22 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt
r206260 r206285 193 193 PASS Node interface: attribute isConnected 194 194 PASS Node interface: attribute ownerDocument 195 FAIL Node interface: operation getRootNode(GetRootNodeOptions) assert_own_property: interface prototype object missing non-static operation expected property "getRootNode" missing 195 PASS Node interface: operation getRootNode(GetRootNodeOptions) 196 196 PASS Node interface: attribute parentNode 197 197 PASS Node interface: attribute parentElement … … 350 350 PASS Node interface: new Document() must inherit property "isConnected" with the proper type (15) 351 351 PASS Node interface: new Document() must inherit property "ownerDocument" with the proper type (16) 352 FAIL Node interface: new Document() must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 353 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on new Document() with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 352 PASS Node interface: new Document() must inherit property "getRootNode" with the proper type (17) 353 PASS Node interface: calling getRootNode(GetRootNodeOptions) on new Document() with too few arguments must throw TypeError 354 354 PASS Node interface: new Document() must inherit property "parentNode" with the proper type (18) 355 355 PASS Node interface: new Document() must inherit property "parentElement" with the proper type (19) … … 482 482 PASS Node interface: xmlDoc must inherit property "isConnected" with the proper type (15) 483 483 PASS Node interface: xmlDoc must inherit property "ownerDocument" with the proper type (16) 484 FAIL Node interface: xmlDoc must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 485 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 484 PASS Node interface: xmlDoc must inherit property "getRootNode" with the proper type (17) 485 PASS Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc with too few arguments must throw TypeError 486 486 PASS Node interface: xmlDoc must inherit property "parentNode" with the proper type (18) 487 487 PASS Node interface: xmlDoc must inherit property "parentElement" with the proper type (19) … … 590 590 PASS Node interface: document.doctype must inherit property "isConnected" with the proper type (15) 591 591 PASS Node interface: document.doctype must inherit property "ownerDocument" with the proper type (16) 592 FAIL Node interface: document.doctype must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 593 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.doctype with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 592 PASS Node interface: document.doctype must inherit property "getRootNode" with the proper type (17) 593 PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.doctype with too few arguments must throw TypeError 594 594 PASS Node interface: document.doctype must inherit property "parentNode" with the proper type (18) 595 595 PASS Node interface: document.doctype must inherit property "parentElement" with the proper type (19) … … 686 686 PASS Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15) 687 687 PASS Node interface: document.createDocumentFragment() must inherit property "ownerDocument" with the proper type (16) 688 FAIL Node interface: document.createDocumentFragment() must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 689 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.createDocumentFragment() with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 688 PASS Node interface: document.createDocumentFragment() must inherit property "getRootNode" with the proper type (17) 689 PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createDocumentFragment() with too few arguments must throw TypeError 690 690 PASS Node interface: document.createDocumentFragment() must inherit property "parentNode" with the proper type (18) 691 691 PASS Node interface: document.createDocumentFragment() must inherit property "parentElement" with the proper type (19) … … 893 893 PASS Node interface: element must inherit property "isConnected" with the proper type (15) 894 894 PASS Node interface: element must inherit property "ownerDocument" with the proper type (16) 895 FAIL Node interface: element must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 896 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on element with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 895 PASS Node interface: element must inherit property "getRootNode" with the proper type (17) 896 PASS Node interface: calling getRootNode(GetRootNodeOptions) on element with too few arguments must throw TypeError 897 897 PASS Node interface: element must inherit property "parentNode" with the proper type (18) 898 898 PASS Node interface: element must inherit property "parentElement" with the proper type (19) … … 993 993 PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "isConnected" with the proper type (15) 994 994 PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "ownerDocument" with the proper type (16) 995 FAIL Node interface: document.querySelector("[id]").attributes[0] must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 996 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.querySelector("[id]").attributes[0] with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 995 PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "getRootNode" with the proper type (17) 996 PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.querySelector("[id]").attributes[0] with too few arguments must throw TypeError 997 997 PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "parentNode" with the proper type (18) 998 998 PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "parentElement" with the proper type (19) … … 1112 1112 PASS Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15) 1113 1113 PASS Node interface: document.createTextNode("abc") must inherit property "ownerDocument" with the proper type (16) 1114 FAIL Node interface: document.createTextNode("abc") must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 1115 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.createTextNode("abc") with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 1114 PASS Node interface: document.createTextNode("abc") must inherit property "getRootNode" with the proper type (17) 1115 PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createTextNode("abc") with too few arguments must throw TypeError 1116 1116 PASS Node interface: document.createTextNode("abc") must inherit property "parentNode" with the proper type (18) 1117 1117 PASS Node interface: document.createTextNode("abc") must inherit property "parentElement" with the proper type (19) … … 1213 1213 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15) 1214 1214 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "ownerDocument" with the proper type (16) 1215 FAIL Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 1216 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 1215 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "getRootNode" with the proper type (17) 1216 PASS Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError 1217 1217 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "parentNode" with the proper type (18) 1218 1218 PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "parentElement" with the proper type (19) … … 1307 1307 PASS Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15) 1308 1308 PASS Node interface: document.createComment("abc") must inherit property "ownerDocument" with the proper type (16) 1309 FAIL Node interface: document.createComment("abc") must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain 1310 FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.createComment("abc") with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain 1309 PASS Node interface: document.createComment("abc") must inherit property "getRootNode" with the proper type (17) 1310 PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createComment("abc") with too few arguments must throw TypeError 1311 1311 PASS Node interface: document.createComment("abc") must inherit property "parentNode" with the proper type (18) 1312 1312 PASS Node interface: document.createComment("abc") must inherit property "parentElement" with the proper type (19) -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/rootNode-expected.txt
r206260 r206285 1 1 2 FAIL getRootNode() must return the context object when it does not have any parent element.getRootNode is not a function. (In 'element.getRootNode()', 'element.getRootNode' is undefined) 3 FAIL getRootNode() must return the parent node of the context object when the context object has a single ancestor not in a document element.getRootNode is not a function. (In 'element.getRootNode()', 'element.getRootNode' is undefined) 4 FAIL getRootNode() must return the document when a node is in document element.getRootNode is not a function. (In 'element.getRootNode()', 'element.getRootNode' is undefined) 5 FAIL getRootNode() must return a document fragment when a node is in the fragment element.getRootNode is not a function. (In 'element.getRootNode()', 'element.getRootNode' is undefined) 2 PASS getRootNode() must return the context object when it does not have any parent 3 PASS getRootNode() must return the parent node of the context object when the context object has a single ancestor not in a document 4 PASS getRootNode() must return the document when a node is in document 5 PASS getRootNode() must return a document fragment when a node is in the fragment 6 6 -
trunk/Source/WebCore/ChangeLog
r206280 r206285 1 2016-09-22 Chris Dumez <cdumez@apple.com> 2 3 [ShadowDOM] Add support for Node.getRootNode(options) 4 https://bugs.webkit.org/show_bug.cgi?id=162457 5 6 Reviewed by Ryosuke Niwa. 7 8 Add support for Node.getRootNode(options): 9 - https://dom.spec.whatwg.org/#dom-node-getrootnode 10 11 No new tests, rebaselined existing tests. 12 13 * dom/EventPath.cpp: 14 (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter): 15 (WebCore::RelatedNodeRetargeter::checkConsistency): 16 * dom/Node.cpp: 17 (WebCore::Node::rootNode): 18 (WebCore::Node::shadowIncludingRoot): 19 (WebCore::Node::getRootNode): 20 * dom/Node.h: 21 * dom/Node.idl: 22 * editing/Editor.cpp: 23 (WebCore::correctSpellcheckingPreservingTextCheckingParagraph): 24 * xml/XPathPath.cpp: 25 (WebCore::XPath::LocationPath::evaluate): 26 1 27 2016-09-22 Brady Eidson <beidson@apple.com> 2 28 -
trunk/Source/WebCore/dom/EventPath.cpp
r202953 r206285 291 291 Node& targetAncestorInDocumentScope = i ? *downcast<ShadowRoot>(m_ancestorTreeScopes[i - 1]->rootNode()).shadowHost() : target; 292 292 Node& relatedNodeAncestorInDocumentScope = j ? *downcast<ShadowRoot>(targetTreeScopeAncestors[j - 1]->rootNode()).shadowHost() : relatedNode; 293 if ( targetAncestorInDocumentScope.rootNode() !=relatedNodeAncestorInDocumentScope.rootNode()) {293 if (&targetAncestorInDocumentScope.rootNode() != &relatedNodeAncestorInDocumentScope.rootNode()) { 294 294 m_hasDifferentTreeRoot = true; 295 295 m_retargetedRelatedNode = moveOutOfAllShadowRoots(relatedNode); … … 366 366 Node& base = currentTarget; 367 367 for (Node* targetAncestor = &m_relatedNode; targetAncestor; targetAncestor = targetAncestor->parentOrShadowHostNode()) { 368 if (targetAncestor->rootNode() ->containsIncludingShadowDOM(&base)) {368 if (targetAncestor->rootNode().containsIncludingShadowDOM(&base)) { 369 369 ASSERT(m_retargetedRelatedNode == targetAncestor); 370 370 return; -
trunk/Source/WebCore/dom/Node.cpp
r205468 r206285 1164 1164 } 1165 1165 1166 Node *Node::rootNode() const1166 Node& Node::rootNode() const 1167 1167 { 1168 1168 if (isInTreeScope()) 1169 return &treeScope().rootNode();1169 return treeScope().rootNode(); 1170 1170 1171 1171 Node* node = const_cast<Node*>(this); … … 1173 1173 for (; node; node = node->parentNode()) 1174 1174 highest = node; 1175 return highest; 1175 return *highest; 1176 } 1177 1178 // https://dom.spec.whatwg.org/#concept-shadow-including-root 1179 Node& Node::shadowIncludingRoot() const 1180 { 1181 auto& root = rootNode(); 1182 if (!is<ShadowRoot>(root)) 1183 return root; 1184 auto* host = downcast<ShadowRoot>(root).host(); 1185 return host ? host->shadowIncludingRoot() : root; 1186 } 1187 1188 Node& Node::getRootNode(const GetRootNodeOptions& options) const 1189 { 1190 return options.composed ? shadowIncludingRoot() : rootNode(); 1176 1191 } 1177 1192 -
trunk/Source/WebCore/dom/Node.h
r205468 r206285 274 274 Element* parentOrShadowHostElement() const; 275 275 void setParentNode(ContainerNode*); 276 Node* rootNode() const; 276 Node& rootNode() const; 277 Node& shadowIncludingRoot() const; 278 279 struct GetRootNodeOptions { 280 bool composed; 281 }; 282 Node& getRootNode(const GetRootNodeOptions&) const; 277 283 278 284 // Use when it's guaranteed to that shadowHost is null. -
trunk/Source/WebCore/dom/Node.idl
r205280 r206285 91 91 boolean contains(Node? other); 92 92 93 [EnabledAtRuntime=ShadowDOM] Node getRootNode(optional GetRootNodeOptions options); 93 94 [EnabledAtRuntime=ShadowDOM, ImplementedAs=inDocument] readonly attribute boolean isConnected; 94 95 95 96 readonly attribute Element parentElement; 96 97 }; 98 99 dictionary GetRootNodeOptions { 100 boolean composed = false; 101 }; -
trunk/Source/WebCore/editing/Editor.cpp
r205870 r206285 2471 2471 static void correctSpellcheckingPreservingTextCheckingParagraph(TextCheckingParagraph& paragraph, PassRefPtr<Range> rangeToReplace, const String& replacement, int resultLocation, int resultLength) 2472 2472 { 2473 ContainerNode*scope = downcast<ContainerNode>(paragraph.paragraphRange()->startContainer().rootNode());2473 auto& scope = downcast<ContainerNode>(paragraph.paragraphRange()->startContainer().rootNode()); 2474 2474 2475 2475 size_t paragraphLocation; 2476 2476 size_t paragraphLength; 2477 TextIterator::getLocationAndLengthFromRange( scope, paragraph.paragraphRange().get(), paragraphLocation, paragraphLength);2477 TextIterator::getLocationAndLengthFromRange(&scope, paragraph.paragraphRange().get(), paragraphLocation, paragraphLength); 2478 2478 2479 2479 applyCommand(SpellingCorrectionCommand::create(rangeToReplace, replacement)); … … 2482 2482 // See <rdar://10305315>, http://webkit.org/b/89526. 2483 2483 2484 RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocationAndLength( scope, paragraphLocation, paragraphLength + replacement.length() - resultLength);2484 RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocationAndLength(&scope, paragraphLocation, paragraphLength + replacement.length() - resultLength); 2485 2485 2486 2486 paragraph = TextCheckingParagraph(TextIterator::subrange(newParagraphRange.get(), resultLocation, replacement.length()), newParagraphRange); -
trunk/Source/WebCore/xml/XPathPath.cpp
r197887 r206285 90 90 Node* context = evaluationContext.node.get(); 91 91 if (m_isAbsolute && !context->isDocumentNode()) 92 context = context->rootNode();92 context = &context->rootNode(); 93 93 94 94 NodeSet nodes;
Note: See TracChangeset
for help on using the changeset viewer.