<!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>[203047] 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/203047">203047</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-07-10 22:06:24 -0700 (Sun, 10 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Setting document.title reuses &lt;title&gt;'s textnode child
https://bugs.webkit.org/show_bug.cgi?id=28864
&lt;rdar://problem/7186473&gt;

Reviewed by Benjamin Poulain.

Source/WebCore:

Setting document.title should be equivalent to setting the 'textContent'
IDL attribute of the &lt;title&gt; element:
- https://html.spec.whatwg.org/multipage/dom.html#document.title

In particular, this means we should always create a new Text node and
replace all the &lt;title&gt;'s children with this new Node, as per:
- https://dom.spec.whatwg.org/#dom-node-textcontent

Previously, WebKit would in some cases reuse the existing &lt;title&gt;'s
Text node and merely update its data.

Firefox and Chrome behave as per the specification so this aligns our
behavior with other major browsers as well.

Test: fast/dom/title-setter-new-text-node.html

* dom/Document.cpp:
(WebCore::Document::setTitle):
- Call Node::setTextContent() instead of HTMLTitleElement::setText(),
  as per the specification.
- Take an ExceptionCode parameter and pass it to Node::setTextContent()
  as it may throw.

* dom/Document.h:
* dom/Document.idl:

* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::setText):
Update implementation of HTMLTitleElement::setText() to call
setTextContent() as per the specification:
- https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text

* html/HTMLTitleElement.h:
* html/HTMLTitleElement.idl:

* html/ImageDocument.cpp:
(WebCore::ImageDocument::finishedParsing):

* svg/SVGTitleElement.cpp:
* svg/SVGTitleElement.h:
Drop setText() setter which was duplicated from HTMLTitleElement::setText()
now that Document::setTitle() calls SVGTitleElement::setTextContent()
instead.

LayoutTests:

* fast/dom/title-setter-new-text-node-expected.txt: Added.
* fast/dom/title-setter-new-text-node.html: Added.
Add test coverage.

