Reviewed by Chris
Fix for this bug:
<rdar://problem/3820349> REGRESSION (Mail): select all, delete does not always delete everything
* khtml/editing/htmlediting.cpp:
(khtml::DeleteSelectionCommand::startPositionForDelete): New helper that determines when to
expand the selection outwards when the selection is on the visible boundary of a root
editable element. This fixes the bug. Note that this function also contains a little code
I factored out of doApply: it also takes care of adjusting the selection in the smart delete case.
(khtml::DeleteSelectionCommand::endPositionForDelete): Ditto.
(khtml::DeleteSelectionCommand::doApply): Call new helpers. Refactored out the code as described.
* khtml/editing/htmlediting.h: Declare new helpers.
* layout-tests/editing/deleting/delete-select-all-001-expected.txt: Added.
* layout-tests/editing/deleting/delete-select-all-001.html: Added.
* layout-tests/editing/deleting/delete-select-all-002-expected.txt: Added.
* layout-tests/editing/deleting/delete-select-all-002.html: Added.
* layout-tests/editing/deleting/delete-select-all-003-expected.txt: Added.
* layout-tests/editing/deleting/delete-select-all-003.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/editing/deleting/delete-select-all-002.html b/LayoutTests/editing/deleting/delete-select-all-002.html
new file mode 100644
index 0000000..3e6f711
--- /dev/null
+++ b/LayoutTests/editing/deleting/delete-select-all-002.html
@@ -0,0 +1,48 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+ word-wrap: break-word;
+ -khtml-nbsp-mode: space;
+ -khtml-line-break: after-white-space;
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ selectAllCommand();
+ deleteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+
+<!--
+
+Expected results:
+
+All the content in the contenteditable div should be deleted,
+including the "you can't see this." span.
+
+-->
+
+</head>
+<body>
+<div contenteditable id="root" class="editing">
+<span style="display: hidden">you can't see this.</span>
+<span id="test">you can see this.</span>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>