<!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>[204235] 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/204235">204235</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-08-06 19:43:53 -0700 (Sat, 06 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Align Range.createContextualFragment() input validation with the specification
https://bugs.webkit.org/show_bug.cgi?id=160634

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/domparsing/createContextualFragment-expected.txt:

Source/WebCore:

Align Range.createContextualFragment() input validation with the specification:
- https://w3c.github.io/DOM-Parsing/#idl-def-range-createcontextualfragment(domstring) (Step 2)

In particular, we were throwing a NOT_SUPPORTED_ERR when element had localname
&quot;html&quot; but was not in the HTML namespace. We should not throw in this case.

Firefox complies with the specification here.

No new tests, rebaselined existing test.

* dom/Range.cpp:
(WebCore::Range::createContextualFragment): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomparsingcreateContextualFragmentexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-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="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingmarkupcpp">trunk/Source/WebCore/editing/markup.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingmarkuph">trunk/Source/WebCore/editing/markup.h</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2016-08-06  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Align Range.createContextualFragment() input validation with the specification
+        https://bugs.webkit.org/show_bug.cgi?id=160634
+
+        Reviewed by Darin Adler.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/domparsing/createContextualFragment-expected.txt:
+
+2016-08-06  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         [Web IDL] Add support for [Unscopable] extended attribute
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160637
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomparsingcreateContextualFragmentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -7,8 +7,8 @@
</span><span class="cx"> PASS &lt;html&gt; and &lt;body&gt; must work the same, 1 
</span><span class="cx"> PASS &lt;html&gt; and &lt;body&gt; must work the same, 2 
</span><span class="cx"> PASS Implicit &lt;body&gt; creation 
</span><del>-FAIL Namespace generally shouldn't matter The operation is not supported.
-FAIL &lt;html&gt; in a different namespace shouldn't be special The operation is not supported.
</del><ins>+PASS Namespace generally shouldn't matter 
+PASS &lt;html&gt; in a different namespace shouldn't be special 
</ins><span class="cx"> PASS null should be stringified 
</span><span class="cx"> PASS undefined should be stringified 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/ChangeLog        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2016-08-06  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Align Range.createContextualFragment() input validation with the specification
+        https://bugs.webkit.org/show_bug.cgi?id=160634
+
+        Reviewed by Darin Adler.
+
+        Align Range.createContextualFragment() input validation with the specification:
+        - https://w3c.github.io/DOM-Parsing/#idl-def-range-createcontextualfragment(domstring) (Step 2)
+
+        In particular, we were throwing a NOT_SUPPORTED_ERR when element had localname
+        &quot;html&quot; but was not in the HTML namespace. We should not throw in this case.
+
+        Firefox complies with the specification here.
+
+        No new tests, rebaselined existing test.
+
+        * dom/Range.cpp:
+        (WebCore::Range::createContextualFragment): Deleted.
+
+2016-08-06  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         [Web IDL] Add support for [Unscopable] extended attribute
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160637
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -3481,6 +3481,44 @@
</span><span class="cx">     return URL(base, attribute.value()).string();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool Element::ieForbidsInsertHTML() const
+{
+    // FIXME: Supposedly IE disallows setting innerHTML, outerHTML
+    // and createContextualFragment on these tags. We have no tests to
+    // verify this however, so this list could be totally wrong.
+    // This list was moved from the previous endTagRequirement() implementation.
+    // This is also called from editing and assumed to be the list of tags
+    // for which no end tag should be serialized. It's unclear if the list for
+    // IE compat and the list for serialization sanity are the same.
+    if (hasTagName(areaTag)
+        || hasTagName(baseTag)
+        || hasTagName(basefontTag)
+        || hasTagName(brTag)
+        || hasTagName(colTag)
+        || hasTagName(embedTag)
+        || hasTagName(frameTag)
+        || hasTagName(hrTag)
+        || hasTagName(imageTag)
+        || hasTagName(imgTag)
+        || hasTagName(inputTag)
+        || hasTagName(isindexTag)
+        || hasTagName(linkTag)
+        || hasTagName(metaTag)
+        || hasTagName(paramTag)
+        || hasTagName(sourceTag)
+        || hasTagName(wbrTag))
+        return true;
+    // FIXME: I'm not sure why dashboard mode would want to change the
+    // serialization of &lt;canvas&gt;, that seems like a bad idea.
+#if ENABLE(DASHBOARD_SUPPORT)
+    if (hasTagName(canvasTag)) {
+        Settings* settings = document().settings();
+        if (settings &amp;&amp; settings-&gt;usesDashboardBackwardCompatibilityMode())
+            return true;
+    }
+#endif
+    return false;
+}
</ins><span class="cx"> 
</span><span class="cx"> Node* Element::insertAdjacent(const String&amp; where, Ref&lt;Node&gt;&amp;&amp; newChild, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/dom/Element.h        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -299,6 +299,8 @@
</span><span class="cx">     void insertAdjacentHTML(const String&amp; where, const String&amp; html, ExceptionCode&amp;);
</span><span class="cx">     void insertAdjacentText(const String&amp; where, const String&amp; text, ExceptionCode&amp;);
</span><span class="cx"> 
</span><ins>+    bool ieForbidsInsertHTML() const;
+
</ins><span class="cx">     const RenderStyle* computedStyle(PseudoId = NOPSEUDO) override;
</span><span class="cx"> 
</span><span class="cx">     bool needsStyleInvalidation() const;
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/dom/Range.cpp        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -916,12 +916,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (!element || (is&lt;HTMLDocument&gt;(element-&gt;document()) &amp;&amp; is&lt;HTMLHtmlElement&gt;(*element)))
</span><span class="cx">         element = HTMLBodyElement::create(node.document());
</span><del>-    else if (!is&lt;HTMLElement&gt;(*element)) {
-        ec = NOT_SUPPORTED_ERR;
-        return nullptr;
-    }
</del><span class="cx"> 
</span><del>-    return WebCore::createContextualFragment(downcast&lt;HTMLElement&gt;(*element), markup, AllowScriptingContentAndDoNotMarkAlreadyStarted, ec);
</del><ins>+    return WebCore::createContextualFragment(*element, markup, AllowScriptingContentAndDoNotMarkAlreadyStarted, ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/editing/markup.cpp        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -951,7 +951,7 @@
</span><span class="cx">     fragment.removeChild(element, ASSERT_NO_EXCEPTION);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;DocumentFragment&gt; createContextualFragment(HTMLElement&amp; element, const String&amp; markup, ParserContentPolicy parserContentPolicy, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;DocumentFragment&gt; createContextualFragment(Element&amp; element, const String&amp; markup, ParserContentPolicy parserContentPolicy, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (element.ieForbidsInsertHTML()) {
</span><span class="cx">         ec = NOT_SUPPORTED_ERR;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkuph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.h (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.h        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/editing/markup.h        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> WEBCORE_EXPORT Ref&lt;DocumentFragment&gt; createFragmentFromMarkup(Document&amp;, const String&amp; markup, const String&amp; baseURL, ParserContentPolicy = AllowScriptingContent);
</span><span class="cx"> RefPtr&lt;DocumentFragment&gt; createFragmentForInnerOuterHTML(Element&amp;, const String&amp; markup, ParserContentPolicy, ExceptionCode&amp;);
</span><span class="cx"> RefPtr&lt;DocumentFragment&gt; createFragmentForTransformToFragment(Document&amp;, const String&amp; sourceString, const String&amp; sourceMIMEType);
</span><del>-RefPtr&lt;DocumentFragment&gt; createContextualFragment(HTMLElement&amp;, const String&amp; markup, ParserContentPolicy, ExceptionCode&amp;);
</del><ins>+RefPtr&lt;DocumentFragment&gt; createContextualFragment(Element&amp;, const String&amp; markup, ParserContentPolicy, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx"> bool isPlainTextMarkup(Node*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -83,45 +83,6 @@
</span><span class="cx">     return Element::nodeName();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool HTMLElement::ieForbidsInsertHTML() const
-{
-    // FIXME: Supposedly IE disallows settting innerHTML, outerHTML
-    // and createContextualFragment on these tags.  We have no tests to
-    // verify this however, so this list could be totally wrong.
-    // This list was moved from the previous endTagRequirement() implementation.
-    // This is also called from editing and assumed to be the list of tags
-    // for which no end tag should be serialized. It's unclear if the list for
-    // IE compat and the list for serialization sanity are the same.
-    if (hasTagName(areaTag)
-        || hasTagName(baseTag)
-        || hasTagName(basefontTag)
-        || hasTagName(brTag)
-        || hasTagName(colTag)
-        || hasTagName(embedTag)
-        || hasTagName(frameTag)
-        || hasTagName(hrTag)
-        || hasTagName(imageTag)
-        || hasTagName(imgTag)
-        || hasTagName(inputTag)
-        || hasTagName(isindexTag)
-        || hasTagName(linkTag)
-        || hasTagName(metaTag)
-        || hasTagName(paramTag)
-        || hasTagName(sourceTag)
-        || hasTagName(wbrTag))
-        return true;
-    // FIXME: I'm not sure why dashboard mode would want to change the
-    // serialization of &lt;canvas&gt;, that seems like a bad idea.
-#if ENABLE(DASHBOARD_SUPPORT)
-    if (hasTagName(canvasTag)) {
-        Settings* settings = document().settings();
-        if (settings &amp;&amp; settings-&gt;usesDashboardBackwardCompatibilityMode())
-            return true;
-    }
-#endif
-    return false;
-}
-
</del><span class="cx"> static inline CSSValueID unicodeBidiAttributeForDirAuto(HTMLElement&amp; element)
</span><span class="cx"> {
</span><span class="cx">     if (element.hasTagName(preTag) || element.hasTagName(textareaTag))
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.h (204234 => 204235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.h        2016-08-07 02:29:07 UTC (rev 204234)
+++ trunk/Source/WebCore/html/HTMLElement.h        2016-08-07 02:43:53 UTC (rev 204235)
</span><span class="lines">@@ -70,8 +70,6 @@
</span><span class="cx"> 
</span><span class="cx">     void accessKeyAction(bool sendMouseEvents) override;
</span><span class="cx"> 
</span><del>-    bool ieForbidsInsertHTML() const;
-
</del><span class="cx">     bool rendererIsNeeded(const RenderStyle&amp;) override;
</span><span class="cx">     RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) override;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>