<!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 <galineau@adobe.com> 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 <galineau@adobe.com> 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 <galineau@adobe.com>
+
+ 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 <a.badowski@samsung.com>
</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["webkitdropzone"] is
</span><span class="cx"> PASS a["hidden"] is false
</span><span class="cx"> PASS a["accessKey"] is
</span><del>-PASS a["innerHTML"] is nerget
</del><span class="cx"> PASS a["innerText"] is nerget
</span><del>-PASS a["outerHTML"] is <a id="foo" href="bar">nerget</a>
</del><span class="cx"> PASS a["outerText"] is nerget
</span><span class="cx"> PASS a["children"] is [object HTMLCollection]
</span><span class="cx"> PASS a["contentEditable"] is inherit
</span><span class="lines">@@ -50,7 +48,7 @@
</span><span class="cx"> PASS a["style"] is [object CSSStyleDeclaration]
</span><span class="cx"> PASS a["id"] is foo
</span><span class="cx"> PASS a["offsetLeft"] is 8
</span><del>-PASS a["offsetTop"] is 789
</del><ins>+PASS a["offsetTop"] is 759
</ins><span class="cx"> PASS a["offsetWidth"] is 39
</span><span class="cx"> PASS a["offsetHeight"] is 18
</span><span class="cx"> PASS a["clientLeft"] is 0
</span><span class="lines">@@ -62,6 +60,8 @@
</span><span class="cx"> PASS a["scrollWidth"] is 0
</span><span class="cx"> PASS a["scrollHeight"] is 0
</span><span class="cx"> PASS a["offsetParent"] is [object HTMLBodyElement]
</span><ins>+PASS a["innerHTML"] is nerget
+PASS a["outerHTML"] is <a id="foo" href="bar">nerget</a>
</ins><span class="cx"> PASS a["className"] is
</span><span class="cx"> PASS a["classList"] is
</span><span class="cx"> PASS a["dataset"] 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 "PASS" messages, followed by "TEST COMPLETE".
</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 <path d="M 0 0 L 259 0 259 148 0 148 z" stroke="#fff" stroke-width="1" fill="#00ff00"></path>
+
</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>+<!doctype html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+</head>
+<body>
+ <div id="console"></div>
+ <svg x="0px" y="0px" width="400px" height="300px">
+ <defs id="svg-defs"></defs>
+ <rect fill="url(#pattern)" height="148" width="259" y="1" x="1" stroke="#000000" />
+ </svg>
+ <script>
+ var defs = document.getElementById('svg-defs');
+
+ var newPattern = '<pattern id="svg-pattern" width="259" height="148" patternUnits="userSpaceOnUse"><path d="M 0 0 L 259 0 259 148 0 148 z" stroke="#fff" stroke-width="1" fill="#00ff00"></path></pattern>';
+
+ defs.innerHTML = newPattern;
+
+ var verify = document.getElementById('svg-pattern');
+ testPassed(verify.innerHTML);
+ </script>
+</body>
</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 <galineau@adobe.com>
+
+ 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 <jpfau@apple.com>
</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 "HTMLParserIdioms.h"
</span><span class="cx"> #include "HTMLSelectElement.h"
</span><span class="cx"> #include "HTMLTableRowsCollection.h"
</span><ins>+#include "HTMLTemplateElement.h"
</ins><span class="cx"> #include "InsertionPoint.h"
</span><span class="cx"> #include "KeyboardEvent.h"
</span><span class="cx"> #include "MutationObserverInterestGroup.h"
</span><span class="lines">@@ -81,6 +82,7 @@
</span><span class="cx"> #include "XMLNSNames.h"
</span><span class="cx"> #include "XMLNames.h"
</span><span class="cx"> #include "htmlediting.h"
</span><ins>+#include "markup.h"
</ins><span class="cx"> #include <wtf/BitVector.h>
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</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& node, ExceptionCode& ec)
+{
+ Node* next = node.nextSibling();
+ if (!is<Text>(next))
+ return;
</ins><span class="cx">
</span><ins>+ Ref<Text> textNode(node);
+ Ref<Text> textNext(downcast<Text>(*next));
+ textNode->appendData(textNext->data(), ec);
+ if (ec)
+ return;
+ textNext->remove(ec);
+}
+
+String Element::innerHTML() const
+{
+ return createMarkup(*this, ChildrenOnly);
+}
+
+String Element::outerHTML() const
+{
+ return createMarkup(*this);
+}
+
+void Element::setOuterHTML(const String& html, ExceptionCode& ec)
+{
+ Element* p = parentElement();
+ if (!is<HTMLElement>(p)) {
+ ec = NO_MODIFICATION_ALLOWED_ERR;
+ return;
+ }
+ RefPtr<HTMLElement> parent = downcast<HTMLElement>(p);
+ RefPtr<Node> prev = previousSibling();
+ RefPtr<Node> next = nextSibling();
+
+ RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec);
+ if (ec)
+ return;
+
+ parent->replaceChild(fragment.release(), this, ec);
+ RefPtr<Node> node = next ? next->previousSibling() : nullptr;
+ if (!ec && is<Text>(node.get()))
+ mergeWithNextTextNode(downcast<Text>(*node), ec);
+ if (!ec && is<Text>(prev.get()))
+ mergeWithNextTextNode(downcast<Text>(*prev), ec);
+}
+
+
+void Element::setInnerHTML(const String& html, ExceptionCode& ec)
+{
+ if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec)) {
+ ContainerNode* container = this;
+
+#if ENABLE(TEMPLATE_ELEMENT)
+ if (is<HTMLTemplateElement>(*this))
+ container = downcast<HTMLTemplateElement>(*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&, ExceptionCode&);
+ void setOuterHTML(const String&, ExceptionCode&);
</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& newClassString);
</span><ins>+
+ static void mergeWithNextTextNode(Text& node, ExceptionCode& 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 "HTMLFormElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLParserIdioms.h"
</span><del>-#include "HTMLTemplateElement.h"
</del><span class="cx"> #include "HTMLTextFormControlElement.h"
</span><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "RenderElement.h"
</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& html, ExceptionCode& ec)
-{
- if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec)) {
- ContainerNode* container = this;
-#if ENABLE(TEMPLATE_ELEMENT)
- if (is<HTMLTemplateElement>(*this))
- container = downcast<HTMLTemplateElement>(*this).content();
-#endif
- replaceChildrenWithFragment(*container, fragment.release(), ec);
- }
-}
-
-static void mergeWithNextTextNode(Text& node, ExceptionCode& ec)
-{
- Node* next = node.nextSibling();
- if (!is<Text>(next))
- return;
-
- Ref<Text> textNode(node);
- Ref<Text> textNext(downcast<Text>(*next));
- textNode->appendData(textNext->data(), ec);
- if (ec)
- return;
- textNext->remove(ec);
-}
-
-void HTMLElement::setOuterHTML(const String& html, ExceptionCode& ec)
-{
- Element* p = parentElement();
- if (!is<HTMLElement>(p)) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return;
- }
- RefPtr<HTMLElement> parent = downcast<HTMLElement>(p);
- RefPtr<Node> prev = previousSibling();
- RefPtr<Node> next = nextSibling();
-
- RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec);
- if (ec)
- return;
-
- parent->replaceChild(fragment.release(), this, ec);
- RefPtr<Node> node = next ? next->previousSibling() : nullptr;
- if (!ec && is<Text>(node.get()))
- mergeWithNextTextNode(downcast<Text>(*node), ec);
- if (!ec && is<Text>(prev.get()))
- mergeWithNextTextNode(downcast<Text>(*prev), ec);
-}
-
</del><span class="cx"> RefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<DocumentFragment> 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&, ExceptionCode&);
- void setOuterHTML(const String&, ExceptionCode&);
</del><span class="cx"> void setInnerText(const String&, ExceptionCode&);
</span><span class="cx"> void setOuterText(const String&, ExceptionCode&);
</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& fragment, Element* contextElement)
</span><span class="cx"> : m_fragment(&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>- && !m_tree.currentStackItem()->isInHTMLNamespace()
</del><ins>+ && !adjustedCurrentStackItem()->isInHTMLNamespace()
</ins><span class="cx"> && !HTMLElementStack::isHTMLIntegrationPoint(m_tree.currentStackItem())
</span><span class="cx"> && !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->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() && m_tree.openElements()->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->isInHTMLNamespace())
</del><ins>+ HTMLStackItem* adjustedCurrentNode = adjustedCurrentStackItem();
+ if (adjustedCurrentNode->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->type() == HTMLToken::StartTag
</span><span class="cx"> && token->name() != MathMLNames::mglyphTag
</span><span class="cx"> && token->name() != MathMLNames::malignmarkTag)
</span><span class="lines">@@ -2857,11 +2867,11 @@
</span><span class="cx"> if (token->type() == HTMLToken::Character)
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- if (item->hasTagName(MathMLNames::annotation_xmlTag)
</del><ins>+ if (adjustedCurrentNode->hasTagName(MathMLNames::annotation_xmlTag)
</ins><span class="cx"> && token->type() == HTMLToken::StartTag
</span><span class="cx"> && token->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->type() == HTMLToken::StartTag)
</span><span class="cx"> return false;
</span><span class="cx"> if (token->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->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& currentNamespace = m_tree.currentStackItem()->namespaceURI();
</del><ins>+ const AtomicString& currentNamespace = adjustedCurrentNode->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()->namespaceURI() == SVGNames::svgNamespaceURI)
</del><ins>+ if (adjustedCurrentNode->namespaceURI() == SVGNames::svgNamespaceURI)
</ins><span class="cx"> adjustSVGTagNameCase(*token);
</span><span class="cx">
</span><span class="cx"> if (token->name() == SVGNames::scriptTag && m_tree.currentStackItem()->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 "HTMLElementStack.h"
</span><span class="cx"> #include "HTMLFormattingElementList.h"
</span><span class="cx"> #include "HTMLParserOptions.h"
</span><ins>+#include "HTMLStackItem.h"
</ins><span class="cx"> #include "HTMLTokenizer.h"
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</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<Attribute> 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->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<HTMLStackItem> m_contextElementStackItem;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> bool m_framesetOk;
</span></span></pre>
</div>
</div>
</body>
</html>