<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206285] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206285">206285</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-09-22 18:54:05 -0700 (Thu, 22 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[ShadowDOM] Add support for Node.getRootNode(options)
https://bugs.webkit.org/show_bug.cgi?id=162457
Reviewed by Ryosuke Niwa.
LayoutTests/imported/w3c:
Rebaseline existing W3C DOM tests now that more checks are passing.
* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/dom/nodes/rootNode-expected.txt:
Source/WebCore:
Add support for Node.getRootNode(options):
- https://dom.spec.whatwg.org/#dom-node-getrootnode
No new tests, rebaselined existing tests.
* dom/EventPath.cpp:
(WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter):
(WebCore::RelatedNodeRetargeter::checkConsistency):
* dom/Node.cpp:
(WebCore::Node::rootNode):
(WebCore::Node::shadowIncludingRoot):
(WebCore::Node::getRootNode):
* dom/Node.h:
* dom/Node.idl:
* editing/Editor.cpp:
(WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
* xml/XPathPath.cpp:
(WebCore::XPath::LocationPath::evaluate):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdominterfacesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomnodesrootNodeexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/rootNode-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomEventPathcpp">trunk/Source/WebCore/dom/EventPath.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodecpp">trunk/Source/WebCore/dom/Node.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeidl">trunk/Source/WebCore/dom/Node.idl</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathPathcpp">trunk/Source/WebCore/xml/XPathPath.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2016-09-22 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ [ShadowDOM] Add support for Node.getRootNode(options)
+ https://bugs.webkit.org/show_bug.cgi?id=162457
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline existing W3C DOM tests now that more checks are passing.
+
+ * web-platform-tests/dom/interfaces-expected.txt:
+ * web-platform-tests/dom/nodes/rootNode-expected.txt:
+
+2016-09-22 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Fix serialization of HTML void elements when they have children
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=162418
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdominterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx"> PASS Node interface: attribute baseURI
</span><span class="cx"> PASS Node interface: attribute isConnected
</span><span class="cx"> PASS Node interface: attribute ownerDocument
</span><del>-FAIL Node interface: operation getRootNode(GetRootNodeOptions) assert_own_property: interface prototype object missing non-static operation expected property "getRootNode" missing
</del><ins>+PASS Node interface: operation getRootNode(GetRootNodeOptions)
</ins><span class="cx"> PASS Node interface: attribute parentNode
</span><span class="cx"> PASS Node interface: attribute parentElement
</span><span class="cx"> PASS Node interface: operation hasChildNodes()
</span><span class="lines">@@ -349,8 +349,8 @@
</span><span class="cx"> PASS Node interface: new Document() must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: new Document() must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: new Document() must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: new Document() must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-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
</del><ins>+PASS Node interface: new Document() must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on new Document() with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: new Document() must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: new Document() must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: new Document() must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -481,8 +481,8 @@
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: xmlDoc must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain
</del><ins>+PASS Node interface: xmlDoc must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: xmlDoc must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -589,8 +589,8 @@
</span><span class="cx"> PASS Node interface: document.doctype must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: document.doctype must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: document.doctype must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: document.doctype must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-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
</del><ins>+PASS Node interface: document.doctype must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.doctype with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: document.doctype must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: document.doctype must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: document.doctype must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -685,8 +685,8 @@
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: document.createDocumentFragment() must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-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
</del><ins>+PASS Node interface: document.createDocumentFragment() must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createDocumentFragment() with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -892,8 +892,8 @@
</span><span class="cx"> PASS Node interface: element must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: element must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: element must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: element must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on element with too few arguments must throw TypeError assert_inherits: property "getRootNode" not found in prototype chain
</del><ins>+PASS Node interface: element must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on element with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: element must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: element must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: element must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -992,8 +992,8 @@
</span><span class="cx"> PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "ownerDocument" with the proper type (16)
</span><del>-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
-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
</del><ins>+PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.querySelector("[id]").attributes[0] with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: document.querySelector("[id]").attributes[0] must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -1111,8 +1111,8 @@
</span><span class="cx"> PASS Node interface: document.createTextNode("abc") must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: document.createTextNode("abc") must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: document.createTextNode("abc") must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-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
</del><ins>+PASS Node interface: document.createTextNode("abc") must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createTextNode("abc") with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: document.createTextNode("abc") must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: document.createTextNode("abc") must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: document.createTextNode("abc") must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -1212,8 +1212,8 @@
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "ownerDocument" with the proper type (16)
</span><del>-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
-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
</del><ins>+PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "hasChildNodes" with the proper type (20)
</span><span class="lines">@@ -1306,8 +1306,8 @@
</span><span class="cx"> PASS Node interface: document.createComment("abc") must inherit property "baseURI" with the proper type (14)
</span><span class="cx"> PASS Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15)
</span><span class="cx"> PASS Node interface: document.createComment("abc") must inherit property "ownerDocument" with the proper type (16)
</span><del>-FAIL Node interface: document.createComment("abc") must inherit property "getRootNode" with the proper type (17) assert_inherits: property "getRootNode" not found in prototype chain
-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
</del><ins>+PASS Node interface: document.createComment("abc") must inherit property "getRootNode" with the proper type (17)
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createComment("abc") with too few arguments must throw TypeError
</ins><span class="cx"> PASS Node interface: document.createComment("abc") must inherit property "parentNode" with the proper type (18)
</span><span class="cx"> PASS Node interface: document.createComment("abc") must inherit property "parentElement" with the proper type (19)
</span><span class="cx"> PASS Node interface: document.createComment("abc") must inherit property "hasChildNodes" with the proper type (20)
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomnodesrootNodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/rootNode-expected.txt (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/rootNode-expected.txt        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/rootNode-expected.txt        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx">
</span><del>-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)
-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)
-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)
-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)
</del><ins>+PASS getRootNode() must return the context object when it does not have any parent
+PASS getRootNode() must return the parent node of the context object when the context object has a single ancestor not in a document
+PASS getRootNode() must return the document when a node is in document
+PASS getRootNode() must return a document fragment when a node is in the fragment
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/ChangeLog        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-09-22 Chris Dumez <cdumez@apple.com>
+
+ [ShadowDOM] Add support for Node.getRootNode(options)
+ https://bugs.webkit.org/show_bug.cgi?id=162457
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support for Node.getRootNode(options):
+ - https://dom.spec.whatwg.org/#dom-node-getrootnode
+
+ No new tests, rebaselined existing tests.
+
+ * dom/EventPath.cpp:
+ (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter):
+ (WebCore::RelatedNodeRetargeter::checkConsistency):
+ * dom/Node.cpp:
+ (WebCore::Node::rootNode):
+ (WebCore::Node::shadowIncludingRoot):
+ (WebCore::Node::getRootNode):
+ * dom/Node.h:
+ * dom/Node.idl:
+ * editing/Editor.cpp:
+ (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
+ * xml/XPathPath.cpp:
+ (WebCore::XPath::LocationPath::evaluate):
+
</ins><span class="cx"> 2016-09-22 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> IDBIndex.openCursor() matches indices on multiple object stores.
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventPathcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventPath.cpp (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventPath.cpp        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/dom/EventPath.cpp        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -290,7 +290,7 @@
</span><span class="cx"> if (lowestCommonAncestorIsDocumentScope && !relatedNode.inDocument() && !target.inDocument()) {
</span><span class="cx"> Node& targetAncestorInDocumentScope = i ? *downcast<ShadowRoot>(m_ancestorTreeScopes[i - 1]->rootNode()).shadowHost() : target;
</span><span class="cx"> Node& relatedNodeAncestorInDocumentScope = j ? *downcast<ShadowRoot>(targetTreeScopeAncestors[j - 1]->rootNode()).shadowHost() : relatedNode;
</span><del>- if (targetAncestorInDocumentScope.rootNode() != relatedNodeAncestorInDocumentScope.rootNode()) {
</del><ins>+ if (&targetAncestorInDocumentScope.rootNode() != &relatedNodeAncestorInDocumentScope.rootNode()) {
</ins><span class="cx"> m_hasDifferentTreeRoot = true;
</span><span class="cx"> m_retargetedRelatedNode = moveOutOfAllShadowRoots(relatedNode);
</span><span class="cx"> return;
</span><span class="lines">@@ -365,7 +365,7 @@
</span><span class="cx"> // http://w3c.github.io/webcomponents/spec/shadow/#dfn-retargeting-algorithm
</span><span class="cx"> Node& base = currentTarget;
</span><span class="cx"> for (Node* targetAncestor = &m_relatedNode; targetAncestor; targetAncestor = targetAncestor->parentOrShadowHostNode()) {
</span><del>- if (targetAncestor->rootNode()->containsIncludingShadowDOM(&base)) {
</del><ins>+ if (targetAncestor->rootNode().containsIncludingShadowDOM(&base)) {
</ins><span class="cx"> ASSERT(m_retargetedRelatedNode == targetAncestor);
</span><span class="cx"> return;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.cpp (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.cpp        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/dom/Node.cpp        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -1163,18 +1163,33 @@
</span><span class="cx"> return downcast<Element>(parent);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Node* Node::rootNode() const
</del><ins>+Node& Node::rootNode() const
</ins><span class="cx"> {
</span><span class="cx"> if (isInTreeScope())
</span><del>- return &treeScope().rootNode();
</del><ins>+ return treeScope().rootNode();
</ins><span class="cx">
</span><span class="cx"> Node* node = const_cast<Node*>(this);
</span><span class="cx"> Node* highest = node;
</span><span class="cx"> for (; node; node = node->parentNode())
</span><span class="cx"> highest = node;
</span><del>- return highest;
</del><ins>+ return *highest;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+// https://dom.spec.whatwg.org/#concept-shadow-including-root
+Node& Node::shadowIncludingRoot() const
+{
+ auto& root = rootNode();
+ if (!is<ShadowRoot>(root))
+ return root;
+ auto* host = downcast<ShadowRoot>(root).host();
+ return host ? host->shadowIncludingRoot() : root;
+}
+
+Node& Node::getRootNode(const GetRootNodeOptions& options) const
+{
+ return options.composed ? shadowIncludingRoot() : rootNode();
+}
+
</ins><span class="cx"> Node::InsertionNotificationRequest Node::insertedInto(ContainerNode& insertionPoint)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(insertionPoint.inDocument() || isContainerNode());
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/dom/Node.h        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -273,8 +273,14 @@
</span><span class="cx"> ContainerNode* parentInComposedTree() const;
</span><span class="cx"> Element* parentOrShadowHostElement() const;
</span><span class="cx"> void setParentNode(ContainerNode*);
</span><del>- Node* rootNode() const;
</del><ins>+ Node& rootNode() const;
+ Node& shadowIncludingRoot() const;
</ins><span class="cx">
</span><ins>+ struct GetRootNodeOptions {
+ bool composed;
+ };
+ Node& getRootNode(const GetRootNodeOptions&) const;
+
</ins><span class="cx"> // Use when it's guaranteed to that shadowHost is null.
</span><span class="cx"> ContainerNode* parentNodeGuaranteedHostFree() const;
</span><span class="cx"> // Returns the parent node, but null if the parent node is a ShadowRoot.
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.idl (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.idl        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/dom/Node.idl        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -90,7 +90,12 @@
</span><span class="cx">
</span><span class="cx"> boolean contains(Node? other);
</span><span class="cx">
</span><ins>+ [EnabledAtRuntime=ShadowDOM] Node getRootNode(optional GetRootNodeOptions options);
</ins><span class="cx"> [EnabledAtRuntime=ShadowDOM, ImplementedAs=inDocument] readonly attribute boolean isConnected;
</span><span class="cx">
</span><span class="cx"> readonly attribute Element parentElement;
</span><span class="cx"> };
</span><ins>+
+dictionary GetRootNodeOptions {
+ boolean composed = false;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/editing/Editor.cpp        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -2470,11 +2470,11 @@
</span><span class="cx">
</span><span class="cx"> static void correctSpellcheckingPreservingTextCheckingParagraph(TextCheckingParagraph& paragraph, PassRefPtr<Range> rangeToReplace, const String& replacement, int resultLocation, int resultLength)
</span><span class="cx"> {
</span><del>- ContainerNode* scope = downcast<ContainerNode>(paragraph.paragraphRange()->startContainer().rootNode());
</del><ins>+ auto& scope = downcast<ContainerNode>(paragraph.paragraphRange()->startContainer().rootNode());
</ins><span class="cx">
</span><span class="cx"> size_t paragraphLocation;
</span><span class="cx"> size_t paragraphLength;
</span><del>- TextIterator::getLocationAndLengthFromRange(scope, paragraph.paragraphRange().get(), paragraphLocation, paragraphLength);
</del><ins>+ TextIterator::getLocationAndLengthFromRange(&scope, paragraph.paragraphRange().get(), paragraphLocation, paragraphLength);
</ins><span class="cx">
</span><span class="cx"> applyCommand(SpellingCorrectionCommand::create(rangeToReplace, replacement));
</span><span class="cx">
</span><span class="lines">@@ -2481,7 +2481,7 @@
</span><span class="cx"> // TextCheckingParagraph may be orphaned after SpellingCorrectionCommand mutated DOM.
</span><span class="cx"> // See <rdar://10305315>, http://webkit.org/b/89526.
</span><span class="cx">
</span><del>- RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocationAndLength(scope, paragraphLocation, paragraphLength + replacement.length() - resultLength);
</del><ins>+ RefPtr<Range> newParagraphRange = TextIterator::rangeFromLocationAndLength(&scope, paragraphLocation, paragraphLength + replacement.length() - resultLength);
</ins><span class="cx">
</span><span class="cx"> paragraph = TextCheckingParagraph(TextIterator::subrange(newParagraphRange.get(), resultLocation, replacement.length()), newParagraphRange);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathPathcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathPath.cpp (206284 => 206285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathPath.cpp        2016-09-23 01:15:53 UTC (rev 206284)
+++ trunk/Source/WebCore/xml/XPathPath.cpp        2016-09-23 01:54:05 UTC (rev 206285)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> // logical treatment of where you would expect the "root" to be.
</span><span class="cx"> Node* context = evaluationContext.node.get();
</span><span class="cx"> if (m_isAbsolute && !context->isDocumentNode())
</span><del>- context = context->rootNode();
</del><ins>+ context = &context->rootNode();
</ins><span class="cx">
</span><span class="cx"> NodeSet nodes;
</span><span class="cx"> nodes.append(context);
</span></span></pre>
</div>
</div>
</body>
</html>