<!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>[204150] 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/204150">204150</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-08-04 15:43:50 -0700 (Thu, 04 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move insertAdjacent*() API from HTMLElement to Element
https://bugs.webkit.org/show_bug.cgi?id=160567

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/domparsing/insert_adjacent_html-expected.txt:

Source/WebCore:

Move insertAdjacent*() API from HTMLElement to Element:
- https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface
- https://dom.spec.whatwg.org/#element

Firefox and Chrome both have insertAdjacentHTML() on Element.
Chrome has insertAdjacentText() / insertAdjacentElement() on Element as
well. Firefox does not have this API at all.

Also align insertAdjacentHTML() with the specification so that we
now throw a NO_MODIFICATION_ALLOWED_ERR if called with &quot;beforebegin&quot; /
&quot;afterend&quot; on a parent-less element. This is as per:
- https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml

Previously, WebKit would just silently ignore such calls. The new
behavior with consistent with both Firefox and Chrome.

No new tests, rebaselined existing tests.

* dom/Element.cpp:
(WebCore::Element::insertAdjacent):
(WebCore::Element::insertAdjacentElement):
(WebCore::contextElementForInsertion):
(WebCore::Element::insertAdjacentHTML):
(WebCore::Element::insertAdjacentText):
* dom/Element.h:
* dom/Element.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::insertAdjacent): Deleted.
(WebCore::HTMLElement::insertAdjacentElement): Deleted.
(WebCore::contextElementForInsertion): Deleted.
(WebCore::HTMLElement::insertAdjacentHTML): Deleted.
(WebCore::HTMLElement::insertAdjacentText): Deleted.
* html/HTMLElement.h:
* html/HTMLElement.idl:

LayoutTests:

Rebaseline several tests to reflect behavior change.

* fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt:
* fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js:
* fast/dynamic/insertAdjacentElement-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementinsertAdjacentHTMLerrorsexpectedtxt">trunk/LayoutTests/fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementscripttestsinsertAdjacentHTMLerrorsjs">trunk/LayoutTests/fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js</a></li>
<li><a href="#trunkLayoutTestsfastdynamicinsertAdjacentElementexpectedtxt">trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt</a></li>
<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="#trunkLayoutTestsimportedw3cwebplatformtestsdomparsinginsert_adjacent_htmlexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCoredomElementidl">trunk/Source/WebCore/dom/Element.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementcpp">trunk/Source/WebCore/html/HTMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementh">trunk/Source/WebCore/html/HTMLElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementidl">trunk/Source/WebCore/html/HTMLElement.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/ChangeLog        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-08-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move insertAdjacent*() API from HTMLElement to Element
+        https://bugs.webkit.org/show_bug.cgi?id=160567
+
+        Reviewed by Sam Weinig.
+
+        Rebaseline several tests to reflect behavior change.
+
+        * fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt:
+        * fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js:
+        * fast/dynamic/insertAdjacentElement-expected.txt:
+
</ins><span class="cx"> 2016-08-04  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Add some extra test coverage for active touch event handler on subdocuments
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementinsertAdjacentHTMLerrorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -3,8 +3,8 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS div.insertAdjacentHTML('beforeBegin', 'text') is undefined.
-PASS div.insertAdjacentHTML('afterEnd', 'text') is undefined.
</del><ins>+PASS div.insertAdjacentHTML('beforeBegin', 'text') threw exception NoModificationAllowedError (DOM Exception 7): The object can not be modified..
+PASS div.insertAdjacentHTML('afterEnd', 'text') threw exception NoModificationAllowedError (DOM Exception 7): The object can not be modified..
</ins><span class="cx"> PASS div.insertAdjacentHTML('FOO', 'text') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
</span><span class="cx"> PASS document.documentElement.insertAdjacentHTML('afterEnd', 'text') threw exception NoModificationAllowedError (DOM Exception 7): The object can not be modified..
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementscripttestsinsertAdjacentHTMLerrorsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -2,8 +2,8 @@
</span><span class="cx"> 
</span><span class="cx"> var div = document.createElement(&quot;div&quot;);
</span><span class="cx"> 
</span><del>-shouldBeUndefined(&quot;div.insertAdjacentHTML('beforeBegin', 'text')&quot;);
-shouldBeUndefined(&quot;div.insertAdjacentHTML('afterEnd', 'text')&quot;);
</del><ins>+shouldThrow(&quot;div.insertAdjacentHTML('beforeBegin', 'text')&quot;);
+shouldThrow(&quot;div.insertAdjacentHTML('afterEnd', 'text')&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldThrow(&quot;div.insertAdjacentHTML('FOO', 'text')&quot;, '&quot;SyntaxError (DOM Exception 12): The string did not match the expected pattern.&quot;');
</span><span class="cx"> shouldThrow(&quot;document.documentElement.insertAdjacentHTML('afterEnd', 'text')&quot;, '&quot;NoModificationAllowedError (DOM Exception 7): The object can not be modified.&quot;');
</span></span></pre></div>
<a id="trunkLayoutTestsfastdynamicinsertAdjacentElementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> Caught expected exception: SyntaxError (DOM Exception 12): The string did not match the expected pattern.
</span><del>-Caught expected exception: TypeError: Argument 2 ('element') to HTMLElement.insertAdjacentElement must be an instance of Element
</del><ins>+Caught expected exception: TypeError: Argument 2 ('element') to Element.insertAdjacentElement must be an instance of Element
</ins><span class="cx"> 1 (black) 2 (green) 3 (green) 4 (black) 
</span><span class="cx"> 
</span><span class="cx"> PASS
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2016-08-04  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Move insertAdjacent*() API from HTMLElement to Element
+        https://bugs.webkit.org/show_bug.cgi?id=160567
+
+        Reviewed by Sam Weinig.
+
+        Rebaseline several W3C tests now that more checks are passing.
+
+        * web-platform-tests/dom/interfaces-expected.txt:
+        * web-platform-tests/domparsing/insert_adjacent_html-expected.txt:
+
+2016-08-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         [[Prototype]] property of an interface object for a callback interface must be the Object.prototype object
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160555
</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 (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -764,8 +764,8 @@
</span><span class="cx"> PASS Element interface: operation getElementsByTagName(DOMString) 
</span><span class="cx"> PASS Element interface: operation getElementsByTagNameNS(DOMString,DOMString) 
</span><span class="cx"> PASS Element interface: operation getElementsByClassName(DOMString) 
</span><del>-FAIL Element interface: operation insertAdjacentElement(DOMString,Element) assert_own_property: interface prototype object missing non-static operation expected property &quot;insertAdjacentElement&quot; missing
-FAIL Element interface: operation insertAdjacentText(DOMString,DOMString) assert_own_property: interface prototype object missing non-static operation expected property &quot;insertAdjacentText&quot; missing
</del><ins>+PASS Element interface: operation insertAdjacentElement(DOMString,Element) 
+PASS Element interface: operation insertAdjacentText(DOMString,DOMString) 
</ins><span class="cx"> PASS Element interface: attribute children 
</span><span class="cx"> PASS Element interface: attribute firstElementChild 
</span><span class="cx"> PASS Element interface: attribute lastElementChild 
</span><span class="lines">@@ -835,10 +835,10 @@
</span><span class="cx"> PASS Element interface: calling getElementsByTagNameNS(DOMString,DOMString) on element with too few arguments must throw TypeError 
</span><span class="cx"> PASS Element interface: element must inherit property &quot;getElementsByClassName&quot; with the proper type (31) 
</span><span class="cx"> PASS Element interface: calling getElementsByClassName(DOMString) on element with too few arguments must throw TypeError 
</span><del>-FAIL Element interface: element must inherit property &quot;insertAdjacentElement&quot; with the proper type (32) assert_inherits: property &quot;insertAdjacentElement&quot; not found in prototype chain
-FAIL Element interface: calling insertAdjacentElement(DOMString,Element) on element with too few arguments must throw TypeError assert_inherits: property &quot;insertAdjacentElement&quot; not found in prototype chain
-FAIL Element interface: element must inherit property &quot;insertAdjacentText&quot; with the proper type (33) assert_inherits: property &quot;insertAdjacentText&quot; not found in prototype chain
-FAIL Element interface: calling insertAdjacentText(DOMString,DOMString) on element with too few arguments must throw TypeError assert_inherits: property &quot;insertAdjacentText&quot; not found in prototype chain
</del><ins>+PASS Element interface: element must inherit property &quot;insertAdjacentElement&quot; with the proper type (32) 
+PASS Element interface: calling insertAdjacentElement(DOMString,Element) on element with too few arguments must throw TypeError 
+PASS Element interface: element must inherit property &quot;insertAdjacentText&quot; with the proper type (33) 
+PASS Element interface: calling insertAdjacentText(DOMString,DOMString) on element with too few arguments must throw TypeError 
</ins><span class="cx"> PASS Element interface: element must inherit property &quot;children&quot; with the proper type (34) 
</span><span class="cx"> PASS Element interface: element must inherit property &quot;firstElementChild&quot; with the proper type (35) 
</span><span class="cx"> PASS Element interface: element must inherit property &quot;lastElementChild&quot; with the proper type (36) 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomparsinginsert_adjacent_htmlexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-expected.txt (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-expected.txt        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/insert_adjacent_html-expected.txt        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -8,9 +8,9 @@
</span><span class="cx"> PASS BeforeEnd content again, with next sibling 
</span><span class="cx"> PASS afterend content again, with next sibling 
</span><span class="cx"> PASS Should throw when inserting with invalid position string 
</span><del>-FAIL When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (text) assert_throws: function &quot;function () { element.insertAdjacentHTML(&quot;afterend&quot;, &quot;&quot;) }&quot; did not throw
-FAIL When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (comments) assert_throws: function &quot;function () { element.insertAdjacentHTML(&quot;afterend&quot;, &quot;&lt;!-...&quot; did not throw
-FAIL When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (elements) assert_throws: function &quot;function () { element.insertAdjacentHTML(&quot;afterend&quot;, &quot;&lt;di...&quot; did not throw
</del><ins>+PASS When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (text) 
+PASS When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (comments) 
+PASS When the parent node is null, insertAdjacentHTML should throw for beforebegin and afterend (elements) 
</ins><span class="cx"> PASS When the parent node is a document, insertAdjacentHTML should throw for beforebegin and afterend (text) 
</span><span class="cx"> PASS When the parent node is a document, insertAdjacentHTML should throw for beforebegin and afterend (comments) 
</span><span class="cx"> PASS When the parent node is a document, insertAdjacentHTML should throw for beforebegin and afterend (elements) 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/ChangeLog        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2016-08-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move insertAdjacent*() API from HTMLElement to Element
+        https://bugs.webkit.org/show_bug.cgi?id=160567
+
+        Reviewed by Sam Weinig.
+
+        Move insertAdjacent*() API from HTMLElement to Element:
+        - https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface
+        - https://dom.spec.whatwg.org/#element
+
+        Firefox and Chrome both have insertAdjacentHTML() on Element.
+        Chrome has insertAdjacentText() / insertAdjacentElement() on Element as
+        well. Firefox does not have this API at all.
+
+        Also align insertAdjacentHTML() with the specification so that we
+        now throw a NO_MODIFICATION_ALLOWED_ERR if called with &quot;beforebegin&quot; /
+        &quot;afterend&quot; on a parent-less element. This is as per:
+        - https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml
+
+        Previously, WebKit would just silently ignore such calls. The new
+        behavior with consistent with both Firefox and Chrome.
+
+        No new tests, rebaselined existing tests.
+
+        * dom/Element.cpp:
+        (WebCore::Element::insertAdjacent):
+        (WebCore::Element::insertAdjacentElement):
+        (WebCore::contextElementForInsertion):
+        (WebCore::Element::insertAdjacentHTML):
+        (WebCore::Element::insertAdjacentText):
+        * dom/Element.h:
+        * dom/Element.idl:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::insertAdjacent): Deleted.
+        (WebCore::HTMLElement::insertAdjacentElement): Deleted.
+        (WebCore::contextElementForInsertion): Deleted.
+        (WebCore::HTMLElement::insertAdjacentHTML): Deleted.
+        (WebCore::HTMLElement::insertAdjacentText): Deleted.
+        * html/HTMLElement.h:
+        * html/HTMLElement.idl:
+
</ins><span class="cx"> 2016-08-04  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Another build fix attempt.
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -3481,4 +3481,74 @@
</span><span class="cx">     return URL(base, attribute.value()).string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+Node* Element::insertAdjacent(const String&amp; where, Ref&lt;Node&gt;&amp;&amp; newChild, ExceptionCode&amp; ec)
+{
+    // In Internet Explorer if the element has no parent and where is &quot;beforeBegin&quot; or &quot;afterEnd&quot;,
+    // a document fragment is created and the elements appended in the correct order. This document
+    // fragment isn't returned anywhere.
+    //
+    // This is impossible for us to implement as the DOM tree does not allow for such structures,
+    // Opera also appears to disallow such usage.
+
+    if (equalLettersIgnoringASCIICase(where, &quot;beforebegin&quot;)) {
+        ContainerNode* parent = this-&gt;parentNode();
+        return (parent &amp;&amp; parent-&gt;insertBefore(newChild, this, ec)) ? newChild.ptr() : nullptr;
+    }
+
+    if (equalLettersIgnoringASCIICase(where, &quot;afterbegin&quot;))
+        return insertBefore(newChild, firstChild(), ec) ? newChild.ptr() : nullptr;
+
+    if (equalLettersIgnoringASCIICase(where, &quot;beforeend&quot;))
+        return appendChild(newChild, ec) ? newChild.ptr() : nullptr;
+
+    if (equalLettersIgnoringASCIICase(where, &quot;afterend&quot;)) {
+        ContainerNode* parent = this-&gt;parentNode();
+        return (parent &amp;&amp; parent-&gt;insertBefore(newChild, nextSibling(), ec)) ? newChild.ptr() : nullptr;
+    }
+
+    ec = SYNTAX_ERR;
+    return nullptr;
+}
+
+Element* Element::insertAdjacentElement(const String&amp; where, Element&amp; newChild, ExceptionCode&amp; ec)
+{
+    Node* returnValue = insertAdjacent(where, newChild, ec);
+    ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || is&lt;Element&gt;(*returnValue));
+    return downcast&lt;Element&gt;(returnValue);
+}
+
+// Step 1 of https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml.
+static Element* contextElementForInsertion(const String&amp; where, Element* element, ExceptionCode&amp; ec)
+{
+    if (equalLettersIgnoringASCIICase(where, &quot;beforebegin&quot;) || equalLettersIgnoringASCIICase(where, &quot;afterend&quot;)) {
+        auto* parent = element-&gt;parentElement();
+        if (!parent) {
+            ec = NO_MODIFICATION_ALLOWED_ERR;
+            return nullptr;
+        }
+        return parent;
+    }
+    if (equalLettersIgnoringASCIICase(where, &quot;afterbegin&quot;) || equalLettersIgnoringASCIICase(where, &quot;beforeend&quot;))
+        return element;
+    ec =  SYNTAX_ERR;
+    return nullptr;
+}
+
+void Element::insertAdjacentHTML(const String&amp; where, const String&amp; markup, ExceptionCode&amp; ec)
+{
+    Element* contextElement = contextElementForInsertion(where, this, ec);
+    if (!contextElement)
+        return;
+    RefPtr&lt;DocumentFragment&gt; fragment = createFragmentForInnerOuterHTML(*contextElement, markup, AllowScriptingContent, ec);
+    if (!fragment)
+        return;
+    insertAdjacent(where, fragment.releaseNonNull(), ec);
+}
+
+void Element::insertAdjacentText(const String&amp; where, const String&amp; text, ExceptionCode&amp; ec)
+{
+    insertAdjacent(where, document().createTextNode(text), ec);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/dom/Element.h        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -295,6 +295,10 @@
</span><span class="cx">     void setTabIndex(int);
</span><span class="cx">     virtual Element* focusDelegate();
</span><span class="cx"> 
</span><ins>+    Element* insertAdjacentElement(const String&amp; where, Element&amp; newChild, ExceptionCode&amp;);
+    void insertAdjacentHTML(const String&amp; where, const String&amp; html, ExceptionCode&amp;);
+    void insertAdjacentText(const String&amp; where, const String&amp; text, ExceptionCode&amp;);
+
</ins><span class="cx">     const RenderStyle* computedStyle(PseudoId = NOPSEUDO) override;
</span><span class="cx"> 
</span><span class="cx">     bool needsStyleInvalidation() const;
</span><span class="lines">@@ -590,6 +594,8 @@
</span><span class="cx">     void updateIdForDocument(HTMLDocument&amp;, const AtomicString&amp; oldId, const AtomicString&amp; newId, HTMLDocumentNamedItemMapsUpdatingCondition);
</span><span class="cx">     void updateLabel(TreeScope&amp;, const AtomicString&amp; oldForAttributeValue, const AtomicString&amp; newForAttributeValue);
</span><span class="cx"> 
</span><ins>+    Node* insertAdjacent(const String&amp; where, Ref&lt;Node&gt;&amp;&amp; newChild, ExceptionCode&amp;);
+
</ins><span class="cx">     void scrollByUnits(int units, ScrollGranularity);
</span><span class="cx"> 
</span><span class="cx">     void setPrefix(const AtomicString&amp;, ExceptionCode&amp;) final;
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.idl (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.idl        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/dom/Element.idl        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -143,6 +143,10 @@
</span><span class="cx">     [Reflect] attribute DOMString uiactions;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    [RaisesException] Element insertAdjacentElement(DOMString where, Element element);
+    [RaisesException] void insertAdjacentHTML(DOMString where, DOMString html);
+    [RaisesException] void insertAdjacentText(DOMString where, DOMString text);
+
</ins><span class="cx">     [Conditional=POINTER_LOCK] void requestPointerLock();
</span><span class="cx"> 
</span><span class="cx">     // CSS Regions API
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -630,76 +630,6 @@
</span><span class="cx">         mergeWithNextTextNode(downcast&lt;Text&gt;(*prev), ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* HTMLElement::insertAdjacent(const String&amp; where, Ref&lt;Node&gt;&amp;&amp; newChild, ExceptionCode&amp; ec)
-{
-    // In Internet Explorer if the element has no parent and where is &quot;beforeBegin&quot; or &quot;afterEnd&quot;,
-    // a document fragment is created and the elements appended in the correct order. This document
-    // fragment isn't returned anywhere.
-    //
-    // This is impossible for us to implement as the DOM tree does not allow for such structures,
-    // Opera also appears to disallow such usage.
-
-    if (equalLettersIgnoringASCIICase(where, &quot;beforebegin&quot;)) {
-        ContainerNode* parent = this-&gt;parentNode();
-        return (parent &amp;&amp; parent-&gt;insertBefore(newChild, this, ec)) ? newChild.ptr() : nullptr;
-    }
-
-    if (equalLettersIgnoringASCIICase(where, &quot;afterbegin&quot;))
-        return insertBefore(newChild, firstChild(), ec) ? newChild.ptr() : nullptr;
-
-    if (equalLettersIgnoringASCIICase(where, &quot;beforeend&quot;))
-        return appendChild(newChild, ec) ? newChild.ptr() : nullptr;
-
-    if (equalLettersIgnoringASCIICase(where, &quot;afterend&quot;)) {
-        ContainerNode* parent = this-&gt;parentNode();
-        return (parent &amp;&amp; parent-&gt;insertBefore(newChild, nextSibling(), ec)) ? newChild.ptr() : nullptr;
-    }
-    
-    ec = SYNTAX_ERR;
-    return nullptr;
-}
-
-Element* HTMLElement::insertAdjacentElement(const String&amp; where, Element&amp; newChild, ExceptionCode&amp; ec)
-{
-    Node* returnValue = insertAdjacent(where, newChild, ec);
-    ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || is&lt;Element&gt;(*returnValue));
-    return downcast&lt;Element&gt;(returnValue); 
-}
-
-// Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#insertadjacenthtml()
-static Element* contextElementForInsertion(const String&amp; where, Element* element, ExceptionCode&amp; ec)
-{
-    if (equalLettersIgnoringASCIICase(where, &quot;beforebegin&quot;) || equalLettersIgnoringASCIICase(where, &quot;afterend&quot;)) {
-        ContainerNode* parent = element-&gt;parentNode();
-        if (parent &amp;&amp; !is&lt;Element&gt;(*parent)) {
-            ec = NO_MODIFICATION_ALLOWED_ERR;
-            return nullptr;
-        }
-        ASSERT_WITH_SECURITY_IMPLICATION(!parent || is&lt;Element&gt;(*parent));
-        return downcast&lt;Element&gt;(parent);
-    }
-    if (equalLettersIgnoringASCIICase(where, &quot;afterbegin&quot;) || equalLettersIgnoringASCIICase(where, &quot;beforeend&quot;))
-        return element;
-    ec =  SYNTAX_ERR;
-    return nullptr;
-}
-
-void HTMLElement::insertAdjacentHTML(const String&amp; where, const String&amp; markup, ExceptionCode&amp; ec)
-{
-    Element* contextElement = contextElementForInsertion(where, this, ec);
-    if (!contextElement)
-        return;
-    RefPtr&lt;DocumentFragment&gt; fragment = createFragmentForInnerOuterHTML(*contextElement, markup, AllowScriptingContent, ec);
-    if (!fragment)
-        return;
-    insertAdjacent(where, fragment.releaseNonNull(), ec);
-}
-
-void HTMLElement::insertAdjacentText(const String&amp; where, const String&amp; text, ExceptionCode&amp; ec)
-{
-    insertAdjacent(where, document().createTextNode(text), ec);
-}
-
</del><span class="cx"> void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString&amp; alignment, MutableStyleProperties&amp; style)
</span><span class="cx"> {
</span><span class="cx">     // Vertical alignment with respect to the current baseline of the text
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.h (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.h        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/html/HTMLElement.h        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -49,10 +49,6 @@
</span><span class="cx">     void setInnerText(const String&amp;, ExceptionCode&amp;);
</span><span class="cx">     void setOuterText(const String&amp;, ExceptionCode&amp;);
</span><span class="cx"> 
</span><del>-    Element* insertAdjacentElement(const String&amp; where, Element&amp; newChild, ExceptionCode&amp;);
-    void insertAdjacentHTML(const String&amp; where, const String&amp; html, ExceptionCode&amp;);
-    void insertAdjacentText(const String&amp; where, const String&amp; text, ExceptionCode&amp;);
-
</del><span class="cx">     virtual bool hasCustomFocusLogic() const;
</span><span class="cx">     bool supportsFocus() const override;
</span><span class="cx"> 
</span><span class="lines">@@ -130,7 +126,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual HTMLFormElement* virtualForm() const;
</span><span class="cx"> 
</span><del>-    Node* insertAdjacent(const String&amp; where, Ref&lt;Node&gt;&amp;&amp; newChild, ExceptionCode&amp;);
</del><span class="cx">     Ref&lt;DocumentFragment&gt; textToFragment(const String&amp;, ExceptionCode&amp;);
</span><span class="cx"> 
</span><span class="cx">     void dirAttributeChanged(const AtomicString&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.idl (204149 => 204150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.idl        2016-08-04 22:38:18 UTC (rev 204149)
+++ trunk/Source/WebCore/html/HTMLElement.idl        2016-08-04 22:43:50 UTC (rev 204150)
</span><span class="lines">@@ -44,11 +44,6 @@
</span><span class="cx">     [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString innerText;
</span><span class="cx">     [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString outerText;
</span><span class="cx"> 
</span><del>-    [RaisesException] Element insertAdjacentElement(DOMString where, Element element);
-
-    [RaisesException] void insertAdjacentHTML(DOMString where, DOMString html);
-    [RaisesException] void insertAdjacentText(DOMString where, DOMString text);
-
</del><span class="cx">     [SetterRaisesException] attribute DOMString contentEditable;
</span><span class="cx">     readonly attribute boolean isContentEditable;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>