<!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>[161867] 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/161867">161867</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-13 01:46:57 -0800 (Mon, 13 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Comment should be consructable.
https://bugs.webkit.org/show_bug.cgi?id=115642

Patch by László Langó &lt;llango.u-szeged@partner.samsung.com&gt; on 2014-01-13
Reviewed by Andreas Kling.

Source/WebCore:

http://dom.spec.whatwg.org/#comment
This allows us to do `new Comment('abc')` instead of `document.createComment('abc')`.

Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/06e4a37f6b11348606de5405edac1ada97499d2a%5E%21

Test: fast/dom/Comment/comment-constructor.html

* dom/Comment.cpp:
(WebCore::Comment::create):
* dom/Comment.h:
* dom/Comment.idl:

LayoutTests:

* fast/dom/Comment/comment-constructor-expected.txt: Added.
* fast/dom/Comment/comment-constructor.html: Added.
* fast/dom/dom-constructors-expected.txt:
* fast/dom/dom-constructors.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomdomconstructorsexpectedtxt">trunk/LayoutTests/fast/dom/dom-constructors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdomconstructorshtml">trunk/LayoutTests/fast/dom/dom-constructors.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomCommentcpp">trunk/Source/WebCore/dom/Comment.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCommenth">trunk/Source/WebCore/dom/Comment.h</a></li>
<li><a href="#trunkSourceWebCoredomCommentidl">trunk/Source/WebCore/dom/Comment.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomCommentcommentconstructorexpectedtxt">trunk/LayoutTests/fast/dom/Comment/comment-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomCommentcommentconstructorhtml">trunk/LayoutTests/fast/dom/Comment/comment-constructor.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/LayoutTests/ChangeLog        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-01-13  László Langó  &lt;llango.u-szeged@partner.samsung.com&gt;
+
+        Comment should be consructable.
+        https://bugs.webkit.org/show_bug.cgi?id=115642
+
+        Reviewed by Andreas Kling.
+
+        * fast/dom/Comment/comment-constructor-expected.txt: Added.
+        * fast/dom/Comment/comment-constructor.html: Added.
+        * fast/dom/dom-constructors-expected.txt:
+        * fast/dom/dom-constructors.html:
+
</ins><span class="cx"> 2014-01-12  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r161843.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomCommentcommentconstructorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Comment/comment-constructor-expected.txt (0 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Comment/comment-constructor-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Comment/comment-constructor-expected.txt        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+This tests that Comment is constructable.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS new Comment(&quot;one&quot;).data is &quot;one&quot;
+PASS new Comment().data is &quot;&quot;
+PASS new Comment(&quot;two&quot;).ownerDocument is document
+PASS typeof new Comment is &quot;object&quot;
+PASS Object.prototype.toString.call(new Comment) is &quot;[object Comment]&quot;
+PASS new Comment instanceof Comment is true
+PASS Object.getPrototypeOf(new Comment) is Comment.prototype
+PASS new innerWindow.Comment(&quot;three&quot;).ownerDocument is innerDocument
+PASS new innerWindow.Comment instanceof innerWindow.Comment is true
+PASS Object.getPrototypeOf(new innerWindow.Comment) is innerWindow.Comment.prototype
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomCommentcommentconstructorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Comment/comment-constructor.html (0 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Comment/comment-constructor.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Comment/comment-constructor.html        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+
+description('This tests that Comment is constructable.');
+
+shouldBe('new Comment(&quot;one&quot;).data', '&quot;one&quot;');
+shouldBe('new Comment().data', '&quot;&quot;');
+shouldBe('new Comment(&quot;two&quot;).ownerDocument', 'document');
+
+shouldBe('typeof new Comment', '&quot;object&quot;');
+shouldBe('Object.prototype.toString.call(new Comment)', '&quot;[object Comment]&quot;');
+shouldBeTrue('new Comment instanceof Comment');
+shouldBe('Object.getPrototypeOf(new Comment)', 'Comment.prototype');
+
+var frame = document.createElement('iframe');
+document.body.appendChild(frame);
+var innerWindow = frame.contentWindow;
+var innerDocument = frame.contentDocument;
+
+shouldBe('new innerWindow.Comment(&quot;three&quot;).ownerDocument', 'innerDocument')
+shouldBeTrue('new innerWindow.Comment instanceof innerWindow.Comment');
+shouldBe('Object.getPrototypeOf(new innerWindow.Comment)', 'innerWindow.Comment.prototype');
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdomconstructorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/dom-constructors-expected.txt (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/dom-constructors-expected.txt        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/LayoutTests/fast/dom/dom-constructors-expected.txt        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -6,7 +6,6 @@
</span><span class="cx"> PASS TryAllocate('Attr') is 'exception'
</span><span class="cx"> PASS TryAllocate('CharacterData') is 'exception'
</span><span class="cx"> PASS TryAllocate('CDATASection') is 'exception'
</span><del>-PASS TryAllocate('Comment') is 'exception'
</del><span class="cx"> PASS TryAllocate('Document') is 'exception'
</span><span class="cx"> PASS TryAllocate('DocumentFragment') is 'exception'
</span><span class="cx"> PASS TryAllocate('DocumentType') is 'exception'
</span><span class="lines">@@ -129,6 +128,9 @@
</span><span class="cx"> PASS TryAllocate('EventTarget') is 'no constructor'
</span><span class="cx"> PASS TryAllocate('EventListener') is 'no constructor'
</span><span class="cx"> PASS TryAllocate('NPObject') is 'no constructor'
</span><ins>+PASS TryAllocate('Comment') is '[object Comment]'
+PASS TryAllocate('Comment') is '[object Comment]'
+PASS TryAllocate('Comment') is '[object Comment]'
</ins><span class="cx"> PASS TryAllocate('DOMParser') is '[object DOMParser]'
</span><span class="cx"> PASS TryAllocate('DOMParser') is '[object DOMParser]'
</span><span class="cx"> PASS TryAllocate('DOMParser') is '[object DOMParser]'
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomdomconstructorshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/dom-constructors.html (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/dom-constructors.html        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/LayoutTests/fast/dom/dom-constructors.html        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> // with no arguments. (Some of them may have working constructors that require
</span><span class="cx"> // arguments to be valid.)
</span><span class="cx"> var objects_exception = [
</span><del>-    'Attr', 'CharacterData', 'CDATASection', 'Comment', 'Document',
</del><ins>+    'Attr', 'CharacterData', 'CDATASection', 'Document',
</ins><span class="cx">     'DocumentFragment', 'DocumentType', 'Element', 'Entity',
</span><span class="cx">     'EntityReference', 'HTMLDocument', 'Node', 'Notation',
</span><span class="cx">     'ProcessingInstruction', 'Text', 'HTMLAllCollection', 'HTMLAnchorElement',
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> 
</span><span class="cx"> // These objects should have a working constructor.
</span><span class="cx"> var objects_constructor = [
</span><del>-    'DOMParser', 'XMLHttpRequest', 'XMLSerializer', 'XPathEvaluator',
</del><ins>+    'Comment', 'DOMParser', 'XMLHttpRequest', 'XMLSerializer', 'XPathEvaluator',
</ins><span class="cx">     'XSLTProcessor'
</span><span class="cx"> ];
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/Source/WebCore/ChangeLog        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-01-13  László Langó  &lt;llango.u-szeged@partner.samsung.com&gt;
+
+        Comment should be consructable.
+        https://bugs.webkit.org/show_bug.cgi?id=115642
+
+        Reviewed by Andreas Kling.
+
+        http://dom.spec.whatwg.org/#comment
+        This allows us to do `new Comment('abc')` instead of `document.createComment('abc')`.
+
+        Backported from Blink: https://chromium.googlesource.com/chromium/blink/+/06e4a37f6b11348606de5405edac1ada97499d2a%5E%21
+
+        Test: fast/dom/Comment/comment-constructor.html
+
+        * dom/Comment.cpp:
+        (WebCore::Comment::create):
+        * dom/Comment.h:
+        * dom/Comment.idl:
+
</ins><span class="cx"> 2014-01-13  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r161808.
</span></span></pre></div>
<a id="trunkSourceWebCoredomCommentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Comment.cpp (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Comment.cpp        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/Source/WebCore/dom/Comment.cpp        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -36,6 +36,11 @@
</span><span class="cx">     return adoptRef(new Comment(document, text));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;Comment&gt; Comment::create(ScriptExecutionContext&amp; context, const String&amp; text)
+{
+    return adoptRef(new Comment(toDocument(context), text));
+}
+
</ins><span class="cx"> String Comment::nodeName() const
</span><span class="cx"> {
</span><span class="cx">     return commentAtom.string();
</span></span></pre></div>
<a id="trunkSourceWebCoredomCommenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Comment.h (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Comment.h        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/Source/WebCore/dom/Comment.h        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> class Comment FINAL : public CharacterData {
</span><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;Comment&gt; create(Document&amp;, const String&amp;);
</span><ins>+    static PassRefPtr&lt;Comment&gt; create(ScriptExecutionContext&amp;, const String&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     Comment(Document&amp;, const String&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoredomCommentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Comment.idl (161866 => 161867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Comment.idl        2014-01-13 09:23:12 UTC (rev 161866)
+++ trunk/Source/WebCore/dom/Comment.idl        2014-01-13 09:46:57 UTC (rev 161867)
</span><span class="lines">@@ -17,6 +17,9 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-interface Comment : CharacterData {
</del><ins>+[
+    Constructor([Default=NullString] optional DOMString data),
+    ConstructorCallWith=ScriptExecutionContext
+] interface Comment : CharacterData {
</ins><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>