From 3f93cd5ef78672f2e83dc854988e9da2b557f1a8 Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Wed, 27 Jan 2016 20:09:50 +0000 Subject: [PATCH] Add Node.treeRoot https://bugs.webkit.org/show_bug.cgi?id=153537 Reviewed by Antti Koivisto. Source/WebCore: Exposed highestAncestor as Node.prototype.treeRoot, which was added to shadow DOM spec in https://github.com/w3c/webcomponents/commit/6864a40fe4efa8a737e78512e3c85319ddc5bf8b See also: http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-node-interface Test: fast/shadow-dom/Node-interface-treeRoot.html * dom/Node.idl: LayoutTests: Added a testharness.js test for Node.treeRoot. Also rebaselined a test. * js/dom/dom-static-property-for-in-iteration-expected.txt: Rebaselined. * fast/shadow-dom/Node-interface-treeRoot-expected.txt: Added. * fast/shadow-dom/Node-interface-treeRoot.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@195682 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 13 ++ .../Node-interface-treeRoot-expected.txt | 12 ++ .../shadow-dom/Node-interface-treeRoot.html | 150 ++++++++++++++++++ ...tic-property-for-in-iteration-expected.txt | 1 + Source/WebCore/ChangeLog | 17 ++ Source/WebCore/dom/Node.idl | 2 + 6 files changed, 195 insertions(+) create mode 100644 LayoutTests/fast/shadow-dom/Node-interface-treeRoot-expected.txt create mode 100644 LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 68e6e89c89b0..fa7c2a486db4 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,16 @@ +2016-01-26 Ryosuke Niwa + + Add Node.treeRoot + https://bugs.webkit.org/show_bug.cgi?id=153537 + + Reviewed by Antti Koivisto. + + Added a testharness.js test for Node.treeRoot. Also rebaselined a test. + + * js/dom/dom-static-property-for-in-iteration-expected.txt: Rebaselined. + * fast/shadow-dom/Node-interface-treeRoot-expected.txt: Added. + * fast/shadow-dom/Node-interface-treeRoot.html: Added. + 2016-01-26 Ryosuke Niwa Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes diff --git a/LayoutTests/fast/shadow-dom/Node-interface-treeRoot-expected.txt b/LayoutTests/fast/shadow-dom/Node-interface-treeRoot-expected.txt new file mode 100644 index 000000000000..0ba4b3214291 --- /dev/null +++ b/LayoutTests/fast/shadow-dom/Node-interface-treeRoot-expected.txt @@ -0,0 +1,12 @@ + +PASS treeRoot attribute must be defined on Node interface +PASS treeRoot attribute must return the context object when it does not have any parent +PASS treeRoot attribute must return the parent node of the context object when the context object has a single ancestor not in a document +PASS treeRoot attribute must return the document when a node is in document and not in a shadow tree +PASS treeRoot attribute must return the open shadow root of the context object when the shadow host is in a document +PASS treeRoot attribute must return the closed shadow root of the context object when the shadow host is in a document +PASS treeRoot attribute must return the root node of the context object when the context object is inside a open shadow root whose shadow host is in another open shadow root +PASS treeRoot attribute must return the root node of the context object when the context object is inside a closed shadow root whose shadow host is in another open shadow root +PASS treeRoot attribute must return the root node of the context object when the context object is inside a open shadow root whose shadow host is in another closed shadow root +PASS treeRoot attribute must return the root node of the context object when the context object is inside a closed shadow root whose shadow host is in another closed shadow root + diff --git a/LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html b/LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html new file mode 100644 index 000000000000..146656167608 --- /dev/null +++ b/LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html @@ -0,0 +1,150 @@ + + + +Shadow DOM: Extensions to Node interface + + + + + + + + +
+ + + diff --git a/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt b/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt index b48c20d77ac8..c49f57485ca0 100644 --- a/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt +++ b/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt @@ -86,6 +86,7 @@ PASS a["lastChild"] is [object Text] PASS a["previousSibling"] is [object Text] PASS a["nextSibling"] is [object Text] PASS a["ownerDocument"] is [object HTMLDocument] +PASS a["treeRoot"] is [object HTMLDocument] PASS a["namespaceURI"] is http://www.w3.org/1999/xhtml PASS a["prefix"] is null PASS a["localName"] is a diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 1e46c973e51a..d8461840786c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2016-01-26 Ryosuke Niwa + + Add Node.treeRoot + https://bugs.webkit.org/show_bug.cgi?id=153537 + + Reviewed by Antti Koivisto. + + Exposed highestAncestor as Node.prototype.treeRoot, which was added to shadow DOM spec in + https://github.com/w3c/webcomponents/commit/6864a40fe4efa8a737e78512e3c85319ddc5bf8b + + See also: + http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-node-interface + + Test: fast/shadow-dom/Node-interface-treeRoot.html + + * dom/Node.idl: + 2016-01-26 Ryosuke Niwa Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes diff --git a/Source/WebCore/dom/Node.idl b/Source/WebCore/dom/Node.idl index 9f0cd5d86f79..caea509234c0 100644 --- a/Source/WebCore/dom/Node.idl +++ b/Source/WebCore/dom/Node.idl @@ -60,6 +60,8 @@ readonly attribute Node nextSibling; readonly attribute Document ownerDocument; + [Conditional=SHADOW_DOM, ImplementedAs=highestAncestor] readonly attribute Node treeRoot; + [ObjCLegacyUnnamedParameters, Custom, RaisesException] Node insertBefore([CustomReturn] Node newChild, Node refChild); [ObjCLegacyUnnamedParameters, Custom, RaisesException] Node replaceChild(Node newChild, -- 2.36.0