2011-03-09 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2011 21:19:29 +0000 (21:19 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2011 21:19:29 +0000 (21:19 +0000)
        Reviewed by Ryosuke Niwa.

        Deleting content directly following a button inserts an unnecessary placeholder
        https://bugs.webkit.org/show_bug.cgi?id=56053

        Test to ensure unnecessary placeholders aren't inserted after buttons when delete is pressed.

        * editing/deleting/delete-inserts-br-after-button-expected.txt: Added.
        * editing/deleting/delete-inserts-br-after-button.html: Added.
2011-03-09  Levi Weintraub  <leviw@chromium.org>

        Reviewed by Ryosuke Niwa.

        Deleting content directly following a button inserts an unnecessary placeholder
        https://bugs.webkit.org/show_bug.cgi?id=56053

        Fixing a use of Node's enclosingBlockFlowElement with enclosingBlock htmlediting's
        enclosingBlock, as enclosingBlockFlowElement would return inline-block elements despite
        DeleteSelectionCommand treating them as blockflow.

        Test: editing/deleting/delete-inserts-br-after-button.html

        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::mergeParagraphs):

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

LayoutTests/ChangeLog
LayoutTests/editing/deleting/delete-inserts-br-after-button-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/delete-inserts-br-after-button.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/DeleteSelectionCommand.cpp

index b92c366..e075a40 100644 (file)
@@ -1,3 +1,15 @@
+2011-03-09  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Deleting content directly following a button inserts an unnecessary placeholder
+        https://bugs.webkit.org/show_bug.cgi?id=56053
+
+        Test to ensure unnecessary placeholders aren't inserted after buttons when delete is pressed.
+
+        * editing/deleting/delete-inserts-br-after-button-expected.txt: Added.
+        * editing/deleting/delete-inserts-br-after-button.html: Added.
+
 2011-03-14  David Hyatt  <hyatt@apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/editing/deleting/delete-inserts-br-after-button-expected.txt b/LayoutTests/editing/deleting/delete-inserts-br-after-button-expected.txt
new file mode 100644 (file)
index 0000000..cf74d9b
--- /dev/null
@@ -0,0 +1,3 @@
+This tests to see if a line break is incorrectly inserted when you delete the content directly following a button.
+buttonthis text should be on the same line as the button
+PASS
diff --git a/LayoutTests/editing/deleting/delete-inserts-br-after-button.html b/LayoutTests/editing/deleting/delete-inserts-br-after-button.html
new file mode 100644 (file)
index 0000000..853ddaf
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html> 
+<html>
+<body>
+<div>This tests to see if a line break is incorrectly inserted when you delete the content directly following a button.</div>
+<div id="container" contenteditable="true"><button>button</button> this text should be on the same line as the button</div>
+<div id="result">FAIL</div>
+</body>
+<script>
+var target = document.getElementById("container");
+window.getSelection().setPosition(target, 1);
+window.getSelection().modify("move", "right", "character");
+document.execCommand("delete");
+if (target.childNodes.length == 2)
+    document.getElementById("result").innerHTML = "PASS";
+if (window.layoutTestController)
+    window.layoutTestController.dumpAsText();
+</script> 
+</html>
index aa2ca2f..93654ed 100644 (file)
@@ -1,3 +1,19 @@
+2011-03-09  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Ryosuke Niwa.
+
+        Deleting content directly following a button inserts an unnecessary placeholder
+        https://bugs.webkit.org/show_bug.cgi?id=56053
+
+        Fixing a use of Node's enclosingBlockFlowElement with enclosingBlock htmlediting's
+        enclosingBlock, as enclosingBlockFlowElement would return inline-block elements despite
+        DeleteSelectionCommand treating them as blockflow.
+
+        Test: editing/deleting/delete-inserts-br-after-button.html
+
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::mergeParagraphs):
+
 2011-03-14  David Hyatt  <hyatt@apple.com>
 
         Reviewed by Dan Bernstein.
index 065ec17..99b64b2 100644 (file)
@@ -592,7 +592,7 @@ void DeleteSelectionCommand::mergeParagraphs()
     }
     
     // We need to merge into m_upstreamStart's block, but it's been emptied out and collapsed by deletion.
-    if (!mergeDestination.deepEquivalent().deprecatedNode() || !mergeDestination.deepEquivalent().deprecatedNode()->isDescendantOf(m_upstreamStart.deprecatedNode()->enclosingBlockFlowElement()) || m_startsAtEmptyLine) {
+    if (!mergeDestination.deepEquivalent().deprecatedNode() || !mergeDestination.deepEquivalent().deprecatedNode()->isDescendantOf(enclosingBlock(m_upstreamStart.containerNode())) || m_startsAtEmptyLine) {
         insertNodeAt(createBreakElement(document()).get(), m_upstreamStart);
         mergeDestination = VisiblePosition(m_upstreamStart);
     }