- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4616
Setting nodeValue on a textnode with collapsed whitespace only has no visual effect
Test: fast/dom/space-to-text.html
* dom/CharacterData.cpp:
(WebCore::CharacterData::setData): Create a renderer if it's needed, but missing.
(WebCore::CharacterData::appendData): Ditto.
(WebCore::CharacterData::insertData): Ditto.
(WebCore::CharacterData::replaceData): Ditto.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13552
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-03-28 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Maciej.
+
+ - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=4616
+ Setting nodeValue on a textnode with collapsed whitespace only has no visual effect
+
+ * fast/dom/space-to-text-expected.txt: Added.
+ * fast/dom/space-to-text.html: Added.
+
2006-03-28 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
--- /dev/null
+Test for bug 4616: Setting textNode.nodeValue does not work when nodeValue is whitespace only.
+
+Should say "SUCCESS":
+
+SU
+CC
+ES
+S
+
--- /dev/null
+<html>
+<head>
+<script type="text/javascript">
+function test() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ document.getElementById("s1").firstChild.nodeValue="SU";
+ document.getElementById("s2").firstChild.insertData(0, "CC");
+ document.getElementById("s3").firstChild.appendData("ES");
+ document.getElementById("s4").firstChild.replaceData(0, 1, "S");
+}
+</script>
+<body onLoad="test()">
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=4616">bug 4616</a>:
+Setting textNode.nodeValue does not work when nodeValue is whitespace only.</p>
+<p>Should say "SUCCESS":</p>
+<div id="s1"> </div><div id="s2"> </div><div id="s3"> </div><div id="s4"> </div>
+</body>
+</html>
+2006-03-28 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4616
+ Setting nodeValue on a textnode with collapsed whitespace only has no visual effect
+
+ Test: fast/dom/space-to-text.html
+
+ * dom/CharacterData.cpp:
+ (WebCore::CharacterData::setData): Create a renderer if it's needed, but missing.
+ (WebCore::CharacterData::appendData): Ditto.
+ (WebCore::CharacterData::insertData): Ditto.
+ (WebCore::CharacterData::replaceData): Ditto.
+
2006-03-28 Tim Omernick <timo@apple.com>
Reviewed by Maciej.
if(str == _data.impl()) return; // ### fire DOMCharacterDataModified if modified?
StringImpl *oldStr = str;
str = _data.impl();
- if(str) str->ref();
+ if (str)
+ str->ref();
+
+ if (!renderer() && attached()) {
+ detach();
+ attach();
+ }
+
if (renderer())
static_cast<RenderText*>(renderer())->setText(str);
str = str->copy();
str->ref();
str->append(arg.impl());
+
+ if (!renderer() && attached()) {
+ detach();
+ attach();
+ }
+
if (renderer())
static_cast<RenderText*>(renderer())->setTextWithOffset(str, oldStr->length(), 0);
str = str->copy();
str->ref();
str->insert(arg.impl(), offset);
+
+ if (!renderer() && attached()) {
+ detach();
+ attach();
+ }
+
if (renderer())
static_cast<RenderText*>(renderer())->setTextWithOffset(str, offset, 0);
str->ref();
str->remove(offset,realCount);
str->insert(arg.impl(), offset);
+
+ if (!renderer() && attached()) {
+ detach();
+ attach();
+ }
+
if (renderer())
static_cast<RenderText*>(renderer())->setTextWithOffset(str, offset, count);