<!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>[176630] 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/176630">176630</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-12-02 02:50:11 -0800 (Tue, 02 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/WebCore:
Missing support for innerHTML on SVGElement
https://bugs.webkit.org/show_bug.cgi?id=136903

Patch by Sylvain Galineau &lt;galineau@adobe.com&gt; on 2014-12-02
Reviewed by Dean Jackson.

Two parts to this patch:
1. Move innerHTML/outerHTML to Element so SVG elements can inherit them, per https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#innerhtml
2. Make sure fragment insertion is processed relative to the proper node, per http://www.whatwg.org/specs/web-apps/current-work/#adjusted-current-node

The latter part was ported over from Blink.

Test: svg/in-html/svg-inner-html.html

* bindings/objc/PublicDOMInterfaces.h: Move innerHTML/outerHTML to Element.
* dom/Element.cpp:
(WebCore::Element::mergeWithNextTextNode): Helper used by Element::innerHTML/outerHTML as well as HTMLElement::innerText/outerText; moved to Element as protected static.
(WebCore::Element::innerHTML): Moved from HTMLElement.
(WebCore::Element::outerHTML): Moved from HTMLElement.
(WebCore::Element::setOuterHTML): Moved from HTMLElement.
(WebCore::Element::setInnerHTML): Moved from HTMLElement.
* dom/Element.h:
* dom/Element.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::innerHTML): Deleted.
(WebCore::HTMLElement::outerHTML): Deleted.
(WebCore::HTMLElement::setInnerHTML): Deleted.
(WebCore::mergeWithNextTextNode): Deleted.
(WebCore::HTMLElement::setOuterHTML): Deleted.
* html/HTMLElement.h:
* html/HTMLElement.idl:
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext): no more m_contextElement.
(WebCore::HTMLTreeBuilder::constructTree): read namespace from adjusted current node.
(WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately): use contextElementStackItem for insertion.
(WebCore::HTMLTreeBuilder::adjustedCurrentStackItem): compute adjusted current node.
(WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): use adjusted current node for context.
(WebCore::HTMLTreeBuilder::processTokenInForeignContent): use adjusted current node to read namespace.
* html/parser/HTMLTreeBuilder.h:
(WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElement): Deleted. Read from contextElementStackItem.
(WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElementStackItem): Added.

LayoutTests:
    Missing support for innerHTML on SVGElement
    https://bugs.webkit.org/show_bug.cgi?id=136903

Patch by Sylvain Galineau &lt;galineau@adobe.com&gt; on 2014-12-02
Reviewed by Dean Jackson.