* fast/dom/title-text-property-2-expected.txt:
* fast/dom/title-text-property-expected.txt:
* http/tests/globalhistory/history-delegate-basic-title-expected.txt:
Rebaseline a few tests now that we do not reuse the &lt;title&gt;'s text
node child.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomtitletextproperty2expectedtxt">trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomtitletextpropertyexpectedtxt">trunk/LayoutTests/fast/dom/title-text-property-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsglobalhistoryhistorydelegatebasictitleexpectedtxt">trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTitleElementcpp">trunk/Source/WebCore/html/HTMLTitleElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTitleElementh">trunk/Source/WebCore/html/HTMLTitleElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTitleElementidl">trunk/Source/WebCore/html/HTMLTitleElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlImageDocumentcpp">trunk/Source/WebCore/html/ImageDocument.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGTitleElementcpp">trunk/Source/WebCore/svg/SVGTitleElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGTitleElementh">trunk/Source/WebCore/svg/SVGTitleElement.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomtitlesetternewtextnodeexpectedtxt">trunk/LayoutTests/fast/dom/title-setter-new-text-node-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomtitlesetternewtextnodesvgexpectedtxt">trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomtitlesetternewtextnodesvghtml">trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg.html</a></li>
<li><a href="#trunkLayoutTestsfastdomtitlesetternewtextnodehtml">trunk/LayoutTests/fast/dom/title-setter-new-text-node.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/LayoutTests/ChangeLog        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-07-10  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Setting document.title reuses &lt;title&gt;'s textnode child
+        https://bugs.webkit.org/show_bug.cgi?id=28864
+        &lt;rdar://problem/7186473&gt;
+
+        Reviewed by Benjamin Poulain.
+
+        * fast/dom/title-setter-new-text-node-expected.txt: Added.
+        * fast/dom/title-setter-new-text-node.html: Added.
+        Add test coverage.
+
+        * fast/dom/title-text-property-2-expected.txt:
+        * fast/dom/title-text-property-expected.txt:
+        * http/tests/globalhistory/history-delegate-basic-title-expected.txt:
+        Rebaseline a few tests now that we do not reuse the &lt;title&gt;'s text
+        node child.
+
</ins><span class="cx"> 2016-07-10  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r203037.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomtitlesetternewtextnodeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/title-setter-new-text-node-expected.txt (0 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/title-setter-new-text-node-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/title-setter-new-text-node-expected.txt        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Tests that setting document.title does not reuse title's text node child
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS document.title is &quot;aaa&quot;
+PASS oldTextNode.textContent is &quot;aaa&quot;
+document.title = 'bbb'
+PASS oldTextNode.textContent is &quot;aaa&quot;
+PASS oldTextNode is not newTextNode
+PASS document.title is &quot;bbb&quot;
+PASS newTextNode.textContent is &quot;bbb&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomtitlesetternewtextnodesvgexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg-expected.txt (0 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg-expected.txt        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Tests that setting document.title does not reuse title's text node child
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS svgDocument.title is &quot;aaa&quot;
+PASS oldTextNode.textContent is &quot;aaa&quot;
+svgDocument.title = 'bbb'
+PASS oldTextNode.textContent is &quot;aaa&quot;
+PASS oldTextNode is not newTextNode
+PASS svgDocument.title is &quot;bbb&quot;
+PASS newTextNode.textContent is &quot;bbb&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomtitlesetternewtextnodesvghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg.html (0 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/title-setter-new-text-node-svg.html        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that setting document.title does not reuse title's text node child&quot;);
+
+var SVG_NAMESPACE = &quot;http://www.w3.org/2000/svg&quot;;
+
+var svgDocument = document.implementation.createDocument(SVG_NAMESPACE, &quot;svg&quot;, null);
+var title = svgDocument.createElementNS(SVG_NAMESPACE, &quot;title&quot;);
+title.textContent = &quot;aaa&quot;;
+svgDocument.documentElement.appendChild(title);
+
+oldTextNode = svgDocument.getElementsByTagName(&quot;title&quot;)[0].firstChild;
+shouldBeEqualToString(&quot;svgDocument.title&quot;, &quot;aaa&quot;);
+shouldBeEqualToString(&quot;oldTextNode.textContent&quot;, &quot;aaa&quot;);
+evalAndLog(&quot;svgDocument.title = 'bbb'&quot;);
+shouldBeEqualToString(&quot;oldTextNode.textContent&quot;, &quot;aaa&quot;);
+newTextNode = svgDocument.getElementsByTagName(&quot;title&quot;)[0].firstChild;
+shouldNotBe(&quot;oldTextNode&quot;, &quot;newTextNode&quot;);
+shouldBeEqualToString(&quot;svgDocument.title&quot;, &quot;bbb&quot;);
+shouldBeEqualToString(&quot;newTextNode.textContent&quot;, &quot;bbb&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomtitlesetternewtextnodehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/title-setter-new-text-node.html (0 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/title-setter-new-text-node.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/title-setter-new-text-node.html        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;aaa&lt;/title&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;script&gt;
+description(&quot;Tests that setting document.title does not reuse title's text node child&quot;);
+jsTestIsAsync = true;
+
+function runTest()
+{
+    oldTextNode = document.getElementsByTagName(&quot;title&quot;)[0].firstChild;
+    shouldBeEqualToString(&quot;document.title&quot;, &quot;aaa&quot;);
+    shouldBeEqualToString(&quot;oldTextNode.textContent&quot;, &quot;aaa&quot;);
+    evalAndLog(&quot;document.title = 'bbb'&quot;);
+    shouldBeEqualToString(&quot;oldTextNode.textContent&quot;, &quot;aaa&quot;);
+    newTextNode = document.getElementsByTagName(&quot;title&quot;)[0].firstChild;
+    shouldNotBe(&quot;oldTextNode&quot;, &quot;newTextNode&quot;);
+    shouldBeEqualToString(&quot;document.title&quot;, &quot;bbb&quot;);
+    shouldBeEqualToString(&quot;newTextNode.textContent&quot;, &quot;bbb&quot;);
+
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomtitletextproperty2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -1,4 +1,7 @@
</span><span class="cx"> TITLE CHANGED: '1. setting document.title'
</span><ins>+TITLE CHANGED: ''
+TITLE CHANGED: '1. setting document.title'
+TITLE CHANGED: ''
</ins><span class="cx"> TITLE CHANGED: '2. setting title.text'
</span><span class="cx"> TITLE CHANGED: ''
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomtitletextpropertyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/title-text-property-expected.txt (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/title-text-property-expected.txt        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/LayoutTests/fast/dom/title-text-property-expected.txt        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+TITLE CHANGED: ''
</ins><span class="cx"> TITLE CHANGED: 'This is the new title'
</span><span class="cx"> Original title is: 'Original Title'
</span><span class="cx"> Setting new title to: 'This is the new title'
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsglobalhistoryhistorydelegatebasictitleexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -1,4 +1,6 @@
</span><span class="cx"> WebView navigated to url &quot;http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html&quot; with title &quot;&quot; with HTTP equivalent method &quot;GET&quot;.  The navigation was successful and was not a client redirect.
</span><span class="cx"> WebView updated the title for history URL &quot;http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html&quot; to &quot;Test Title 1&quot;.
</span><span class="cx"> WebView updated the title for history URL &quot;http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html&quot; to &quot;Test Title 2&quot;.
</span><ins>+WebView updated the title for history URL &quot;http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html&quot; to &quot;&quot;.
+WebView updated the title for history URL &quot;http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html&quot; to &quot;Test Title 2&quot;.
</ins><span class="cx"> This test sees if the history delegate is notified of title changes.
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/ChangeLog        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2016-07-10  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Setting document.title reuses &lt;title&gt;'s textnode child
+        https://bugs.webkit.org/show_bug.cgi?id=28864
+        &lt;rdar://problem/7186473&gt;
+
+        Reviewed by Benjamin Poulain.
+
+        Setting document.title should be equivalent to setting the 'textContent'
+        IDL attribute of the &lt;title&gt; element:
+        - https://html.spec.whatwg.org/multipage/dom.html#document.title
+
+        In particular, this means we should always create a new Text node and
+        replace all the &lt;title&gt;'s children with this new Node, as per:
+        - https://dom.spec.whatwg.org/#dom-node-textcontent
+
+        Previously, WebKit would in some cases reuse the existing &lt;title&gt;'s
+        Text node and merely update its data.
+
+        Firefox and Chrome behave as per the specification so this aligns our
+        behavior with other major browsers as well.
+
+        Test: fast/dom/title-setter-new-text-node.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::setTitle):
+        - Call Node::setTextContent() instead of HTMLTitleElement::setText(),
+          as per the specification.
+        - Take an ExceptionCode parameter and pass it to Node::setTextContent()
+          as it may throw.
+
+        * dom/Document.h:
+        * dom/Document.idl:
+
+        * html/HTMLTitleElement.cpp:
+        (WebCore::HTMLTitleElement::setText):
+        Update implementation of HTMLTitleElement::setText() to call
+        setTextContent() as per the specification:
+        - https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
+
+        * html/HTMLTitleElement.h:
+        * html/HTMLTitleElement.idl:
+
+        * html/ImageDocument.cpp:
+        (WebCore::ImageDocument::finishedParsing):
+
+        * svg/SVGTitleElement.cpp:
+        * svg/SVGTitleElement.h:
+        Drop setText() setter which was duplicated from HTMLTitleElement::setText()
+        now that Document::setTitle() calls SVGTitleElement::setTextContent()
+        instead.
+
</ins><span class="cx"> 2016-07-10  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix LogicalSelectionOffsetCaches to work with detached render tree.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -1623,7 +1623,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::setTitle(const String&amp; title)
</del><ins>+void Document::setTitle(const String&amp; title, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_titleElement) {
</span><span class="cx">         if (isHTMLDocument() || isXHTMLDocument()) {
</span><span class="lines">@@ -1646,9 +1646,9 @@
</span><span class="cx">     updateTitle(StringWithDirection(title, LTR));
</span><span class="cx"> 
</span><span class="cx">     if (is&lt;HTMLTitleElement&gt;(m_titleElement.get()))
</span><del>-        downcast&lt;HTMLTitleElement&gt;(*m_titleElement).setText(title);
</del><ins>+        downcast&lt;HTMLTitleElement&gt;(*m_titleElement).setTextContent(title, ec);
</ins><span class="cx">     else if (is&lt;SVGTitleElement&gt;(m_titleElement.get()))
</span><del>-        downcast&lt;SVGTitleElement&gt;(*m_titleElement).setText(title);
</del><ins>+        downcast&lt;SVGTitleElement&gt;(*m_titleElement).setTextContent(title, ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Document::updateTitleElement(Element* newTitleElement)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/dom/Document.h        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -863,7 +863,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Used by DOM bindings; no direction known.
</span><span class="cx">     String title() const { return m_title.string(); }
</span><del>-    void setTitle(const String&amp;);
</del><ins>+    void setTitle(const String&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void titleElementAdded(Element&amp; titleElement);
</span><span class="cx">     void titleElementRemoved(Element&amp; titleElement);
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/dom/Document.idl        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx">     // Moved down from HTMLDocument
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Should not have [TreatNullAs=EmptyString].
</span><del>-    [TreatNullAs=EmptyString] attribute DOMString title;
</del><ins>+    [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString title;
</ins><span class="cx"> 
</span><span class="cx">     readonly attribute DOMString referrer;
</span><span class="cx"> #if defined(LANGUAGE_JAVASCRIPT) &amp;&amp; LANGUAGE_JAVASCRIPT
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTitleElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTitleElement.cpp (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTitleElement.cpp        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/html/HTMLTitleElement.cpp        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -92,25 +92,9 @@
</span><span class="cx">     return StringWithDirection(text(), direction);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTitleElement::setText(const String&amp; value)
</del><ins>+void HTMLTitleElement::setText(const String&amp; value, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    Ref&lt;HTMLTitleElement&gt; protectedThis(*this);
-    
-    if (!value.isEmpty() &amp;&amp; hasOneChild() &amp;&amp; is&lt;Text&gt;(*firstChild())) {
-        downcast&lt;Text&gt;(*firstChild()).setData(value);
-        return;
-    }
-
-    // We make a copy here because entity of &quot;value&quot; argument can be Document::m_title,
-    // which goes empty during removeChildren() invocation below,
-    // which causes HTMLTitleElement::childrenChanged(), which ends up calling Document::setTitle().
-    String valueCopy(value);
-
-    if (hasChildNodes())
-        removeChildren();
-
-    if (!valueCopy.isEmpty())
-        appendChild(document().createTextNode(valueCopy), IGNORE_EXCEPTION);
</del><ins>+    setTextContent(value, ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTitleElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTitleElement.h (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTitleElement.h        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/html/HTMLTitleElement.h        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">     static Ref&lt;HTMLTitleElement&gt; create(const QualifiedName&amp;, Document&amp;);
</span><span class="cx"> 
</span><span class="cx">     String text() const;
</span><del>-    void setText(const String&amp;);
</del><ins>+    void setText(const String&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     const StringWithDirection&amp; textWithDirection() const { return m_title; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTitleElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTitleElement.idl (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTitleElement.idl        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/html/HTMLTitleElement.idl        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -18,6 +18,6 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> interface HTMLTitleElement : HTMLElement {
</span><del>-    attribute DOMString text;
</del><ins>+    [SetterRaisesException] attribute DOMString text;
</ins><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlImageDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/ImageDocument.cpp (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ImageDocument.cpp        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/html/ImageDocument.cpp        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx">             String name = decodeURLEscapeSequences(url().lastPathComponent());
</span><span class="cx">             if (name.isEmpty())
</span><span class="cx">                 name = url().host();
</span><del>-            setTitle(imageTitle(name, size));
</del><ins>+            setTitle(imageTitle(name, size), IGNORE_EXCEPTION);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         imageUpdated();
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGTitleElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGTitleElement.cpp (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGTitleElement.cpp        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/svg/SVGTitleElement.cpp        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -63,25 +63,4 @@
</span><span class="cx">     document().titleElementTextChanged(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGTitleElement::setText(const String&amp; value)
-{
-    Ref&lt;SVGTitleElement&gt; protectedThis(*this);
-
-    if (!value.isEmpty() &amp;&amp; hasOneChild() &amp;&amp; is&lt;Text&gt;(*firstChild())) {
-        downcast&lt;Text&gt;(*firstChild()).setData(value);
-        return;
-    }
-
-    // We make a copy here because entity of &quot;value&quot; argument can be Document::m_title,
-    // which goes empty during removeChildren() invocation below,
-    // which causes SVGTitleElement::childrenChanged(), which ends up calling Document::setTitle().
-    String valueCopy(value);
-
-    if (hasChildNodes())
-        removeChildren();
-
-    if (!valueCopy.isEmpty())
-        appendChild(document().createTextNode(valueCopy), IGNORE_EXCEPTION);
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGTitleElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGTitleElement.h (203046 => 203047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGTitleElement.h        2016-07-11 04:28:03 UTC (rev 203046)
+++ trunk/Source/WebCore/svg/SVGTitleElement.h        2016-07-11 05:06:24 UTC (rev 203047)
</span><span class="lines">@@ -30,8 +30,6 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;SVGTitleElement&gt; create(const QualifiedName&amp;, Document&amp;);
</span><span class="cx"> 
</span><del>-    void setText(const String&amp;);
-
</del><span class="cx"> private:
</span><span class="cx">     SVGTitleElement(const QualifiedName&amp;, Document&amp;);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>