LayoutTests:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jul 2006 13:14:17 +0000 (13:14 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jul 2006 13:14:17 +0000 (13:14 +0000)
        Reviewed by Darin.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9905
          REGRESSION (r15404-r15415): Repro crash when pressing delete in an empty editable div

        * editing/deleting/delete-at-start-or-end-expected.checksum: Added.
        * editing/deleting/delete-at-start-or-end-expected.png: Added.
        * editing/deleting/delete-at-start-or-end-expected.txt: Added.
        * editing/deleting/delete-at-start-or-end.html: Added.

WebCore:

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9905
          REGRESSION (r15404-r15415): Repro crash when pressing delete in an empty editable div

        Test: editing/deleting/delete-at-start-or-end.html

        * editing/TypingCommand.cpp:
        (WebCore::TypingCommand::deleteKeyPressed): Added null check.
        (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.

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

LayoutTests/ChangeLog
LayoutTests/editing/deleting/delete-at-start-or-end-expected.checksum [new file with mode: 0644]
LayoutTests/editing/deleting/delete-at-start-or-end-expected.png [new file with mode: 0644]
LayoutTests/editing/deleting/delete-at-start-or-end-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/delete-at-start-or-end.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/TypingCommand.cpp

index ec328484ec6fec19eed43e1a55f126f7c2312e37..038ba3ed5fbe43ad0bd6f514becded93979b396b 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-14  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9905
+          REGRESSION (r15404-r15415): Repro crash when pressing delete in an empty editable div
+
+        * editing/deleting/delete-at-start-or-end-expected.checksum: Added.
+        * editing/deleting/delete-at-start-or-end-expected.png: Added.
+        * editing/deleting/delete-at-start-or-end-expected.txt: Added.
+        * editing/deleting/delete-at-start-or-end.html: Added.
+
 2006-07-14  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/editing/deleting/delete-at-start-or-end-expected.checksum b/LayoutTests/editing/deleting/delete-at-start-or-end-expected.checksum
new file mode 100644 (file)
index 0000000..3d34f8d
--- /dev/null
@@ -0,0 +1 @@
+8a9b3e46242b36500276135ba1c29d62
\ No newline at end of file
diff --git a/LayoutTests/editing/deleting/delete-at-start-or-end-expected.png b/LayoutTests/editing/deleting/delete-at-start-or-end-expected.png
new file mode 100644 (file)
index 0000000..f5e50a3
Binary files /dev/null and b/LayoutTests/editing/deleting/delete-at-start-or-end-expected.png differ
diff --git a/LayoutTests/editing/deleting/delete-at-start-or-end-expected.txt b/LayoutTests/editing/deleting/delete-at-start-or-end-expected.txt
new file mode 100644 (file)
index 0000000..5861a9f
--- /dev/null
@@ -0,0 +1,16 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x18
+caret: position 0 of child 0 {DIV} of child 2 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/deleting/delete-at-start-or-end.html b/LayoutTests/editing/deleting/delete-at-start-or-end.html
new file mode 100644 (file)
index 0000000..246fda6
--- /dev/null
@@ -0,0 +1,15 @@
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+<script>
+function editingTest() {
+    var selection = window.getSelection();
+    var s = document.getElementById("test");
+    selection.setPosition(s, 0);
+    execDeleteCommand();
+    execForwardDeleteCommand();
+}
+</script>
+<div contenteditable="true" id="test">
+</div>
+<script>
+runEditingTest();
+</script>
index 6f013d44ba9f7486a8893e3e06a0b70f41513b8c..31a59da8cad9ace184dcdab926ddcfe23bba7b12 100644 (file)
@@ -1,3 +1,16 @@
+2006-07-14  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9905
+          REGRESSION (r15404-r15415): Repro crash when pressing delete in an empty editable div
+
+        Test: editing/deleting/delete-at-start-or-end.html
+
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::deleteKeyPressed): Added null check.
+        (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
+
 2006-07-14  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by Geoffrey.
index aceec240ad30a4287b0082c07ee6cee3913d48c2..278e854c0057b9ed5ecc3e8126665e3cd9c70105 100644 (file)
@@ -340,7 +340,7 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity)
             if (visibleStart == startOfParagraph(visibleStart))
                 upstreamStart = visibleStart.previous(true).deepEquivalent().upstream();
             // When deleting tables: Select the table first, then perform the deletion
-            if (upstreamStart.node()->renderer() && upstreamStart.node()->renderer()->isTable() && upstreamStart.offset() == maxDeepOffset(upstreamStart.node())) {
+            if (upstreamStart.node() && upstreamStart.node()->renderer() && upstreamStart.node()->renderer()->isTable() && upstreamStart.offset() == maxDeepOffset(upstreamStart.node())) {
                 setEndingSelection(Selection(Position(upstreamStart.node(), 0), endingSelection().start(), DOWNSTREAM));
                 typingAddedToOpenCommand();
                 return;
@@ -384,7 +384,7 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity)
             if (visibleEnd == endOfParagraph(visibleEnd))
                 downstreamEnd = visibleEnd.next(true).deepEquivalent().downstream();
             // When deleting tables: Select the table first, then perform the deletion
-            if (downstreamEnd.node()->renderer() && downstreamEnd.node()->renderer()->isTable() && downstreamEnd.offset() == 0) {
+            if (downstreamEnd.node() && downstreamEnd.node()->renderer() && downstreamEnd.node()->renderer()->isTable() && downstreamEnd.offset() == 0) {
                 setEndingSelection(Selection(endingSelection().end(), Position(downstreamEnd.node(), maxDeepOffset(downstreamEnd.node())), DOWNSTREAM));
                 typingAddedToOpenCommand();
                 return;