Changeset 197887 in webkit
- Timestamp:
- Mar 9, 2016 2:29:33 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 16 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r197869 r197887 1 2016-03-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Rename Node.treeRoot to rootNode and turn it on by default 4 https://bugs.webkit.org/show_bug.cgi?id=155226 5 6 Reviewed by Antonio Gomes. 7 8 Split Node-interface-treeRoot.html into two pieces, the one that doesn't invoke shadow DOM and the other that tests 9 shadow DOM related cases. I intend to upstream these tests to W3C at some point so keep them in testharness.js form. 10 11 * fast/dom/Node/rootNode-expected.txt: Added. 12 * fast/dom/Node/rootNode.html: Copied from LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html. 13 * fast/shadow-dom/Node-interface-rootNode-expected.txt: Renamed from Node-interface-treeRoot-expected.txt. 14 * fast/shadow-dom/Node-interface-rootNode.html: Renamed from LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html. 15 * js/dom/dom-static-property-for-in-iteration-expected.txt: 16 * platform/efl/js/dom/dom-static-property-for-in-iteration-expected.txt: 17 * platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt: 18 1 19 2016-03-09 Michael Saboff <msaboff@apple.com> 2 20 -
trunk/LayoutTests/fast/dom/Node/rootNode.html
r197834 r197887 2 2 <html> 3 3 <head> 4 <title> Shadow DOM: Extensions to Node interface</title>4 <title>DOM: 4.4. Interface Node</title> 5 5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> 6 <meta name="assert" content="Node interface must have treeRootattribute">7 <link rel="help" href="http ://w3c.github.io/webcomponents/spec/shadow/#extensions-to-node-interface">8 <script src="../../ resources/testharness.js"></script>9 <script src="../../ resources/testharnessreport.js"></script>10 <link rel='stylesheet' href='../../ resources/testharness.css'>6 <meta name="assert" content="Node interface must have rootNode attribute"> 7 <link rel="help" href="https://dom.spec.whatwg.org/#dom-node-rootnode"> 8 <script src="../../../resources/testharness.js"></script> 9 <script src="../../../resources/testharnessreport.js"></script> 10 <link rel='stylesheet' href='../../../resources/testharness.css'> 11 11 </head> 12 12 <body> … … 15 15 16 16 test(function () { 17 assert_true('treeRoot' in Node.prototype, 'treeRoot must be defined on Node.prototype'); 18 assert_true('treeRoot' in document.createElement('div'), 'treeRoot must be defined on a div element'); 19 assert_true('treeRoot' in document.createTextNode(''), 'assignedSlot must be defined on a text node'); 20 assert_true('treeRoot' in document.createComment(''), 'assignedSlot must be defined on a comment node'); 21 assert_true('treeRoot' in document.createProcessingInstruction('target', 'data'), 'assignedSlot must be defined on a processing instruction node'); 22 assert_true('treeRoot' in document, 'assignedSlot must be defined on a document node'); 23 assert_true('treeRoot' in document.createElement('div').attachShadow({mode: 'closed'}), 'treeRoot must be defined on a closed shadow root element'); 24 assert_true('treeRoot' in document.createElement('div').attachShadow({mode: 'open'}), 'treeRoot must be defined on a open shadow root element'); 25 }, 'treeRoot attribute must be defined on Node interface'); 17 assert_true('rootNode' in Node.prototype, 'rootNode must be defined on Node.prototype'); 18 assert_true('rootNode' in document.createElement('div'), 'rootNode must be defined on a div element'); 19 assert_true('rootNode' in document.createTextNode(''), 'rootNode must be defined on a text node'); 20 assert_true('rootNode' in document.createComment(''), 'rootNode must be defined on a comment node'); 21 assert_true('rootNode' in document.createProcessingInstruction('target', 'data'), 'rootNode must be defined on a processing instruction node'); 22 assert_true('rootNode' in document, 'rootNode must be defined on a document node'); 23 }, 'rootNode attribute must be defined on Node interface'); 26 24 27 25 test(function () { 28 26 var element = document.createElement('div'); 29 assert_equals(element. treeRoot, element, 'treeRooton an element without a parent must return the element itself');27 assert_equals(element.rootNode, element, 'rootNode on an element without a parent must return the element itself'); 30 28 31 29 var text = document.createTextNode(''); 32 assert_equals(text. treeRoot, text, 'treeRooton a text node without a parent must return the text node itself');30 assert_equals(text.rootNode, text, 'rootNode on a text node without a parent must return the text node itself'); 33 31 34 32 var processingInstruction = document.createProcessingInstruction('target', 'data'); 35 assert_equals(processingInstruction. treeRoot, processingInstruction, 'treeRooton a processing instruction node without a parent must return the processing instruction node itself');33 assert_equals(processingInstruction.rootNode, processingInstruction, 'rootNode on a processing instruction node without a parent must return the processing instruction node itself'); 36 34 37 assert_equals(document. treeRoot, document, 'treeRooton a document node must return the document itself');35 assert_equals(document.rootNode, document, 'rootNode on a document node must return the document itself'); 38 36 39 var closedShadowRoot = document.createElement('div').attachShadow({mode: 'closed'}); 40 assert_equals(closedShadowRoot.treeRoot, closedShadowRoot, 'treeRoot on a closed shadow root must return the shadow root itself'); 41 42 var openShadowRoot = document.createElement('div').attachShadow({mode: 'open'}); 43 assert_equals(openShadowRoot.treeRoot, openShadowRoot, 'treeRoot on a open shadow root must return the shadow root itself'); 44 }, 'treeRoot attribute must return the context object when it does not have any parent'); 37 }, 'rootNode attribute must return the context object when it does not have any parent'); 45 38 46 39 test(function () { … … 49 42 var element = document.createElement('div'); 50 43 parent.appendChild(element); 51 assert_equals(element. treeRoot, parent, 'treeRooton an element with a single ancestor must return the parent node');44 assert_equals(element.rootNode, parent, 'rootNode on an element with a single ancestor must return the parent node'); 52 45 53 46 var text = document.createTextNode(''); 54 47 parent.appendChild(text); 55 assert_equals(text. treeRoot, parent, 'treeRooton a text node with a single ancestor must return the parent node');48 assert_equals(text.rootNode, parent, 'rootNode on a text node with a single ancestor must return the parent node'); 56 49 57 50 var processingInstruction = document.createProcessingInstruction('target', 'data'); 58 51 parent.appendChild(processingInstruction) 59 assert_equals(processingInstruction. treeRoot, parent, 'treeRooton a processing instruction node with a single ancestor must return the parent node');52 assert_equals(processingInstruction.rootNode, parent, 'rootNode on a processing instruction node with a single ancestor must return the parent node'); 60 53 61 var hostWithClosedShadowRoot = document.createElement('div'); 62 parent.appendChild(hostWithClosedShadowRoot); 63 var closedShadowRoot = hostWithClosedShadowRoot.attachShadow({mode: 'closed'}); 64 assert_equals(closedShadowRoot.treeRoot, closedShadowRoot, 'treeRoot on a closed shadow root with a single ancestor on its host must return the shadow root itself'); 65 66 var hostWithOpenShadowRoot = document.createElement('div'); 67 parent.appendChild(hostWithOpenShadowRoot); 68 var openShadowRoot = hostWithOpenShadowRoot.attachShadow({mode: 'open'}); 69 assert_equals(openShadowRoot.treeRoot, openShadowRoot, 'treeRoot on a open shadow root with a single ancestor on its host must return the shadow root itself'); 70 }, 'treeRoot attribute must return the parent node of the context object when the context object has a single ancestor not in a document'); 54 }, 'rootNode attribute must return the parent node of the context object when the context object has a single ancestor not in a document'); 71 55 72 56 test(function () { … … 76 60 var element = document.createElement('div'); 77 61 parent.appendChild(element); 78 assert_equals(element. treeRoot, document, 'treeRooton an element inside a document must return the document');62 assert_equals(element.rootNode, document, 'rootNode on an element inside a document must return the document'); 79 63 80 64 var text = document.createTextNode(''); 81 65 parent.appendChild(text); 82 assert_equals(text. treeRoot, document, 'treeRooton a text node inside a document must return the document');66 assert_equals(text.rootNode, document, 'rootNode on a text node inside a document must return the document'); 83 67 84 68 var processingInstruction = document.createProcessingInstruction('target', 'data'); 85 69 parent.appendChild(processingInstruction) 86 assert_equals(processingInstruction. treeRoot, document, 'treeRooton a processing instruction node inside a document must return the document');87 }, ' treeRoot attribute must return the document when a node is in document and not in a shadow tree');70 assert_equals(processingInstruction.rootNode, document, 'rootNode on a processing instruction node inside a document must return the document'); 71 }, 'rootNode attribute must return the document when a node is in document'); 88 72 89 function testTreeRootOnNodeInsideShadowTree(mode) {90 test(function () {91 var host = document.createElement('div');92 document.body.appendChild(host);73 test(function () { 74 var fragment = document.createDocumentFragment(); 75 var parent = document.createElement('div'); 76 fragment.appendChild(parent); 93 77 94 var shadowRoot = host.attachShadow({mode: mode});95 var parent = document.createElement('p');96 shadowRoot.appendChild(parent);78 var element = document.createElement('div'); 79 parent.appendChild(element); 80 assert_equals(element.rootNode, fragment, 'rootNode on an element inside a document fragment must return the fragment'); 97 81 98 var element = document.createElement('span');99 parent.appendChild(element);100 assert_equals(element.treeRoot, shadowRoot, 'treeRoot on an element inside a shadow tree must return the shadow root');82 var text = document.createTextNode(''); 83 parent.appendChild(text); 84 assert_equals(text.rootNode, fragment, 'rootNode on a text node inside a document fragment must return the fragment'); 101 85 102 var text = document.createTextNode(''); 103 parent.appendChild(text); 104 assert_equals(text.treeRoot, shadowRoot, 'treeRoot on a text node inside a shadow tree must return the shadow root'); 105 106 var processingInstruction = document.createProcessingInstruction('target', 'data'); 107 parent.appendChild(processingInstruction); 108 assert_equals(processingInstruction.treeRoot, shadowRoot, 'treeRoot on a processing instruction node inside a shadow tree must return the shadow root'); 109 }, 'treeRoot attribute must return the ' + mode + ' shadow root of the context object when the shadow host is in a document'); 110 } 111 112 testTreeRootOnNodeInsideShadowTree('open'); 113 testTreeRootOnNodeInsideShadowTree('closed'); 114 115 function testTreeRootOnNodeInsideNestedShadowTree(outerMode, innerMode) { 116 test(function () { 117 var outerHost = document.createElement('div'); 118 document.body.appendChild(outerHost); 119 var outerShadowRoot = outerHost.attachShadow({mode: outerMode}); 120 121 var innerHost = document.createElement('section'); 122 outerShadowRoot.appendChild(innerHost); 123 var innerShadowRoot = innerHost.attachShadow({mode: innerMode}); 124 125 var parent = document.createElement('p'); 126 innerShadowRoot.appendChild(parent); 127 128 var element = document.createElement('span'); 129 parent.appendChild(element); 130 assert_equals(element.treeRoot, innerShadowRoot, 'treeRoot on an element inside a shadow tree must return its root node'); 131 132 var text = document.createTextNode(''); 133 parent.appendChild(text); 134 assert_equals(text.treeRoot, innerShadowRoot, 'treeRoot on a text node inside a shadow tree must return its root node'); 135 136 var processingInstruction = document.createProcessingInstruction('target', 'data'); 137 parent.appendChild(processingInstruction); 138 assert_equals(processingInstruction.treeRoot, innerShadowRoot, 'treeRoot on a processing instruction node inside a shadow tree must return its root node'); 139 }, 'treeRoot attribute must return the root node of the context object when the context object is inside a ' + innerMode 140 + ' shadow root whose shadow host is in another ' + outerMode + ' shadow root'); 141 } 142 143 testTreeRootOnNodeInsideNestedShadowTree('open', 'open'); 144 testTreeRootOnNodeInsideNestedShadowTree('open', 'closed'); 145 testTreeRootOnNodeInsideNestedShadowTree('closed', 'open'); 146 testTreeRootOnNodeInsideNestedShadowTree('closed', 'closed'); 86 var processingInstruction = document.createProcessingInstruction('target', 'data'); 87 parent.appendChild(processingInstruction) 88 assert_equals(processingInstruction.rootNode, fragment, 89 'rootNode on a processing instruction node inside a document fragment must return the fragment'); 90 }, 'rootNode attribute must return a document fragment when a node is in the fragment'); 147 91 148 92 </script> -
trunk/LayoutTests/fast/shadow-dom/Node-interface-rootNode-expected.txt
r197834 r197887 1 1 2 PASS treeRoot attribute must be defined on Nodeinterface3 PASS treeRootattribute must return the context object when it does not have any parent4 PASS treeRootattribute must return the parent node of the context object when the context object has a single ancestor not in a document5 PASS treeRootattribute must return the document when a node is in document and not in a shadow tree6 PASS treeRootattribute must return the open shadow root of the context object when the shadow host is in a document7 PASS treeRootattribute must return the closed shadow root of the context object when the shadow host is in a document8 PASS treeRootattribute 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 root9 PASS treeRootattribute 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 root10 PASS treeRootattribute 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 root11 PASS treeRootattribute 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 root2 PASS rootNode attribute must be defined on ShadowRoot interface 3 PASS rootNode attribute must return the context object when it does not have any parent 4 PASS rootNode attribute must return the parent node of the context object when the context object has a single ancestor not in a document 5 PASS rootNode attribute must return the document when a node is in document and not in a shadow tree 6 PASS rootNode attribute must return the open shadow root of the context object when the shadow host is in a document 7 PASS rootNode attribute must return the closed shadow root of the context object when the shadow host is in a document 8 PASS rootNode 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 9 PASS rootNode 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 10 PASS rootNode 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 11 PASS rootNode 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 12 12 -
trunk/LayoutTests/fast/shadow-dom/Node-interface-rootNode.html
r197834 r197887 4 4 <title>Shadow DOM: Extensions to Node interface</title> 5 5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> 6 <meta name="assert" content="Node interface must have treeRootattribute">6 <meta name="assert" content="Node interface must have rootNode attribute"> 7 7 <link rel="help" href="http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-node-interface"> 8 8 <script src="../../resources/testharness.js"></script> … … 15 15 16 16 test(function () { 17 assert_true('treeRoot' in Node.prototype, 'treeRoot must be defined on Node.prototype'); 18 assert_true('treeRoot' in document.createElement('div'), 'treeRoot must be defined on a div element'); 19 assert_true('treeRoot' in document.createTextNode(''), 'assignedSlot must be defined on a text node'); 20 assert_true('treeRoot' in document.createComment(''), 'assignedSlot must be defined on a comment node'); 21 assert_true('treeRoot' in document.createProcessingInstruction('target', 'data'), 'assignedSlot must be defined on a processing instruction node'); 22 assert_true('treeRoot' in document, 'assignedSlot must be defined on a document node'); 23 assert_true('treeRoot' in document.createElement('div').attachShadow({mode: 'closed'}), 'treeRoot must be defined on a closed shadow root element'); 24 assert_true('treeRoot' in document.createElement('div').attachShadow({mode: 'open'}), 'treeRoot must be defined on a open shadow root element'); 25 }, 'treeRoot attribute must be defined on Node interface'); 17 assert_true('rootNode' in document.createElement('div').attachShadow({mode: 'closed'}), 'rootNode must be defined on a closed shadow root element'); 18 assert_true('rootNode' in document.createElement('div').attachShadow({mode: 'open'}), 'rootNode must be defined on a open shadow root element'); 19 }, 'rootNode attribute must be defined on ShadowRoot interface'); 26 20 27 21 test(function () { 28 var element = document.createElement('div');29 assert_equals(element.treeRoot, element, 'treeRoot on an element without a parent must return the element itself');30 31 var text = document.createTextNode('');32 assert_equals(text.treeRoot, text, 'treeRoot on a text node without a parent must return the text node itself');33 34 var processingInstruction = document.createProcessingInstruction('target', 'data');35 assert_equals(processingInstruction.treeRoot, processingInstruction, 'treeRoot on a processing instruction node without a parent must return the processing instruction node itself');36 37 assert_equals(document.treeRoot, document, 'treeRoot on a document node must return the document itself');38 39 22 var closedShadowRoot = document.createElement('div').attachShadow({mode: 'closed'}); 40 assert_equals(closedShadowRoot. treeRoot, closedShadowRoot, 'treeRooton a closed shadow root must return the shadow root itself');23 assert_equals(closedShadowRoot.rootNode, closedShadowRoot, 'rootNode on a closed shadow root must return the shadow root itself'); 41 24 42 25 var openShadowRoot = document.createElement('div').attachShadow({mode: 'open'}); 43 assert_equals(openShadowRoot. treeRoot, openShadowRoot, 'treeRooton a open shadow root must return the shadow root itself');44 }, ' treeRootattribute must return the context object when it does not have any parent');26 assert_equals(openShadowRoot.rootNode, openShadowRoot, 'rootNode on a open shadow root must return the shadow root itself'); 27 }, 'rootNode attribute must return the context object when it does not have any parent'); 45 28 46 29 test(function () { 47 30 var parent = document.createElement('div'); 48 31 49 var element = document.createElement('div');50 parent.appendChild(element);51 assert_equals(element.treeRoot, parent, 'treeRoot on an element with a single ancestor must return the parent node');52 53 var text = document.createTextNode('');54 parent.appendChild(text);55 assert_equals(text.treeRoot, parent, 'treeRoot on a text node with a single ancestor must return the parent node');56 57 var processingInstruction = document.createProcessingInstruction('target', 'data');58 parent.appendChild(processingInstruction)59 assert_equals(processingInstruction.treeRoot, parent, 'treeRoot on a processing instruction node with a single ancestor must return the parent node');60 61 32 var hostWithClosedShadowRoot = document.createElement('div'); 62 33 parent.appendChild(hostWithClosedShadowRoot); 63 34 var closedShadowRoot = hostWithClosedShadowRoot.attachShadow({mode: 'closed'}); 64 assert_equals(closedShadowRoot. treeRoot, closedShadowRoot, 'treeRooton a closed shadow root with a single ancestor on its host must return the shadow root itself');35 assert_equals(closedShadowRoot.rootNode, closedShadowRoot, 'rootNode on a closed shadow root with a single ancestor on its host must return the shadow root itself'); 65 36 66 37 var hostWithOpenShadowRoot = document.createElement('div'); 67 38 parent.appendChild(hostWithOpenShadowRoot); 68 39 var openShadowRoot = hostWithOpenShadowRoot.attachShadow({mode: 'open'}); 69 assert_equals(openShadowRoot. treeRoot, openShadowRoot, 'treeRooton a open shadow root with a single ancestor on its host must return the shadow root itself');70 }, ' treeRootattribute must return the parent node of the context object when the context object has a single ancestor not in a document');40 assert_equals(openShadowRoot.rootNode, openShadowRoot, 'rootNode on a open shadow root with a single ancestor on its host must return the shadow root itself'); 41 }, 'rootNode attribute must return the parent node of the context object when the context object has a single ancestor not in a document'); 71 42 72 43 test(function () { … … 76 47 var element = document.createElement('div'); 77 48 parent.appendChild(element); 78 assert_equals(element. treeRoot, document, 'treeRooton an element inside a document must return the document');49 assert_equals(element.rootNode, document, 'rootNode on an element inside a document must return the document'); 79 50 80 51 var text = document.createTextNode(''); 81 52 parent.appendChild(text); 82 assert_equals(text. treeRoot, document, 'treeRooton a text node inside a document must return the document');53 assert_equals(text.rootNode, document, 'rootNode on a text node inside a document must return the document'); 83 54 84 55 var processingInstruction = document.createProcessingInstruction('target', 'data'); 85 56 parent.appendChild(processingInstruction) 86 assert_equals(processingInstruction. treeRoot, document, 'treeRooton a processing instruction node inside a document must return the document');87 }, ' treeRootattribute must return the document when a node is in document and not in a shadow tree');57 assert_equals(processingInstruction.rootNode, document, 'rootNode on a processing instruction node inside a document must return the document'); 58 }, 'rootNode attribute must return the document when a node is in document and not in a shadow tree'); 88 59 89 function test TreeRootOnNodeInsideShadowTree(mode) {60 function testrootNodeOnNodeInsideShadowTree(mode) { 90 61 test(function () { 91 62 var host = document.createElement('div'); … … 98 69 var element = document.createElement('span'); 99 70 parent.appendChild(element); 100 assert_equals(element. treeRoot, shadowRoot, 'treeRooton an element inside a shadow tree must return the shadow root');71 assert_equals(element.rootNode, shadowRoot, 'rootNode on an element inside a shadow tree must return the shadow root'); 101 72 102 73 var text = document.createTextNode(''); 103 74 parent.appendChild(text); 104 assert_equals(text. treeRoot, shadowRoot, 'treeRooton a text node inside a shadow tree must return the shadow root');75 assert_equals(text.rootNode, shadowRoot, 'rootNode on a text node inside a shadow tree must return the shadow root'); 105 76 106 77 var processingInstruction = document.createProcessingInstruction('target', 'data'); 107 78 parent.appendChild(processingInstruction); 108 assert_equals(processingInstruction. treeRoot, shadowRoot, 'treeRooton a processing instruction node inside a shadow tree must return the shadow root');109 }, ' treeRootattribute must return the ' + mode + ' shadow root of the context object when the shadow host is in a document');79 assert_equals(processingInstruction.rootNode, shadowRoot, 'rootNode on a processing instruction node inside a shadow tree must return the shadow root'); 80 }, 'rootNode attribute must return the ' + mode + ' shadow root of the context object when the shadow host is in a document'); 110 81 } 111 82 112 test TreeRootOnNodeInsideShadowTree('open');113 test TreeRootOnNodeInsideShadowTree('closed');83 testrootNodeOnNodeInsideShadowTree('open'); 84 testrootNodeOnNodeInsideShadowTree('closed'); 114 85 115 function test TreeRootOnNodeInsideNestedShadowTree(outerMode, innerMode) {86 function testrootNodeOnNodeInsideNestedShadowTree(outerMode, innerMode) { 116 87 test(function () { 117 88 var outerHost = document.createElement('div'); … … 128 99 var element = document.createElement('span'); 129 100 parent.appendChild(element); 130 assert_equals(element. treeRoot, innerShadowRoot, 'treeRooton an element inside a shadow tree must return its root node');101 assert_equals(element.rootNode, innerShadowRoot, 'rootNode on an element inside a shadow tree must return its root node'); 131 102 132 103 var text = document.createTextNode(''); 133 104 parent.appendChild(text); 134 assert_equals(text. treeRoot, innerShadowRoot, 'treeRooton a text node inside a shadow tree must return its root node');105 assert_equals(text.rootNode, innerShadowRoot, 'rootNode on a text node inside a shadow tree must return its root node'); 135 106 136 107 var processingInstruction = document.createProcessingInstruction('target', 'data'); 137 108 parent.appendChild(processingInstruction); 138 assert_equals(processingInstruction. treeRoot, innerShadowRoot, 'treeRooton a processing instruction node inside a shadow tree must return its root node');139 }, ' treeRootattribute must return the root node of the context object when the context object is inside a ' + innerMode109 assert_equals(processingInstruction.rootNode, innerShadowRoot, 'rootNode on a processing instruction node inside a shadow tree must return its root node'); 110 }, 'rootNode attribute must return the root node of the context object when the context object is inside a ' + innerMode 140 111 + ' shadow root whose shadow host is in another ' + outerMode + ' shadow root'); 141 112 } 142 113 143 test TreeRootOnNodeInsideNestedShadowTree('open', 'open');144 test TreeRootOnNodeInsideNestedShadowTree('open', 'closed');145 test TreeRootOnNodeInsideNestedShadowTree('closed', 'open');146 test TreeRootOnNodeInsideNestedShadowTree('closed', 'closed');114 testrootNodeOnNodeInsideNestedShadowTree('open', 'open'); 115 testrootNodeOnNodeInsideNestedShadowTree('open', 'closed'); 116 testrootNodeOnNodeInsideNestedShadowTree('closed', 'open'); 117 testrootNodeOnNodeInsideNestedShadowTree('closed', 'closed'); 147 118 148 119 </script> -
trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt
r196890 r197887 143 143 PASS a["nextSibling"] is [object Text] 144 144 PASS a["ownerDocument"] is [object HTMLDocument] 145 PASS a[" treeRoot"] is [object HTMLDocument]145 PASS a["rootNode"] is [object HTMLDocument] 146 146 PASS a["namespaceURI"] is http://www.w3.org/1999/xhtml 147 147 PASS a["prefix"] is null -
trunk/LayoutTests/platform/efl/js/dom/dom-static-property-for-in-iteration-expected.txt
r162202 r197887 78 78 PASS a["nextSibling"] is [object Text] 79 79 PASS a["ownerDocument"] is [object HTMLDocument] 80 PASS a["rootNode"] is [object HTMLDocument] 80 81 PASS a["namespaceURI"] is http://www.w3.org/1999/xhtml 81 82 PASS a["localName"] is a -
trunk/LayoutTests/platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt
r167050 r197887 82 82 PASS a["nextSibling"] is [object Text] 83 83 PASS a["ownerDocument"] is [object HTMLDocument] 84 PASS a["rootNode"] is [object HTMLDocument] 84 85 PASS a["namespaceURI"] is http://www.w3.org/1999/xhtml 85 86 PASS a["prefix"] is null -
trunk/Source/WebCore/ChangeLog
r197886 r197887 1 2016-03-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Rename Node.treeRoot to rootNode and turn it on by default 4 https://bugs.webkit.org/show_bug.cgi?id=155226 5 6 Reviewed by Antonio Gomes. 7 8 Node.prototype.treeRoot has been merged into DOM spec from Shadow DOM spec and renamed to rootNode: 9 https://dom.spec.whatwg.org/#dom-node-rootnode 10 11 Rename the method and expose it unconditionally on Node.prototype. 12 13 Tests: fast/dom/Node/rootNode.html 14 fast/shadow-dom/Node-interface-rootNode.html 15 16 * dom/ContainerNode.h: 17 (WebCore::Node::highestAncestor): Deleted. There is no need for this function to be inlined. 18 * dom/Document.h: Now that both TreeScope and Node defines rootNode, we need to pick either. 19 Here, we pick TreeScope's definition since Document is by definition always in a document so there is 20 no need to even check inTreeScope(). 21 * dom/Node.cpp: 22 (WebCore::Node::rootNode): Moved here. Also added a fast path for when "this" node is in a document 23 or a shadow root since TreeScope stores its root node as a member variable (m_rootNode). 24 * dom/Node.h: 25 * dom/Node.idl: Renamed the method and removed Conditional=SHADOW_DOM. 26 * dom/ShadowRoot.h: Similar to the change in Document.h. See above. 27 * editing/Editor.cpp: 28 (WebCore::correctSpellcheckingPreservingTextCheckingParagraph): Use rootNode instead of free function 29 defined in htmlediting.cpp, which was removed in this patch. 30 * editing/htmlediting.cpp: 31 (WebCore::highestAncestor): Deleted. 32 * editing/htmlediting.h: 33 * html/FormAssociatedElement.cpp: 34 (WebCore::computeRootNode): Added. 35 (WebCore::FormAssociatedElement::removedFrom): We can't use Node::rootNode here because this function 36 is called in the middle of removing a subtree, and some associated form element's inDocument flag may 37 not have been updated yet. So use computeRootNode to manually find the highest ancestor. 38 (WebCore::FormAssociatedElement::formRemovedFromTree): Ditto. 39 * xml/XPathPath.cpp: 40 (WebCore::XPath::LocationPath::evaluate): 41 1 42 2016-03-09 Konstantin Tokarev <annulen@yandex.ru> 2 43 -
trunk/Source/WebCore/dom/ContainerNode.h
r196888 r197887 213 213 } 214 214 215 inline Node* Node::highestAncestor() const216 {217 Node* node = const_cast<Node*>(this);218 Node* highest = node;219 for (; node; node = node->parentNode())220 highest = node;221 return highest;222 }223 224 215 inline bool Node::isTreeScope() const 225 216 { -
trunk/Source/WebCore/dom/Document.h
r197690 r197887 341 341 using ContainerNode::ref; 342 342 using ContainerNode::deref; 343 using TreeScope::rootNode; 343 344 344 345 bool canContainRangeEndPoint() const final { return true; } -
trunk/Source/WebCore/dom/Node.cpp
r196998 r197887 1111 1111 } 1112 1112 1113 Node* Node::rootNode() const 1114 { 1115 if (isInTreeScope()) 1116 return &treeScope().rootNode(); 1117 1118 Node* node = const_cast<Node*>(this); 1119 Node* highest = node; 1120 for (; node; node = node->parentNode()) 1121 highest = node; 1122 return highest; 1123 } 1124 1113 1125 Node::InsertionNotificationRequest Node::insertedInto(ContainerNode& insertionPoint) 1114 1126 { -
trunk/Source/WebCore/dom/Node.h
r197566 r197887 277 277 Element* parentOrShadowHostElement() const; 278 278 void setParentNode(ContainerNode*); 279 Node* highestAncestor() const;279 Node* rootNode() const; 280 280 281 281 // Use when it's guaranteed to that shadowHost is null. -
trunk/Source/WebCore/dom/Node.idl
r197634 r197887 61 61 readonly attribute Document ownerDocument; 62 62 63 [Conditional=SHADOW_DOM, ImplementedAs=highestAncestor] readonly attribute Node treeRoot;63 readonly attribute Node rootNode; 64 64 65 65 [ObjCLegacyUnnamedParameters, Custom, RaisesException] Node insertBefore([CustomReturn] Node newChild, -
trunk/Source/WebCore/dom/ShadowRoot.h
r197563 r197887 62 62 63 63 virtual ~ShadowRoot(); 64 65 using TreeScope::rootNode; 64 66 65 67 StyleResolver& styleResolver(); -
trunk/Source/WebCore/editing/Editor.cpp
r197605 r197887 2428 2428 static void correctSpellcheckingPreservingTextCheckingParagraph(TextCheckingParagraph& paragraph, PassRefPtr<Range> rangeToReplace, const String& replacement, int resultLocation, int resultLength) 2429 2429 { 2430 ContainerNode* scope = downcast<ContainerNode>( highestAncestor(¶graph.paragraphRange()->startContainer()));2430 ContainerNode* scope = downcast<ContainerNode>(paragraph.paragraphRange()->startContainer().rootNode()); 2431 2431 2432 2432 size_t paragraphLocation; -
trunk/Source/WebCore/editing/htmlediting.cpp
r194819 r197887 796 796 } 797 797 798 Node* highestAncestor(Node* node)799 {800 ASSERT(node);801 Node* parent = node;802 while ((node = node->parentNode()))803 parent = node;804 return parent;805 }806 807 798 static Node* previousNodeConsideringAtomicNodes(const Node* node) 808 799 { -
trunk/Source/WebCore/editing/htmlediting.h
r192043 r197887 54 54 // Functions returning Node 55 55 56 Node* highestAncestor(Node*);57 56 Node* highestEditableRoot(const Position&, EditableType = ContentIsEditable); 58 57 -
trunk/Source/WebCore/html/FormAssociatedElement.cpp
r197563 r197887 83 83 } 84 84 85 // Compute the highest ancestor instead of calling Node::rootNode in removedFrom / formRemovedFromTree 86 // since inDocument flag on some form associated elements may not have been updated yet. 87 static Node* computeRootNode(Node& node) 88 { 89 Node* current = &node; 90 Node* parent = current; 91 while ((current = current->parentNode())) 92 parent = current; 93 return parent; 94 } 95 85 96 void FormAssociatedElement::removedFrom(ContainerNode& insertionPoint) 86 97 { … … 90 101 // If the form and element are both in the same tree, preserve the connection to the form. 91 102 // Otherwise, null out our form and remove ourselves from the form's list of elements. 92 if (m_form && element.highestAncestor() != m_form->highestAncestor())103 if (m_form && computeRootNode(element) != computeRootNode(*m_form)) 93 104 setForm(nullptr); 94 105 } … … 118 129 { 119 130 ASSERT(m_form); 120 if ( asHTMLElement().highestAncestor() != formRoot)131 if (computeRootNode(asHTMLElement()) != formRoot) 121 132 setForm(nullptr); 122 133 } -
trunk/Source/WebCore/xml/XPathPath.cpp
r194496 r197887 89 89 // logical treatment of where you would expect the "root" to be. 90 90 Node* context = evaluationContext.node.get(); 91 if (m_isAbsolute && !context->isDocumentNode()) { 92 if (context->inDocument()) 93 context = context->ownerDocument(); 94 else 95 context = context->highestAncestor(); 96 } 91 if (m_isAbsolute && !context->isDocumentNode()) 92 context = context->rootNode(); 97 93 98 94 NodeSet nodes;
Note: See TracChangeset
for help on using the changeset viewer.