<!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>[211023] 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/211023">211023</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-01-21 21:19:17 -0800 (Sat, 21 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>innerText should replace existing text node
https://bugs.webkit.org/show_bug.cgi?id=167116
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Rebaseline existing test now that one more check is passing.
* web-platform-tests/innerText/setter-expected.txt:
Source/WebCore:
Update setInnerText() to use ContainerNode::replaceAllChildren()
instead of replaceChildrenWithText(). replaceAllChildren() is
implemented as per specification:
- https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
- https://dom.spec.whatwg.org/#concept-node-replace-all
As a result, we now correctly remove existing children before
inserting the new one.
No new tests, updated existing one.
* editing/markup.cpp:
(WebCore::replaceChildrenWithText): Deleted.
* editing/markup.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setInnerText):
LayoutTests:
* accessibility/mac/aria-liveregions-changedtext.html:
The text is using innerText and changed behavior now that we stopped
reusing the existing Text child. Code in RenderObject::willBeDestroyed()
is supposed to call AXObjectCache::childrenChanged(parent()) to fire
the AXLiveRegionChanged notification. However, it did not because the
parent renderer did not have an associated AccessibilityObject.
* fast/dom/HTMLElement/set-inner-outer-optimization.html:
Update existing test which expected the non spec-compliant Text child
optimization.
* fast/repaint/vertical-text-repaint-expected.txt:
* fast/repaint/vertical-text-repaint.html:
Update / rebaseline test. We now repaint each 80x80 rectangle instead of
only repainting the text rects because we remove the Text node then add
a new one instead of only updating the existing Text node's test. The
output looks exactly the same otherwise.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacarialiveregionschangedtexthtml">trunk/LayoutTests/accessibility/mac/aria-liveregions-changedtext.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementsetinnerouteroptimizationhtml">trunk/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.html</a></li>
<li><a href="#trunkLayoutTestsfastrepaintverticaltextrepaintexpectedtxt">trunk/LayoutTests/fast/repaint/vertical-text-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastrepaintverticaltextrepainthtml">trunk/LayoutTests/fast/repaint/vertical-text-repaint.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsinnerTextsetterexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/ChangeLog        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -1,5 +1,30 @@
</span><span class="cx"> 2017-01-21 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ innerText should replace existing text node
+ https://bugs.webkit.org/show_bug.cgi?id=167116
+
+ Reviewed by Darin Adler.
+
+ * accessibility/mac/aria-liveregions-changedtext.html:
+ The text is using innerText and changed behavior now that we stopped
+ reusing the existing Text child. Code in RenderObject::willBeDestroyed()
+ is supposed to call AXObjectCache::childrenChanged(parent()) to fire
+ the AXLiveRegionChanged notification. However, it did not because the
+ parent renderer did not have an associated AccessibilityObject.
+
+ * fast/dom/HTMLElement/set-inner-outer-optimization.html:
+ Update existing test which expected the non spec-compliant Text child
+ optimization.
+
+ * fast/repaint/vertical-text-repaint-expected.txt:
+ * fast/repaint/vertical-text-repaint.html:
+ Update / rebaseline test. We now repaint each 80x80 rectangle instead of
+ only repainting the text rects because we remove the Text node then add
+ a new one instead of only updating the existing Text node's test. The
+ output looks exactly the same otherwise.
+
+2017-01-21 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> AccessibilityRenderObject::textChanged() bypasses AXLiveRegionChanged notification coalescing
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=167286
</span><span class="cx"> <rdar://problem/30133211>
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacarialiveregionschangedtexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/aria-liveregions-changedtext.html (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/aria-liveregions-changedtext.html        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/accessibility/mac/aria-liveregions-changedtext.html        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -29,8 +29,7 @@
</span><span class="cx"> if (window.accessibilityController) {
</span><span class="cx"> window.testRunner.waitUntilDone();
</span><span class="cx">
</span><del>- document.getElementById("liveregion").focus();
- liveRegionText = window.accessibilityController.focusedElement;
</del><ins>+ liveRegionText = accessibilityController.accessibleElementById("liveregion");
</ins><span class="cx">
</span><span class="cx"> var addedNotification = liveRegionText.addNotificationListener(ariaCallbackText);
</span><span class="cx"> shouldBe("addedNotification", "true");
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementsetinnerouteroptimizationhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.html (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.html        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/fast/dom/HTMLElement/set-inner-outer-optimization.html        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -99,8 +99,8 @@
</span><span class="cx"> runTest('', 'innerText', '<a></a><b></b>', 'modified');
</span><span class="cx">
</span><span class="cx"> runTest('text', 'innerText', '', 'modified');
</span><del>- runTest('text', 'innerText', 'different text', 'modified, with same first child');
- runTest('text', 'innerText', 'text', 'modified, with same first child');
</del><ins>+ runTest('text', 'innerText', 'different text', 'modified');
+ runTest('text', 'innerText', 'text', 'modified');
</ins><span class="cx">
</span><span class="cx"> runTest('<a></a>', 'innerText', '', 'modified');
</span><span class="cx"> runTest('<a></a>', 'innerText', 'text', 'modified');
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintverticaltextrepaintexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/vertical-text-repaint-expected.txt (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/vertical-text-repaint-expected.txt        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/fast/repaint/vertical-text-repaint-expected.txt        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -1,9 +1,33 @@
</span><del>-PASS window.internals.repaintRectsAsText().indexOf('95 25') is not -1
-PASS window.internals.repaintRectsAsText().indexOf('95 155') is not -1
-PASS window.internals.repaintRectsAsText().indexOf('95 285') is not -1
-PASS window.internals.repaintRectsAsText().indexOf('225 25') is not -1
-PASS window.internals.repaintRectsAsText().indexOf('225 155') is not -1
-PASS window.internals.repaintRectsAsText().indexOf('225 285') is not -1
</del><ins>+(repaint rects
+ (rect 25 25 80 80)
+ (rect 25 155 80 80)
+ (rect 25 285 80 80)
+ (rect 155 25 80 80)
+ (rect 155 155 80 80)
+ (rect 155 155 80 80)
+ (rect 155 285 80 80)
+ (rect 25 25 80 80)
+ (rect 25 155 80 80)
+ (rect 25 285 80 80)
+ (rect 155 25 80 80)
+ (rect 155 155 80 80)
+ (rect 155 155 80 80)
+ (rect 155 285 80 80)
+ (rect 25 25 80 80)
+ (rect 25 155 80 80)
+ (rect 25 285 80 80)
+ (rect 155 25 80 80)
+ (rect 155 155 80 80)
+ (rect 155 155 80 80)
+ (rect 155 285 80 80)
+)
+
+PASS internals.repaintRectsAsText().indexOf('25 25') is not -1
+PASS internals.repaintRectsAsText().indexOf('25 155') is not -1
+PASS internals.repaintRectsAsText().indexOf('25 285') is not -1
+PASS internals.repaintRectsAsText().indexOf('155 25') is not -1
+PASS internals.repaintRectsAsText().indexOf('155 155') is not -1
+PASS internals.repaintRectsAsText().indexOf('155 285') is not -1
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintverticaltextrepainthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/vertical-text-repaint.html (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/vertical-text-repaint.html        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/fast/repaint/vertical-text-repaint.html        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -90,12 +90,13 @@
</span><span class="cx"> document.body.offsetWidth;
</span><span class="cx">
</span><span class="cx"> if (window.internals) {
</span><del>- shouldNotBe("window.internals.repaintRectsAsText().indexOf('95 25')", "-1");
- shouldNotBe("window.internals.repaintRectsAsText().indexOf('95 155')", "-1");
- shouldNotBe("window.internals.repaintRectsAsText().indexOf('95 285')", "-1");
- shouldNotBe("window.internals.repaintRectsAsText().indexOf('225 25')", "-1");
- shouldNotBe("window.internals.repaintRectsAsText().indexOf('225 155')", "-1");
- shouldNotBe("window.internals.repaintRectsAsText().indexOf('225 285')", "-1");
</del><ins>+ debug(internals.repaintRectsAsText());
+ shouldNotBe("internals.repaintRectsAsText().indexOf('25 25')", "-1");
+ shouldNotBe("internals.repaintRectsAsText().indexOf('25 155')", "-1");
+ shouldNotBe("internals.repaintRectsAsText().indexOf('25 285')", "-1");
+ shouldNotBe("internals.repaintRectsAsText().indexOf('155 25')", "-1");
+ shouldNotBe("internals.repaintRectsAsText().indexOf('155 155')", "-1");
+ shouldNotBe("internals.repaintRectsAsText().indexOf('155 285')", "-1");
</ins><span class="cx"> internals.stopTrackingRepaints();
</span><span class="cx"> }
</span><span class="cx"> finishJSTest();
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-01-21 Chris Dumez <cdumez@apple.com>
+
+ innerText should replace existing text node
+ https://bugs.webkit.org/show_bug.cgi?id=167116
+
+ Reviewed by Darin Adler.
+
+ Rebaseline existing test now that one more check is passing.
+
+ * web-platform-tests/innerText/setter-expected.txt:
+
</ins><span class="cx"> 2017-01-20 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rebaseline html/dom/interfaces.html.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsinnerTextsetterexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> PASS Leading whitespace preserved
</span><span class="cx"> PASS Trailing whitespace preserved
</span><span class="cx"> PASS Whitespace not compressed
</span><del>-FAIL Existing text deleted assert_not_equals: Child should be a *new* text node got disallowed value Text node "abc"
</del><ins>+PASS Existing text deleted
</ins><span class="cx"> PASS Existing <br> deleted
</span><span class="cx"> PASS Assigning the empty string
</span><span class="cx"> PASS Assigning null
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/Source/WebCore/ChangeLog        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2017-01-21 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ innerText should replace existing text node
+ https://bugs.webkit.org/show_bug.cgi?id=167116
+
+ Reviewed by Darin Adler.
+
+ Update setInnerText() to use ContainerNode::replaceAllChildren()
+ instead of replaceChildrenWithText(). replaceAllChildren() is
+ implemented as per specification:
+ - https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
+ - https://dom.spec.whatwg.org/#concept-node-replace-all
+
+ As a result, we now correctly remove existing children before
+ inserting the new one.
+
+ No new tests, updated existing one.
+
+ * editing/markup.cpp:
+ (WebCore::replaceChildrenWithText): Deleted.
+ * editing/markup.h:
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::setInnerText):
+
+2017-01-21 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> AccessibilityRenderObject::textChanged() bypasses AXLiveRegionChanged notification coalescing
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=167286
</span><span class="cx"> <rdar://problem/30133211>
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/Source/WebCore/editing/markup.cpp        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -1017,23 +1017,4 @@
</span><span class="cx"> return containerNode->appendChild(fragment);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> replaceChildrenWithText(ContainerNode& container, const String& text)
-{
- Ref<ContainerNode> containerNode(container);
- ChildListMutationScope mutation(containerNode);
-
- if (hasOneTextChild(containerNode)) {
- downcast<Text>(*containerNode->firstChild()).setData(text);
- return { };
- }
-
- auto textNode = Text::create(containerNode->document(), text);
-
- if (hasOneChild(containerNode))
- return containerNode->replaceChild(textNode, *containerNode->firstChild());
-
- containerNode->removeChildren();
- return containerNode->appendChild(textNode);
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkuph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.h (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.h        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/Source/WebCore/editing/markup.h        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -57,7 +57,6 @@
</span><span class="cx">
</span><span class="cx"> // These methods are used by HTMLElement & ShadowRoot to replace the children with respected fragment/text.
</span><span class="cx"> ExceptionOr<void> replaceChildrenWithFragment(ContainerNode&, Ref<DocumentFragment>&&);
</span><del>-ExceptionOr<void> replaceChildrenWithText(ContainerNode&, const String&);
</del><span class="cx">
</span><span class="cx"> String createMarkup(const Range&, Vector<Node*>* = nullptr, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs);
</span><span class="cx"> String createMarkup(const Node&, EChildrenOnly = IncludeNode, Vector<Node*>* = nullptr, EAbsoluteURLs = DoNotResolveURLs, Vector<QualifiedName>* tagNamesToSkip = nullptr, EFragmentSerialization = HTMLFragmentSerialization);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (211022 => 211023)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2017-01-22 02:29:15 UTC (rev 211022)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2017-01-22 05:19:17 UTC (rev 211023)
</span><span class="lines">@@ -503,24 +503,27 @@
</span><span class="cx"> // FIXME: This doesn't take whitespace collapsing into account at all.
</span><span class="cx">
</span><span class="cx"> if (!text.contains('\n') && !text.contains('\r')) {
</span><del>- if (text.isEmpty()) {
- removeChildren();
- return { };
- }
- return replaceChildrenWithText(*this, text);
</del><ins>+ if (text.isEmpty())
+ replaceAllChildren(nullptr);
+ else
+ replaceAllChildren(document().createTextNode(text));
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // FIXME: Do we need to be able to detect preserveNewline style even when there's no renderer?
</span><span class="cx"> // FIXME: Can the renderer be out of date here? Do we need to call updateStyleIfNeeded?
</span><span class="cx"> // For example, for the contents of textarea elements that are display:none?
</span><del>- auto r = renderer();
</del><ins>+ auto* r = renderer();
</ins><span class="cx"> if ((r && r->style().preserveNewline()) || (inDocument() && isTextControlInnerTextElement())) {
</span><del>- if (!text.contains('\r'))
- return replaceChildrenWithText(*this, text);
</del><ins>+ if (!text.contains('\r')) {
+ replaceAllChildren(document().createTextNode(text));
+ return { };
+ }
</ins><span class="cx"> String textWithConsistentLineBreaks = text;
</span><span class="cx"> textWithConsistentLineBreaks.replace("\r\n", "\n");
</span><span class="cx"> textWithConsistentLineBreaks.replace('\r', '\n');
</span><del>- return replaceChildrenWithText(*this, textWithConsistentLineBreaks);
</del><ins>+ replaceAllChildren(document().createTextNode(textWithConsistentLineBreaks));
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Add text nodes and <br> elements.
</span><span class="lines">@@ -527,6 +530,7 @@
</span><span class="cx"> auto fragment = textToFragment(text);
</span><span class="cx"> if (fragment.hasException())
</span><span class="cx"> return fragment.releaseException();
</span><ins>+ // FIXME: This should use replaceAllChildren() once it accepts DocumentFragments as input.
</ins><span class="cx"> return replaceChildrenWithFragment(*this, fragment.releaseReturnValue());
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>