[Shadow] Deleting list distributed to Shadow DOM does not work correctly.
authorshinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 01:49:11 +0000 (01:49 +0000)
committershinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 01:49:11 +0000 (01:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89170

Reviewed by Ryosuke Niwa.

Source/WebCore:

When deleting several elements distributed to Shadow DOM, some renderers might be gone in
processing deletion. To fix them, we should call isContentEditable() instead of rendererIsEditable().

Test: editing/shadow/delete-list-in-shadow.html

* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doApply):

LayoutTests:

* editing/shadow/delete-list-in-shadow-expected.txt: Added.
* editing/shadow/delete-list-in-shadow.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121211 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/editing/shadow/delete-list-in-shadow-expected.txt [new file with mode: 0644]
LayoutTests/editing/shadow/delete-list-in-shadow.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/DeleteFromTextNodeCommand.cpp

index 92a4f96..c65e661 100644 (file)
@@ -1,3 +1,13 @@
+2012-06-25  Shinya Kawanaka  <shinyak@chromium.org>
+
+        [Shadow] Deleting list distributed to Shadow DOM does not work correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=89170
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/shadow/delete-list-in-shadow-expected.txt: Added.
+        * editing/shadow/delete-list-in-shadow.html: Added.
+
 2012-06-25  Kent Tamura  <tkent@chromium.org>
 
         Unreviewed, rolling out r121145.
diff --git a/LayoutTests/editing/shadow/delete-list-in-shadow-expected.txt b/LayoutTests/editing/shadow/delete-list-in-shadow-expected.txt
new file mode 100644 (file)
index 0000000..bc6e69c
--- /dev/null
@@ -0,0 +1,9 @@
+Elements distributed to Shadow DOM should be deleted correctly when pressing delete key.
+
+To test manually, select somewhere in ABCDE from somehwere in 12345, and press delete, and check the selected text is deleted correctly.
+
+PASS hostTextContent is 'AB345'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/editing/shadow/delete-list-in-shadow.html b/LayoutTests/editing/shadow/delete-list-in-shadow.html
new file mode 100644 (file)
index 0000000..1f76bfd
--- /dev/null
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../fast/dom/shadow/resources/polyfill.js"></script>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+
+<p>Elements distributed to Shadow DOM should be deleted correctly when pressing delete key.</p>
+<p>To test manually, select somewhere in ABCDE from somehwere in 12345, and press delete, and check the selected text is deleted correctly.</p>
+
+<div id="container">
+    <ol id="host" contenteditable>
+        <li id="list1">ABCDE</li>
+        <li id="list2">abcde</li>
+        <li id="list3">12345</li>
+    </ol>
+</div>
+<pre id="console"></pre>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var shadowRoot = new WebKitShadowRoot(host);
+var li = document.createElement('li');
+li.innerHTML = 'hogehoge';
+shadowRoot.appendChild(li);
+shadowRoot.appendChild(document.createElement('shadow'));
+
+if (window.eventSender) {
+    eventSender.mouseMoveTo(list1.offsetLeft + 20, list1.offsetTop + list1.offsetHeight / 2);
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(list3.offsetLeft + 20, list3.offsetTop + list3.offsetHeight / 2);
+    eventSender.mouseUp();
+
+    eventSender.keyDown('delete');
+
+    var hostTextContent = host.textContent.replace(/^\s+|\s+$/g, '');
+    shouldBe("hostTextContent", "'AB345'");
+    container.innerHTML = "";
+}
+</script>
+
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 770e273..4c54d17 100644 (file)
@@ -1,3 +1,18 @@
+2012-06-25  Shinya Kawanaka  <shinyak@chromium.org>
+
+        [Shadow] Deleting list distributed to Shadow DOM does not work correctly.
+        https://bugs.webkit.org/show_bug.cgi?id=89170
+
+        Reviewed by Ryosuke Niwa.
+
+        When deleting several elements distributed to Shadow DOM, some renderers might be gone in
+        processing deletion. To fix them, we should call isContentEditable() instead of rendererIsEditable().
+
+        Test: editing/shadow/delete-list-in-shadow.html
+
+        * editing/DeleteFromTextNodeCommand.cpp:
+        (WebCore::DeleteFromTextNodeCommand::doApply):
+
 2012-06-25  Min Qin  <qinmin@chromium.org>
 
         [Chromium] Fix the css stylesheet for android media controls after recent changes
index eafd8f7..786d61f 100644 (file)
@@ -47,7 +47,7 @@ void DeleteFromTextNodeCommand::doApply()
 {
     ASSERT(m_node);
 
-    if (!m_node->rendererIsEditable())
+    if (!m_node->isContentEditable())
         return;
 
     ExceptionCode ec = 0;