LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2006 01:08:36 +0000 (01:08 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2006 01:08:36 +0000 (01:08 +0000)
        Reviewed by john

        * editing/execCommand/create-list-with-hr-expected.checksum: Added.
        * editing/execCommand/create-list-with-hr-expected.png: Added.
        * editing/execCommand/create-list-with-hr-expected.txt: Added.
        * editing/execCommand/create-list-with-hr.html: Added.

WebCore:

        Reviewed by john

        <rdar://problem/4755287>
        Writely Editor: Crash occurs at WebCore::maxDeepOffset(WebCore::Node const*) when attempting to create a OL/UL following a HR element

        * editing/markup.cpp:
        (WebCore::createMarkup): Migrate to isBlock (isBlockFlow is true for inline replaced
        elements).  Don't skip blocks that aren't containers (like horizontal rules).

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

LayoutTests/ChangeLog
LayoutTests/editing/execCommand/create-list-with-hr-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/create-list-with-hr-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/create-list-with-hr-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/create-list-with-hr.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/markup.cpp

index 27d415e..d49d3d6 100644 (file)
@@ -1,3 +1,12 @@
+2006-10-02  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by john
+
+        * editing/execCommand/create-list-with-hr-expected.checksum: Added.
+        * editing/execCommand/create-list-with-hr-expected.png: Added.
+        * editing/execCommand/create-list-with-hr-expected.txt: Added.
+        * editing/execCommand/create-list-with-hr.html: Added.
+
 2006-10-02  Beth Dakin  <bdakin@apple.com>
 
         Minor harassment followed by abject surrender provided by ggggaren.
diff --git a/LayoutTests/editing/execCommand/create-list-with-hr-expected.checksum b/LayoutTests/editing/execCommand/create-list-with-hr-expected.checksum
new file mode 100644 (file)
index 0000000..42ce13e
--- /dev/null
@@ -0,0 +1 @@
+d0c9c527856faa16407edf5a05f9ec01
\ No newline at end of file
diff --git a/LayoutTests/editing/execCommand/create-list-with-hr-expected.png b/LayoutTests/editing/execCommand/create-list-with-hr-expected.png
new file mode 100644 (file)
index 0000000..0e5af78
Binary files /dev/null and b/LayoutTests/editing/execCommand/create-list-with-hr-expected.png differ
diff --git a/LayoutTests/editing/execCommand/create-list-with-hr-expected.txt b/LayoutTests/editing/execCommand/create-list-with-hr-expected.txt
new file mode 100644 (file)
index 0000000..b9c218d
--- /dev/null
@@ -0,0 +1,33 @@
+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: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 49 of #text > B > P > BODY > HTML > #document to 49 of #text > B > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x576
+      RenderBlock {P} at (0,0) size 784x54
+        RenderText {#text} at (0,0) size 514x18
+          text run at (0,0) width 514: "This test pushes a horizontal rule into an unordered list with InsertUnorderedList. "
+        RenderInline {B} at (0,0) size 771x36
+          RenderText {#text} at (514,0) size 771x36
+            text run at (514,0) width 257: "The fact that the horizontal rule is put"
+            text run at (0,18) width 550: "into ans unnecessary div when it's pushed into the list might be considered a bug. "
+        RenderInline {B} at (0,0) size 732x36
+          RenderText {#text} at (550,18) size 732x36
+            text run at (550,18) width 182: "The fact that the caret isn't"
+            text run at (0,36) width 127: "preserved is a bug."
+      RenderBlock {DIV} at (0,70) size 784x28
+        RenderBlock {UL} at (0,0) size 784x28
+          RenderListItem {LI} at (40,0) size 744x28
+            RenderBlock (anonymous) at (0,0) size 744x18
+              RenderListMarker at (-17,0) size 7x18
+            RenderBlock {DIV} at (0,26) size 744x2
+              RenderBlock {HR} at (0,0) size 744x2 [border: (1px inset #000000)]
+            RenderBlock (anonymous) at (0,36) size 744x0
+        RenderBlock (anonymous) at (0,44) size 784x0
+caret: position 49 of child 0 {#text} of child 2 {B} of child 0 {P} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/execCommand/create-list-with-hr.html b/LayoutTests/editing/execCommand/create-list-with-hr.html
new file mode 100644 (file)
index 0000000..5a26da1
--- /dev/null
@@ -0,0 +1,10 @@
+<p>This test pushes a horizontal rule into an unordered list with InsertUnorderedList. <b>The fact that the horizontal rule is put into an unnecessary div when it's pushed into the list might be considered a bug. </b><b>The fact that the caret isn't preserved is a bug.</b></p>
+<div contenteditable="true" id="div"><hr></div>
+
+<script>
+var div = document.getElementById("div");
+var sel = window.getSelection();
+
+sel.setPosition(div, 0);
+document.execCommand("InsertUnorderedList");
+</script>
\ No newline at end of file
index a18e2f4..34ef0bd 100644 (file)
@@ -1,3 +1,14 @@
+2006-10-02  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by john
+        
+        <rdar://problem/4755287>
+        Writely Editor: Crash occurs at WebCore::maxDeepOffset(WebCore::Node const*) when attempting to create a OL/UL following a HR element
+
+        * editing/markup.cpp:
+        (WebCore::createMarkup): Migrate to isBlock (isBlockFlow is true for inline replaced 
+        elements).  Don't skip blocks that aren't containers (like horizontal rules).
+
 2006-10-03  Darin Adler  <darin@apple.com>
 
         Reviewed by Justin Garcia.
index 3b3986f..67ffb2f 100644 (file)
@@ -353,8 +353,8 @@ DeprecatedString createMarkup(const Range *range, Vector<Node*>* nodes, EAnnotat
     for (Node *n = startNode; n != pastEnd; n = next) {
         next = n->traverseNextNode();
 
-        if (n->isBlockFlow() && next == pastEnd)
-            // Don't write out an empty block.
+        if (isBlock(n) && canHaveChildrenForEditing(n) && next == pastEnd)
+            // Don't write out empty block containers that aren't fully selected.
             continue;
         
         // Add the node to the markup.