Reviewed by justin
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Dec 2005 09:00:52 +0000 (09:00 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Dec 2005 09:00:52 +0000 (09:00 +0000)
        Updated/added tests for:
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=4003>
        contentEditable div cannot be edited if it starts out with empty or <p/>

        * editing/deleting/delete-3775172-fix-expected.txt: Fixed.
        * editing/inserting/editing-empty-divs-expected.checksum: Added.
        * editing/inserting/editing-empty-divs-expected.png: Added.
        * editing/inserting/editing-empty-divs-expected.txt: Added.
        * editing/inserting/editing-empty-divs.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/editing/deleting/delete-3775172-fix-expected.txt
LayoutTests/editing/inserting/editing-empty-divs-expected.checksum [new file with mode: 0644]
LayoutTests/editing/inserting/editing-empty-divs-expected.png [new file with mode: 0644]
LayoutTests/editing/inserting/editing-empty-divs-expected.txt [new file with mode: 0644]
LayoutTests/editing/inserting/editing-empty-divs.html [new file with mode: 0644]

index c0c1caa37fe9cfc5479d9fc983e53ab9ccb4b2af..2b63bde5bfb4fb3e6a20235457205913f6a05f31 100644 (file)
@@ -1,3 +1,17 @@
+2005-12-01  Graham Dennis  <Graham.Dennis@gmail.com>
+
+        Reviewed by justin
+        
+        Updated/added tests for:
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=4003>
+        contentEditable div cannot be edited if it starts out with empty or <p/>
+
+        * editing/deleting/delete-3775172-fix-expected.txt: Fixed.
+        * editing/inserting/editing-empty-divs-expected.checksum: Added.
+        * editing/inserting/editing-empty-divs-expected.png: Added.
+        * editing/inserting/editing-empty-divs-expected.txt: Added.
+        * editing/inserting/editing-empty-divs.html: Added.
+
 2005-12-01  Adele Peterson  <adele@apple.com>
 
         Added test for <rdar://problem/4356771> Regression: Mail always scrolls to the bottom of a message when replying/forwarding
index 76e766999d6d8be14b1b516180a96639a7360556..cf27b70a3bbe923e55cd9ea859afa87e460dbe63 100644 (file)
@@ -1,8 +1,8 @@
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document toDOMRange:range from 1 of #text > BODY > HTML > #document to 1 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text to 1 of #text toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text to 1 of #text toDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -10,6 +10,8 @@ layer 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
-        RenderBR {BR} at (0,0) size 0x18
-caret: position 0 of child 0 {BR} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+      RenderBlock (anonymous) at (0,0) size 784x0
+      RenderBlock {DIV} at (0,0) size 784x0
+        RenderInline {SPAN} at (0,0) size 0x0
+        RenderText {TEXT} at (0,0) size 0x0
+caret: position 0 of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/inserting/editing-empty-divs-expected.checksum b/LayoutTests/editing/inserting/editing-empty-divs-expected.checksum
new file mode 100644 (file)
index 0000000..5b1d301
--- /dev/null
@@ -0,0 +1 @@
+aec0ed73646b9acc6e3419a04ea9a482
\ No newline at end of file
diff --git a/LayoutTests/editing/inserting/editing-empty-divs-expected.png b/LayoutTests/editing/inserting/editing-empty-divs-expected.png
new file mode 100644 (file)
index 0000000..29f5268
Binary files /dev/null and b/LayoutTests/editing/inserting/editing-empty-divs-expected.png differ
diff --git a/LayoutTests/editing/inserting/editing-empty-divs-expected.txt b/LayoutTests/editing/inserting/editing-empty-divs-expected.txt
new file mode 100644 (file)
index 0000000..82d6fa0
--- /dev/null
@@ -0,0 +1,64 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of P > DIV > BODY > HTML > #document to 0 of P > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > P > DIV > BODY > HTML > #document to 1 of #text > P > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderCanvas 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 {P} at (0,0) size 784x36
+        RenderText {TEXT} at (0,0) size 772x36
+          text run at (0,0) width 562: "This tests the ability to start editing in blocks that are visible, but have little or no content. "
+          text run at (562,0) width 210: "Each of the divs below should be"
+          text run at (0,18) width 135: "able to accept a caret."
+      RenderBlock {P} at (0,52) size 784x18
+        RenderText {TEXT} at (0,0) size 176x18
+          text run at (0,0) width 176: "This div contains some text."
+      RenderBlock {DIV} at (0,86) size 707x22 [border: (1px dotted #0000FF)]
+        RenderText {TEXT} at (1,1) size 42x18
+          text run at (1,1) width 42: " chello"
+      RenderBlock {P} at (0,124) size 784x18
+        RenderText {TEXT} at (0,0) size 186x18
+          text run at (0,0) width 186: "This div is completely empty."
+      RenderBlock {DIV} at (0,158) size 707x22 [border: (1px dotted #0000FF)]
+        RenderText {TEXT} at (1,1) size 7x18
+          text run at (1,1) width 7: "c"
+      RenderBlock {P} at (0,196) size 784x18
+        RenderText {TEXT} at (0,0) size 340x18
+          text run at (0,0) width 340: "This div contains some collapsable whitespace (a '\\n')."
+      RenderBlock {DIV} at (0,230) size 707x22 [border: (1px dotted #0000FF)]
+        RenderText {TEXT} at (1,1) size 7x18
+          text run at (1,1) width 7: "c"
+      RenderBlock {P} at (0,268) size 784x18
+        RenderText {TEXT} at (0,0) size 234x18
+          text run at (0,0) width 234: "This div contains a self-closing p tag."
+      RenderBlock {DIV} at (0,302) size 707x52 [border: (1px dotted #0000FF)]
+        RenderBlock {P} at (1,17) size 705x18
+          RenderText {TEXT} at (0,0) size 7x18
+            text run at (0,0) width 7: "c"
+      RenderBlock {P} at (0,370) size 784x18
+        RenderText {TEXT} at (0,0) size 720x18
+          text run at (0,0) width 720: "This div contains a self-closing p tag and some collapsable whitespace (two '\\n's before and after the self closing p."
+      RenderBlock {DIV} at (0,404) size 707x36 [border: (1px dotted #0000FF)]
+        RenderBlock (anonymous) at (1,1) size 705x18
+          RenderText {TEXT} at (0,0) size 7x18
+            text run at (0,0) width 7: "c"
+        RenderBlock {P} at (1,35) size 705x0
+caret: position 1 of child 0 {TEXT} of child 21 {DIV} of child 3 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/inserting/editing-empty-divs.html b/LayoutTests/editing/inserting/editing-empty-divs.html
new file mode 100644 (file)
index 0000000..4e127c7
--- /dev/null
@@ -0,0 +1,51 @@
+<html>
+
+<head>
+<script>
+</script>
+</head>
+<style>
+div {
+    border: 1px dotted blue;
+    min-height: 20px;
+    width: 90%;
+}
+</style>
+
+<script>
+function foo() {
+    var selection = window.getSelection();
+    var bar = 1;
+    var divs = document.getElementsByTagName("div");
+    for (var i = 0; divs[i]; i++) {
+        selection.setPosition(divs[i], 0);
+        document.execCommand("InsertText", false, 'c');   
+    }
+}
+</script>
+<body onload="foo()">
+
+<p>This tests the ability to start editing in blocks that are visible, but have little or no content.  Each of the divs below should be able to accept a caret.</p>
+
+<p>This div contains some text.</p>
+<div contentEditable="true">
+hello
+</div>
+
+<p>This div is completely empty.</p>
+<div contentEditable="true"></div>
+
+<p>This div contains some collapsable whitespace (a '\n').</p>
+<div contentEditable="true">
+</div>
+
+<p>This div contains a self-closing p tag.</p>
+<div contentEditable="true"><p /></div>
+
+<p>This div contains a self-closing p tag and some collapsable whitespace (two '\n's before and after the self closing p.</p>
+<div contentEditable="true">
+<p />
+</div>
+
+</body>
+</html>