[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
rniwa at webkit.org
rniwa at webkit.org
Thu Dec 3 13:19:26 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit c50bc93be841cd123881e976ccc240bc1938a26e
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 26 20:48:55 2009 +0000
Data loss occurs when unbolding nested bold tags.
https://bugs.webkit.org/show_bug.cgi?id=30083
Patch by Ryosuke Niwa <rniwa at webkit.org> on 2009-10-26
Reviewed by Eric Seidel.
WebCore:
Fixes the loop in swapInNodePreservingAttributesAndChildren by saving nextSibling() of child
to a temporary valuable. It was originally calling nextSibling() after appending the child
to new parent, in which case, nextSibling is always 0.
Test: editing/style/unbolding-nested-b.html
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::swapInNodePreservingAttributesAndChildren):
LayoutTests:
Adds a test to make sure WebKit can remove nested b, i, & s tags properly
without loosing the content of inner elements.
* editing/style/remove-nested-inline-styles-expected.txt: Added.
* editing/style/remove-nested-inline-styles.html: Added.
* editing/style/script-tests/remove-nested-inline-styles.js: Added.
(removeStyleAndExpect):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index cf80f32..37ffa3a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2009-10-26 Ryosuke Niwa <rniwa at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Data loss occurs when unbolding nested bold tags.
+ https://bugs.webkit.org/show_bug.cgi?id=30083
+
+ Adds a test to make sure WebKit can remove nested b, i, & s tags properly
+ without loosing the content of inner elements.
+
+ * editing/style/remove-nested-inline-styles-expected.txt: Added.
+ * editing/style/remove-nested-inline-styles.html: Added.
+ * editing/style/script-tests/remove-nested-inline-styles.js: Added.
+ (removeStyleAndExpect):
+
2009-10-26 Sam Weinig <sam at webkit.org>
Rubber-stamped by Darin Adler.
diff --git a/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt b/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt
new file mode 100644
index 0000000..8bc1617
--- /dev/null
+++ b/LayoutTests/editing/style/remove-nested-inline-styles-expected.txt
@@ -0,0 +1,14 @@
+Test to make sure WebKit does not remove content when unbolding nested b's. See Bug 30083 for detail.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS '<span id="e">12</span>' is '<span id="e">12</span>'
+PASS '<span id="e"><span id="foo">12</span></span>' is '<span id="e"><span id="foo">12</span></span>'
+FAIL '<span id="e"><b id="foo"><b><b>1</b></b>2</b></span>' should be <span id="e"><span id="foo">12</span></span>. Was <span id="e"><b id="foo"><b><b>1</b></b>2</b></span>.
+PASS '<span id="e">12</span>' is '<span id="e">12</span>'
+PASS '<span id="e">12</span>' is '<span id="e">12</span>'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/editing/style/remove-nested-inline-styles.html b/LayoutTests/editing/style/remove-nested-inline-styles.html
new file mode 100644
index 0000000..27bc535
--- /dev/null
+++ b/LayoutTests/editing/style/remove-nested-inline-styles.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/remove-nested-inline-styles.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js b/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js
new file mode 100644
index 0000000..b7ca0c2
--- /dev/null
+++ b/LayoutTests/editing/style/script-tests/remove-nested-inline-styles.js
@@ -0,0 +1,32 @@
+description('Test to make sure WebKit does not remove content when unbolding nested b\'s. See <a href="https://bugs.webkit.org/show_bug.cgi?id=30083">Bug 30083</a> for detail.');
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+function removeStyleAndExpect(command, content, expected)
+{
+ testContainer.innerHTML = content;
+ var e = document.getElementById('e');
+ var s = window.getSelection();
+ var r = document.createRange();
+ r.setStart(e, 0);
+ r.setEnd(e, 1);
+ e.focus();
+ s.removeAllRanges();
+ s.addRange(r);
+
+ document.execCommand(command, false, null);
+
+ return shouldBe("'"+testContainer.innerHTML+"'","'"+expected+"'");
+}
+
+removeStyleAndExpect('bold', '<span id="e"><b>1<b>2</b></b></span>', '<span id="e">12</span>');
+removeStyleAndExpect('bold', '<span id="e"><b id="foo">1<b>2</b></b></span>', '<span id="e"><span id="foo">12</span></span>');
+removeStyleAndExpect('bold', '<span id="e"><b id="foo"><b>1</b>2</b></span>', '<span id="e"><span id="foo">12</span></span>');
+removeStyleAndExpect('italic', '<span id="e"><i>1<i>2</i></i></span>', '<span id="e">12</span>');
+removeStyleAndExpect('strikeThrough', '<span id="e"><s>1<s>2</s></s></span>', '<span id="e">12</span>');
+
+document.body.removeChild(testContainer);
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 804df25..3f6b39c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-26 Ryosuke Niwa <rniwa at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Data loss occurs when unbolding nested bold tags.
+ https://bugs.webkit.org/show_bug.cgi?id=30083
+
+ Fixes the loop in swapInNodePreservingAttributesAndChildren by saving nextSibling() of child
+ to a temporary valuable. It was originally calling nextSibling() after appending the child
+ to new parent, in which case, nextSibling is always 0.
+
+ Test: editing/style/unbolding-nested-b.html
+
+ * editing/ReplaceNodeWithSpanCommand.cpp:
+ (WebCore::swapInNodePreservingAttributesAndChildren):
+
2009-10-21 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Darin Adler.
diff --git a/WebCore/editing/ReplaceNodeWithSpanCommand.cpp b/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
index 21ca924..0874201 100644
--- a/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
+++ b/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
@@ -57,7 +57,9 @@ static void swapInNodePreservingAttributesAndChildren(Node* newNode, Node* nodeT
parentNode->insertBefore(newNode, nodeToReplace, ec);
ASSERT(!ec);
- for (Node* child = nodeToReplace->firstChild(); child; child = child->nextSibling()) {
+ Node* nextChild;
+ for (Node* child = nodeToReplace->firstChild(); child; child = nextChild) {
+ nextChild = child->nextSibling();
newNode->appendChild(child, ec);
ASSERT(!ec);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list