* js/dom/dom-static-property-for-in-iteration-expected.txt: The property enumeration order is different now that inner/outerHTML are inherited from Element
* platform/mac/svg/in-html/svg-inner-html-expected.png: Added.
* svg/css/svg-attribute-length-parsing-expected.txt:
Now that innerHTML works, the output should start with 'Test'
* svg/in-html/svg-inner-html-expected.txt: Added.
* svg/in-html/svg-inner-html.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsdomdomstaticpropertyforiniterationexpectedtxt">trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgcsssvgattributelengthparsingexpectedtxt">trunk/LayoutTests/svg/css/svg-attribute-length-parsing-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcPublicDOMInterfacesh">trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h</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>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTreeBuildercpp">trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTreeBuilderh">trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvginhtmlsvginnerhtmlexpectedtxt">trunk/LayoutTests/svg/in-html/svg-inner-html-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvginhtmlsvginnerhtmlhtml">trunk/LayoutTests/svg/in-html/svg-inner-html.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/LayoutTests/ChangeLog        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-12-02  Sylvain Galineau  &lt;galineau@adobe.com&gt;
+
+    Missing support for innerHTML on SVGElement
+    https://bugs.webkit.org/show_bug.cgi?id=136903
+
+        Reviewed by Dean Jackson.
+
+        * js/dom/dom-static-property-for-in-iteration-expected.txt: The property enumeration order is different now that inner/outerHTML are inherited from Element
+        * platform/mac/svg/in-html/svg-inner-html-expected.png: Added.
+        * svg/css/svg-attribute-length-parsing-expected.txt:
+        Now that innerHTML works, the output should start with 'Test'
+        * svg/in-html/svg-inner-html-expected.txt: Added.
+        * svg/in-html/svg-inner-html.html: Added.
+
</ins><span class="cx"> 2014-12-02  Andrzej Badowski  &lt;a.badowski@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r176122): [GTK] Layout Test platform/gtk/accessibility/table-hierarchy.html fails.
</span></span></pre></div>
<a id="trunkLayoutTestsjsdomdomstaticpropertyforiniterationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -37,9 +37,7 @@
</span><span class="cx"> PASS a[&quot;webkitdropzone&quot;] is 
</span><span class="cx"> PASS a[&quot;hidden&quot;] is false
</span><span class="cx"> PASS a[&quot;accessKey&quot;] is 
</span><del>-PASS a[&quot;innerHTML&quot;] is nerget
</del><span class="cx"> PASS a[&quot;innerText&quot;] is nerget
</span><del>-PASS a[&quot;outerHTML&quot;] is &lt;a id=&quot;foo&quot; href=&quot;bar&quot;&gt;nerget&lt;/a&gt;
</del><span class="cx"> PASS a[&quot;outerText&quot;] is nerget
</span><span class="cx"> PASS a[&quot;children&quot;] is [object HTMLCollection]
</span><span class="cx"> PASS a[&quot;contentEditable&quot;] is inherit
</span><span class="lines">@@ -50,7 +48,7 @@
</span><span class="cx"> PASS a[&quot;style&quot;] is [object CSSStyleDeclaration]
</span><span class="cx"> PASS a[&quot;id&quot;] is foo
</span><span class="cx"> PASS a[&quot;offsetLeft&quot;] is 8
</span><del>-PASS a[&quot;offsetTop&quot;] is 789
</del><ins>+PASS a[&quot;offsetTop&quot;] is 759
</ins><span class="cx"> PASS a[&quot;offsetWidth&quot;] is 39
</span><span class="cx"> PASS a[&quot;offsetHeight&quot;] is 18
</span><span class="cx"> PASS a[&quot;clientLeft&quot;] is 0
</span><span class="lines">@@ -62,6 +60,8 @@
</span><span class="cx"> PASS a[&quot;scrollWidth&quot;] is 0
</span><span class="cx"> PASS a[&quot;scrollHeight&quot;] is 0
</span><span class="cx"> PASS a[&quot;offsetParent&quot;] is [object HTMLBodyElement]
</span><ins>+PASS a[&quot;innerHTML&quot;] is nerget
+PASS a[&quot;outerHTML&quot;] is &lt;a id=&quot;foo&quot; href=&quot;bar&quot;&gt;nerget&lt;/a&gt;
</ins><span class="cx"> PASS a[&quot;className&quot;] is 
</span><span class="cx"> PASS a[&quot;classList&quot;] is 
</span><span class="cx"> PASS a[&quot;dataset&quot;] is [object DOMStringMap]
</span></span></pre></div>
<a id="trunkLayoutTestssvgcsssvgattributelengthparsingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/css/svg-attribute-length-parsing-expected.txt (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/css/svg-attribute-length-parsing-expected.txt        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/LayoutTests/svg/css/svg-attribute-length-parsing-expected.txt        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+Test
</ins><span class="cx"> Test CSS parsing on SVG presentation attributes.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span></span></pre></div>
<a id="trunkLayoutTestssvginhtmlsvginnerhtmlexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/in-html/svg-inner-html-expected.txt (0 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/in-html/svg-inner-html-expected.txt                                (rev 0)
+++ trunk/LayoutTests/svg/in-html/svg-inner-html-expected.txt        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+PASS &lt;path d=&quot;M 0 0 L 259 0 259 148 0 148 z&quot; stroke=&quot;#fff&quot; stroke-width=&quot;1&quot; fill=&quot;#00ff00&quot;&gt;&lt;/path&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvginhtmlsvginnerhtmlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/in-html/svg-inner-html.html (0 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/in-html/svg-inner-html.html                                (rev 0)
+++ trunk/LayoutTests/svg/in-html/svg-inner-html.html        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+    if (window.testRunner)
+       testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;svg x=&quot;0px&quot; y=&quot;0px&quot; width=&quot;400px&quot; height=&quot;300px&quot;&gt;
+            &lt;defs id=&quot;svg-defs&quot;&gt;&lt;/defs&gt;
+            &lt;rect fill=&quot;url(#pattern)&quot; height=&quot;148&quot; width=&quot;259&quot; y=&quot;1&quot; x=&quot;1&quot; stroke=&quot;#000000&quot; /&gt;
+    &lt;/svg&gt;
+    &lt;script&gt;
+        var defs = document.getElementById('svg-defs');
+
+        var newPattern = '&lt;pattern id=&quot;svg-pattern&quot; width=&quot;259&quot; height=&quot;148&quot; patternUnits=&quot;userSpaceOnUse&quot;&gt;&lt;path d=&quot;M 0 0 L 259 0 259 148 0 148 z&quot; stroke=&quot;#fff&quot; stroke-width=&quot;1&quot; fill=&quot;#00ff00&quot;&gt;&lt;/path&gt;&lt;/pattern&gt;';
+
+        defs.innerHTML = newPattern;
+
+        var verify = document.getElementById('svg-pattern');
+        testPassed(verify.innerHTML);
+    &lt;/script&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/ChangeLog        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2014-12-02  Sylvain Galineau  &lt;galineau@adobe.com&gt;
+
+        Missing support for innerHTML on SVGElement
+        https://bugs.webkit.org/show_bug.cgi?id=136903
+
+        Reviewed by Dean Jackson.
+
+        Two parts to this patch:
+        1. Move innerHTML/outerHTML to Element so SVG elements can inherit them, per https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#innerhtml
+        2. Make sure fragment insertion is processed relative to the proper node, per http://www.whatwg.org/specs/web-apps/current-work/#adjusted-current-node
+
+        The latter part was ported over from Blink. 
+
+        Test: svg/in-html/svg-inner-html.html
+
+        * bindings/objc/PublicDOMInterfaces.h: Move innerHTML/outerHTML to Element.
+        * dom/Element.cpp:
+        (WebCore::Element::mergeWithNextTextNode): Helper used by Element::innerHTML/outerHTML as well as HTMLElement::innerText/outerText; moved to Element as protected static.
+        (WebCore::Element::innerHTML): Moved from HTMLElement.
+        (WebCore::Element::outerHTML): Moved from HTMLElement.
+        (WebCore::Element::setOuterHTML): Moved from HTMLElement.
+        (WebCore::Element::setInnerHTML): Moved from HTMLElement.
+        * dom/Element.h: 
+        * dom/Element.idl:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::innerHTML): Deleted.
+        (WebCore::HTMLElement::outerHTML): Deleted.
+        (WebCore::HTMLElement::setInnerHTML): Deleted.
+        (WebCore::mergeWithNextTextNode): Deleted.
+        (WebCore::HTMLElement::setOuterHTML): Deleted.
+        * html/HTMLElement.h:
+        * html/HTMLElement.idl:
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext): no more m_contextElement.
+        (WebCore::HTMLTreeBuilder::constructTree): read namespace from adjusted current node.
+        (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately): use contextElementStackItem for insertion.
+        (WebCore::HTMLTreeBuilder::adjustedCurrentStackItem): compute adjusted current node.
+        (WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): use adjusted current node for context.
+        (WebCore::HTMLTreeBuilder::processTokenInForeignContent): use adjusted current node to read namespace.
+        * html/parser/HTMLTreeBuilder.h:
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElement): Deleted. Read from contextElementStackItem.
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElementStackItem): Added.
+
</ins><span class="cx"> 2014-11-20  Jeffrey Pfau  &lt;jpfau@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add cancelable version of willSendRequest
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcPublicDOMInterfacesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -195,6 +195,8 @@
</span><span class="cx"> @property (readonly) int clientLeft WEBKIT_AVAILABLE_MAC(10_5);
</span><span class="cx"> @property (readonly) int clientTop WEBKIT_AVAILABLE_MAC(10_5);
</span><span class="cx"> @property (readonly, copy) NSString *innerText WEBKIT_AVAILABLE_MAC(10_5);
</span><ins>+@property (copy) NSString *innerHTML;
+@property (copy) NSString *outerHTML;
</ins><span class="cx"> @property (readonly, strong) DOMElement *firstElementChild WEBKIT_AVAILABLE_MAC(10_6);
</span><span class="cx"> @property (readonly, strong) DOMElement *lastElementChild WEBKIT_AVAILABLE_MAC(10_6);
</span><span class="cx"> @property (readonly, strong) DOMElement *previousElementSibling WEBKIT_AVAILABLE_MAC(10_6);
</span><span class="lines">@@ -476,9 +478,7 @@
</span><span class="cx"> @property (copy) NSString *idName;
</span><span class="cx"> @property (copy) NSString *lang;
</span><span class="cx"> @property (copy) NSString *dir;
</span><del>-@property (copy) NSString *innerHTML;
</del><span class="cx"> @property (copy) NSString *innerText;
</span><del>-@property (copy) NSString *outerHTML;
</del><span class="cx"> @property (copy) NSString *outerText;
</span><span class="cx"> @property (readonly, strong) DOMHTMLCollection *children;
</span><span class="cx"> @property (copy) NSString *contentEditable;
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/dom/Element.cpp        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><span class="cx"> #include &quot;HTMLSelectElement.h&quot;
</span><span class="cx"> #include &quot;HTMLTableRowsCollection.h&quot;
</span><ins>+#include &quot;HTMLTemplateElement.h&quot;
</ins><span class="cx"> #include &quot;InsertionPoint.h&quot;
</span><span class="cx"> #include &quot;KeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;MutationObserverInterestGroup.h&quot;
</span><span class="lines">@@ -81,6 +82,7 @@
</span><span class="cx"> #include &quot;XMLNSNames.h&quot;
</span><span class="cx"> #include &quot;XMLNames.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><ins>+#include &quot;markup.h&quot;
</ins><span class="cx"> #include &lt;wtf/BitVector.h&gt;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="lines">@@ -2022,7 +2024,68 @@
</span><span class="cx">     EventDispatcher::dispatchEvent(this, event.release());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Element::mergeWithNextTextNode(Text&amp; node, ExceptionCode&amp; ec)
+{
+    Node* next = node.nextSibling();
+    if (!is&lt;Text&gt;(next))
+        return;
</ins><span class="cx"> 
</span><ins>+    Ref&lt;Text&gt; textNode(node);
+    Ref&lt;Text&gt; textNext(downcast&lt;Text&gt;(*next));
+    textNode-&gt;appendData(textNext-&gt;data(), ec);
+    if (ec)
+        return;
+    textNext-&gt;remove(ec);
+}
+
+String Element::innerHTML() const
+{
+    return createMarkup(*this, ChildrenOnly);
+}
+
+String Element::outerHTML() const
+{
+    return createMarkup(*this);
+}
+
+void Element::setOuterHTML(const String&amp; html, ExceptionCode&amp; ec)
+{
+    Element* p = parentElement();
+    if (!is&lt;HTMLElement&gt;(p)) {
+        ec = NO_MODIFICATION_ALLOWED_ERR;
+        return;
+    }
+    RefPtr&lt;HTMLElement&gt; parent = downcast&lt;HTMLElement&gt;(p);
+    RefPtr&lt;Node&gt; prev = previousSibling();
+    RefPtr&lt;Node&gt; next = nextSibling();
+
+    RefPtr&lt;DocumentFragment&gt; fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec);
+    if (ec)
+        return;
+    
+    parent-&gt;replaceChild(fragment.release(), this, ec);
+    RefPtr&lt;Node&gt; node = next ? next-&gt;previousSibling() : nullptr;
+    if (!ec &amp;&amp; is&lt;Text&gt;(node.get()))
+        mergeWithNextTextNode(downcast&lt;Text&gt;(*node), ec);
+    if (!ec &amp;&amp; is&lt;Text&gt;(prev.get()))
+        mergeWithNextTextNode(downcast&lt;Text&gt;(*prev), ec);
+}
+
+
+void Element::setInnerHTML(const String&amp; html, ExceptionCode&amp; ec)
+{
+    if (RefPtr&lt;DocumentFragment&gt; fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec)) {
+        ContainerNode* container = this;
+
+#if ENABLE(TEMPLATE_ELEMENT)
+        if (is&lt;HTMLTemplateElement&gt;(*this))
+            container = downcast&lt;HTMLTemplateElement&gt;(*this).content();
+#endif
+
+        replaceChildrenWithFragment(*container, fragment.release(), ec);
+    }
+}
+
</ins><span class="cx"> String Element::innerText()
</span><span class="cx"> {
</span><span class="cx">     // We need to update layout, since plainText uses line boxes in the render tree.
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/dom/Element.h        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -395,6 +395,10 @@
</span><span class="cx">     virtual void updateFocusAppearance(bool restorePreviousSelection);
</span><span class="cx">     virtual void blur();
</span><span class="cx"> 
</span><ins>+    String innerHTML() const;
+    String outerHTML() const;
+    void setInnerHTML(const String&amp;, ExceptionCode&amp;);
+    void setOuterHTML(const String&amp;, ExceptionCode&amp;);
</ins><span class="cx">     WEBCORE_EXPORT String innerText();
</span><span class="cx">     String outerText();
</span><span class="cx">  
</span><span class="lines">@@ -572,6 +576,8 @@
</span><span class="cx">     // parseAttribute (called via setAttribute()) and
</span><span class="cx">     // svgAttributeChanged (called when element.className.baseValue is set)
</span><span class="cx">     void classAttributeChanged(const AtomicString&amp; newClassString);
</span><ins>+    
+    static void mergeWithNextTextNode(Text&amp; node, ExceptionCode&amp; ec);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     bool isTextNode() const;
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.idl (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.idl        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/dom/Element.idl        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -108,6 +108,9 @@
</span><span class="cx"> 
</span><span class="cx">     // HTML 5
</span><span class="cx">     NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
</span><ins>+    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
+    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
+             
</ins><span class="cx"> 
</span><span class="cx">     [Reflect=class] attribute DOMString className;
</span><span class="cx">     readonly attribute DOMTokenList classList;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -48,7 +48,6 @@
</span><span class="cx"> #include &quot;HTMLFormElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><del>-#include &quot;HTMLTemplateElement.h&quot;
</del><span class="cx"> #include &quot;HTMLTextFormControlElement.h&quot;
</span><span class="cx"> #include &quot;NodeTraversal.h&quot;
</span><span class="cx"> #include &quot;RenderElement.h&quot;
</span><span class="lines">@@ -414,65 +413,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String HTMLElement::innerHTML() const
-{
-    return createMarkup(*this, ChildrenOnly);
-}
-
-String HTMLElement::outerHTML() const
-{
-    return createMarkup(*this);
-}
-
-void HTMLElement::setInnerHTML(const String&amp; html, ExceptionCode&amp; ec)
-{
-    if (RefPtr&lt;DocumentFragment&gt; fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec)) {
-        ContainerNode* container = this;
-#if ENABLE(TEMPLATE_ELEMENT)
-        if (is&lt;HTMLTemplateElement&gt;(*this))
-            container = downcast&lt;HTMLTemplateElement&gt;(*this).content();
-#endif
-        replaceChildrenWithFragment(*container, fragment.release(), ec);
-    }
-}
-
-static void mergeWithNextTextNode(Text&amp; node, ExceptionCode&amp; ec)
-{
-    Node* next = node.nextSibling();
-    if (!is&lt;Text&gt;(next))
-        return;
-
-    Ref&lt;Text&gt; textNode(node);
-    Ref&lt;Text&gt; textNext(downcast&lt;Text&gt;(*next));
-    textNode-&gt;appendData(textNext-&gt;data(), ec);
-    if (ec)
-        return;
-    textNext-&gt;remove(ec);
-}
-
-void HTMLElement::setOuterHTML(const String&amp; html, ExceptionCode&amp; ec)
-{
-    Element* p = parentElement();
-    if (!is&lt;HTMLElement&gt;(p)) {
-        ec = NO_MODIFICATION_ALLOWED_ERR;
-        return;
-    }
-    RefPtr&lt;HTMLElement&gt; parent = downcast&lt;HTMLElement&gt;(p);
-    RefPtr&lt;Node&gt; prev = previousSibling();
-    RefPtr&lt;Node&gt; next = nextSibling();
-
-    RefPtr&lt;DocumentFragment&gt; fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec);
-    if (ec)
-        return;
-      
-    parent-&gt;replaceChild(fragment.release(), this, ec);
-    RefPtr&lt;Node&gt; node = next ? next-&gt;previousSibling() : nullptr;
-    if (!ec &amp;&amp; is&lt;Text&gt;(node.get()))
-        mergeWithNextTextNode(downcast&lt;Text&gt;(*node), ec);
-    if (!ec &amp;&amp; is&lt;Text&gt;(prev.get()))
-        mergeWithNextTextNode(downcast&lt;Text&gt;(*prev), ec);
-}
-
</del><span class="cx"> RefPtr&lt;DocumentFragment&gt; HTMLElement::textToFragment(const String&amp; text, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;DocumentFragment&gt; fragment = DocumentFragment::create(document());
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.h (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.h        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/html/HTMLElement.h        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -48,10 +48,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual short tabIndex() const override;
</span><span class="cx"> 
</span><del>-    String innerHTML() const;
-    String outerHTML() const;
-    void setInnerHTML(const String&amp;, ExceptionCode&amp;);
-    void setOuterHTML(const String&amp;, ExceptionCode&amp;);
</del><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></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.idl (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.idl        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/html/HTMLElement.idl        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -38,11 +38,9 @@
</span><span class="cx">              [Reflect] attribute DOMString accessKey;
</span><span class="cx"> 
</span><span class="cx">     // Extensions
</span><del>-             [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
-             [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerText;
-             [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
-             [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerText;
-
</del><ins>+    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerText;
+    [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerText;
+             
</ins><span class="cx">     [RaisesException] Element insertAdjacentElement([Default=Undefined] optional DOMString where,
</span><span class="cx">                                   [Default=Undefined] optional Element element);
</span><span class="cx">     [RaisesException] void insertAdjacentHTML([Default=Undefined] optional DOMString where,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTreeBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -320,15 +320,14 @@
</span><span class="cx"> 
</span><span class="cx"> HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext()
</span><span class="cx">     : m_fragment(0)
</span><del>-    , m_contextElement(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext(DocumentFragment&amp; fragment, Element* contextElement)
</span><span class="cx">     : m_fragment(&amp;fragment)
</span><del>-    , m_contextElement(contextElement)
</del><span class="cx"> {
</span><span class="cx">     ASSERT(!fragment.hasChildNodes());
</span><ins>+    m_contextElementStackItem = HTMLStackItem::create(contextElement, HTMLStackItem::ItemForContextElement);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HTMLTreeBuilder::FragmentParsingContext::~FragmentParsingContext()
</span><span class="lines">@@ -356,7 +355,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_parser.tokenizer()) {
</span><span class="cx">         bool inForeignContent = !m_tree.isEmpty()
</span><del>-            &amp;&amp; !m_tree.currentStackItem()-&gt;isInHTMLNamespace()
</del><ins>+            &amp;&amp; !adjustedCurrentStackItem()-&gt;isInHTMLNamespace()
</ins><span class="cx">             &amp;&amp; !HTMLElementStack::isHTMLIntegrationPoint(m_tree.currentStackItem())
</span><span class="cx">             &amp;&amp; !HTMLElementStack::isMathMLTextIntegrationPoint(m_tree.currentStackItem());
</span><span class="cx"> 
</span><span class="lines">@@ -1617,7 +1616,7 @@
</span><span class="cx">             bool shouldCreateItem = true;
</span><span class="cx"> #endif
</span><span class="cx">             if (shouldCreateItem)
</span><del>-                item = HTMLStackItem::create(m_fragmentContext.contextElement(), HTMLStackItem::ItemForContextElement);
</del><ins>+                item = m_fragmentContext.contextElementStackItem();
</ins><span class="cx">         }
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">         if (item-&gt;hasTagName(templateTag))
</span><span class="lines">@@ -2840,16 +2839,27 @@
</span><span class="cx"> 
</span><span class="cx">     setInsertionMode(InsertionMode::Text);
</span><span class="cx"> }
</span><ins>+    
+// http://www.whatwg.org/specs/web-apps/current-work/#adjusted-current-node
+HTMLStackItem* HTMLTreeBuilder::adjustedCurrentStackItem() const
+{
+    ASSERT(!m_tree.isEmpty());
+    if (isParsingFragment() &amp;&amp; m_tree.openElements()-&gt;hasOnlyOneElement())
+        return m_fragmentContext.contextElementStackItem();
+        
+    return m_tree.currentStackItem();
+}
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#tree-construction
</span><span class="cx"> bool HTMLTreeBuilder::shouldProcessTokenInForeignContent(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><span class="cx">     if (m_tree.isEmpty())
</span><span class="cx">         return false;
</span><del>-    HTMLStackItem* item = m_tree.currentStackItem();
-    if (item-&gt;isInHTMLNamespace())
</del><ins>+    HTMLStackItem* adjustedCurrentNode = adjustedCurrentStackItem();
+    if (adjustedCurrentNode-&gt;isInHTMLNamespace())
</ins><span class="cx">         return false;
</span><del>-    if (HTMLElementStack::isMathMLTextIntegrationPoint(item)) {
</del><ins>+    if (HTMLElementStack::isMathMLTextIntegrationPoint(adjustedCurrentNode)) {
</ins><span class="cx">         if (token-&gt;type() == HTMLToken::StartTag
</span><span class="cx">             &amp;&amp; token-&gt;name() != MathMLNames::mglyphTag
</span><span class="cx">             &amp;&amp; token-&gt;name() != MathMLNames::malignmarkTag)
</span><span class="lines">@@ -2857,11 +2867,11 @@
</span><span class="cx">         if (token-&gt;type() == HTMLToken::Character)
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><del>-    if (item-&gt;hasTagName(MathMLNames::annotation_xmlTag)
</del><ins>+    if (adjustedCurrentNode-&gt;hasTagName(MathMLNames::annotation_xmlTag)
</ins><span class="cx">         &amp;&amp; token-&gt;type() == HTMLToken::StartTag
</span><span class="cx">         &amp;&amp; token-&gt;name() == SVGNames::svgTag)
</span><span class="cx">         return false;
</span><del>-    if (HTMLElementStack::isHTMLIntegrationPoint(item)) {
</del><ins>+    if (HTMLElementStack::isHTMLIntegrationPoint(adjustedCurrentNode)) {
</ins><span class="cx">         if (token-&gt;type() == HTMLToken::StartTag)
</span><span class="cx">             return false;
</span><span class="cx">         if (token-&gt;type() == HTMLToken::Character)
</span><span class="lines">@@ -2874,6 +2884,8 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTreeBuilder::processTokenInForeignContent(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><ins>+    HTMLStackItem* adjustedCurrentNode = adjustedCurrentStackItem();
+    
</ins><span class="cx">     switch (token-&gt;type()) {
</span><span class="cx">     case HTMLToken::Uninitialized:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="lines">@@ -2927,7 +2939,7 @@
</span><span class="cx">             processStartTag(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        const AtomicString&amp; currentNamespace = m_tree.currentStackItem()-&gt;namespaceURI();
</del><ins>+        const AtomicString&amp; currentNamespace = adjustedCurrentNode-&gt;namespaceURI();
</ins><span class="cx">         if (currentNamespace == MathMLNames::mathmlNamespaceURI)
</span><span class="cx">             adjustMathMLAttributes(*token);
</span><span class="cx">         if (currentNamespace == SVGNames::svgNamespaceURI) {
</span><span class="lines">@@ -2939,7 +2951,7 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case HTMLToken::EndTag: {
</span><del>-        if (m_tree.currentStackItem()-&gt;namespaceURI() == SVGNames::svgNamespaceURI)
</del><ins>+        if (adjustedCurrentNode-&gt;namespaceURI() == SVGNames::svgNamespaceURI)
</ins><span class="cx">             adjustSVGTagNameCase(*token);
</span><span class="cx"> 
</span><span class="cx">         if (token-&gt;name() == SVGNames::scriptTag &amp;&amp; m_tree.currentStackItem()-&gt;hasTagName(SVGNames::scriptTag)) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTreeBuilderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h (176629 => 176630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h        2014-12-02 10:36:47 UTC (rev 176629)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h        2014-12-02 10:50:11 UTC (rev 176630)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;HTMLElementStack.h&quot;
</span><span class="cx"> #include &quot;HTMLFormattingElementList.h&quot;
</span><span class="cx"> #include &quot;HTMLParserOptions.h&quot;
</span><ins>+#include &quot;HTMLStackItem.h&quot;
</ins><span class="cx"> #include &quot;HTMLTokenizer.h&quot;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="lines">@@ -170,6 +171,8 @@
</span><span class="cx"> 
</span><span class="cx">     inline bool shouldProcessTokenInForeignContent(AtomicHTMLToken*);
</span><span class="cx">     void processTokenInForeignContent(AtomicHTMLToken*);
</span><ins>+    
+    inline HTMLStackItem* adjustedCurrentStackItem() const;
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;Attribute&gt; attributesForIsindexInput(AtomicHTMLToken*);
</span><span class="cx"> 
</span><span class="lines">@@ -201,11 +204,12 @@
</span><span class="cx">         ~FragmentParsingContext();
</span><span class="cx"> 
</span><span class="cx">         DocumentFragment* fragment() const { return m_fragment; }
</span><del>-        Element* contextElement() const { ASSERT(m_fragment); return m_contextElement; }
</del><ins>+        Element* contextElement() const { ASSERT(m_fragment); return m_contextElementStackItem-&gt;element(); }
+        HTMLStackItem* contextElementStackItem() const { ASSERT(m_fragment); return m_contextElementStackItem.get(); }
</ins><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         DocumentFragment* m_fragment;
</span><del>-        Element* m_contextElement;
</del><ins>+        RefPtr&lt;HTMLStackItem&gt; m_contextElementStackItem;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     bool m_framesetOk;
</span></span></pre>
</div>
</div>

</body>
</html>