<!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  &lt;cdumez@apple.com&gt;
</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  &lt;cdumez@apple.com&gt;
+
</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 &quot;getRootNode&quot; 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 &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: new Document() must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: new Document() must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: new Document() must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on new Document() with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: new Document() must inherit property &quot;getRootNode&quot; 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 &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: new Document() must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: new Document() must inherit property &quot;hasChildNodes&quot; with the proper type (20) 
</span><span class="lines">@@ -481,8 +481,8 @@
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: xmlDoc must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: xmlDoc must inherit property &quot;getRootNode&quot; 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 &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: xmlDoc must inherit property &quot;hasChildNodes&quot; 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 &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: document.doctype must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: document.doctype must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: document.doctype must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.doctype with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: document.doctype must inherit property &quot;getRootNode&quot; 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 &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: document.doctype must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: document.doctype must inherit property &quot;hasChildNodes&quot; 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 &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: document.createDocumentFragment() must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.createDocumentFragment() with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: document.createDocumentFragment() must inherit property &quot;getRootNode&quot; 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 &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: document.createDocumentFragment() must inherit property &quot;hasChildNodes&quot; with the proper type (20) 
</span><span class="lines">@@ -892,8 +892,8 @@
</span><span class="cx"> PASS Node interface: element must inherit property &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: element must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: element must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: element must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on element with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: element must inherit property &quot;getRootNode&quot; 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 &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: element must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: element must inherit property &quot;hasChildNodes&quot; with the proper type (20) 
</span><span class="lines">@@ -992,8 +992,8 @@
</span><span class="cx"> PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.querySelector(&quot;[id]&quot;).attributes[0] with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;getRootNode&quot; with the proper type (17) 
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.querySelector(&quot;[id]&quot;).attributes[0] with too few arguments must throw TypeError 
</ins><span class="cx"> PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: document.querySelector(&quot;[id]&quot;).attributes[0] must inherit property &quot;hasChildNodes&quot; with the proper type (20) 
</span><span class="lines">@@ -1111,8 +1111,8 @@
</span><span class="cx"> PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.createTextNode(&quot;abc&quot;) with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;getRootNode&quot; with the proper type (17) 
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createTextNode(&quot;abc&quot;) with too few arguments must throw TypeError 
</ins><span class="cx"> PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: document.createTextNode(&quot;abc&quot;) must inherit property &quot;hasChildNodes&quot; with the proper type (20) 
</span><span class="lines">@@ -1212,8 +1212,8 @@
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;getRootNode&quot; with the proper type (17) 
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) with too few arguments must throw TypeError 
</ins><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: xmlDoc.createProcessingInstruction(&quot;abc&quot;, &quot;def&quot;) must inherit property &quot;hasChildNodes&quot; with the proper type (20) 
</span><span class="lines">@@ -1306,8 +1306,8 @@
</span><span class="cx"> PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;baseURI&quot; with the proper type (14) 
</span><span class="cx"> PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;isConnected&quot; with the proper type (15) 
</span><span class="cx"> PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;ownerDocument&quot; with the proper type (16) 
</span><del>-FAIL Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;getRootNode&quot; with the proper type (17) assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
-FAIL Node interface: calling getRootNode(GetRootNodeOptions) on document.createComment(&quot;abc&quot;) with too few arguments must throw TypeError assert_inherits: property &quot;getRootNode&quot; not found in prototype chain
</del><ins>+PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;getRootNode&quot; with the proper type (17) 
+PASS Node interface: calling getRootNode(GetRootNodeOptions) on document.createComment(&quot;abc&quot;) with too few arguments must throw TypeError 
</ins><span class="cx"> PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;parentNode&quot; with the proper type (18) 
</span><span class="cx"> PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;parentElement&quot; with the proper type (19) 
</span><span class="cx"> PASS Node interface: document.createComment(&quot;abc&quot;) must inherit property &quot;hasChildNodes&quot; 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  &lt;cdumez@apple.com&gt;
+
+        [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  &lt;beidson@apple.com&gt;
</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 &amp;&amp; !relatedNode.inDocument() &amp;&amp; !target.inDocument()) {
</span><span class="cx">         Node&amp; targetAncestorInDocumentScope = i ? *downcast&lt;ShadowRoot&gt;(m_ancestorTreeScopes[i - 1]-&gt;rootNode()).shadowHost() : target;
</span><span class="cx">         Node&amp; relatedNodeAncestorInDocumentScope = j ? *downcast&lt;ShadowRoot&gt;(targetTreeScopeAncestors[j - 1]-&gt;rootNode()).shadowHost() : relatedNode;
</span><del>-        if (targetAncestorInDocumentScope.rootNode() != relatedNodeAncestorInDocumentScope.rootNode()) {
</del><ins>+        if (&amp;targetAncestorInDocumentScope.rootNode() != &amp;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&amp; base = currentTarget;
</span><span class="cx">     for (Node* targetAncestor = &amp;m_relatedNode; targetAncestor; targetAncestor = targetAncestor-&gt;parentOrShadowHostNode()) {
</span><del>-        if (targetAncestor-&gt;rootNode()-&gt;containsIncludingShadowDOM(&amp;base)) {
</del><ins>+        if (targetAncestor-&gt;rootNode().containsIncludingShadowDOM(&amp;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&lt;Element&gt;(parent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* Node::rootNode() const
</del><ins>+Node&amp; Node::rootNode() const
</ins><span class="cx"> {
</span><span class="cx">     if (isInTreeScope())
</span><del>-        return &amp;treeScope().rootNode();
</del><ins>+        return treeScope().rootNode();
</ins><span class="cx"> 
</span><span class="cx">     Node* node = const_cast&lt;Node*&gt;(this);
</span><span class="cx">     Node* highest = node;
</span><span class="cx">     for (; node; node = node-&gt;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&amp; Node::shadowIncludingRoot() const
+{
+    auto&amp; root = rootNode();
+    if (!is&lt;ShadowRoot&gt;(root))
+        return root;
+    auto* host = downcast&lt;ShadowRoot&gt;(root).host();
+    return host ? host-&gt;shadowIncludingRoot() : root;
+}
+
+Node&amp; Node::getRootNode(const GetRootNodeOptions&amp; options) const
+{
+    return options.composed ? shadowIncludingRoot() : rootNode();
+}
+
</ins><span class="cx"> Node::InsertionNotificationRequest Node::insertedInto(ContainerNode&amp; 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&amp; rootNode() const;
+    Node&amp; shadowIncludingRoot() const;
</ins><span class="cx"> 
</span><ins>+    struct GetRootNodeOptions {
+        bool composed;
+    };
+    Node&amp; getRootNode(const GetRootNodeOptions&amp;) 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&amp; paragraph, PassRefPtr&lt;Range&gt; rangeToReplace, const String&amp; replacement, int resultLocation, int resultLength)
</span><span class="cx"> {
</span><del>-    ContainerNode* scope = downcast&lt;ContainerNode&gt;(paragraph.paragraphRange()-&gt;startContainer().rootNode());
</del><ins>+    auto&amp; scope = downcast&lt;ContainerNode&gt;(paragraph.paragraphRange()-&gt;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(&amp;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 &lt;rdar://10305315&gt;, http://webkit.org/b/89526.
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Range&gt; newParagraphRange = TextIterator::rangeFromLocationAndLength(scope, paragraphLocation, paragraphLength + replacement.length() - resultLength);
</del><ins>+    RefPtr&lt;Range&gt; newParagraphRange = TextIterator::rangeFromLocationAndLength(&amp;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 &quot;root&quot; to be.
</span><span class="cx">     Node* context = evaluationContext.node.get();
</span><span class="cx">     if (m_isAbsolute &amp;&amp; !context-&gt;isDocumentNode())
</span><del>-        context = context-&gt;rootNode();
</del><ins>+        context = &amp;context-&gt;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>