LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Jan 2007 01:13:37 +0000 (01:13 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Jan 2007 01:13:37 +0000 (01:13 +0000)
        Reviewed by harrison

        <rdar://problem/4960137>
        ASSERTION FAILURE calling SelectionController::setBaseAndExtent (11833)

        * editing/selection/4960137-expected.checksum: Added.
        * editing/selection/4960137-expected.png: Added.
        * editing/selection/4960137-expected.txt: Added.
        * editing/selection/4960137.html: Added.

WebCore:

        Reviewed by harrison

        <rdar://problem/4960137>
        ASSERTION FAILURE calling SelectionController::setBaseAndExtent (11833)

        * editing/SelectionController.cpp:
        (WebCore::SelectionController::setSelection): Hand off the selection
        to the selectionController responsible for it, instead of asserting.
        A selection object can't be constructed with endpoints in different
        documents, so this code is only necessary for one endpoint.

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

LayoutTests/ChangeLog
LayoutTests/editing/selection/4960137-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/4960137-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/4960137-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/4960137.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/SelectionController.cpp

index 4d5c84f..05c1255 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-29  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        <rdar://problem/4960137>
+        ASSERTION FAILURE calling SelectionController::setBaseAndExtent (11833)
+
+        * editing/selection/4960137-expected.checksum: Added.
+        * editing/selection/4960137-expected.png: Added.
+        * editing/selection/4960137-expected.txt: Added.
+        * editing/selection/4960137.html: Added.
+
 2007-01-29  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Geoff.
diff --git a/LayoutTests/editing/selection/4960137-expected.checksum b/LayoutTests/editing/selection/4960137-expected.checksum
new file mode 100644 (file)
index 0000000..b2df39a
--- /dev/null
@@ -0,0 +1 @@
+159e24ae35142ed29790dce852fb27d0
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/4960137-expected.png b/LayoutTests/editing/selection/4960137-expected.png
new file mode 100644 (file)
index 0000000..8a2d5fe
Binary files /dev/null and b/LayoutTests/editing/selection/4960137-expected.png differ
diff --git a/LayoutTests/editing/selection/4960137-expected.txt b/LayoutTests/editing/selection/4960137-expected.txt
new file mode 100644 (file)
index 0000000..5955ade
--- /dev/null
@@ -0,0 +1,19 @@
+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 {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 659x18
+          text run at (0,0) width 659: "This tests for an ASSERTion failure when setting the main frame's selection inside a node in a subframe."
+      RenderBlock (anonymous) at (0,34) size 784x150
+        RenderPartObject {IFRAME} at (0,0) size 300x150
+          layer at (0,0) size 300x150
+            RenderView at (0,0) size 300x150
+          layer at (0,0) size 300x150
+            RenderBlock {HTML} at (0,0) size 300x150
+              RenderBody {BODY} at (8,8) size 284x134
+                RenderText {#text} at (0,0) size 72x18
+                  text run at (0,0) width 72: "hello world"
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/editing/selection/4960137.html b/LayoutTests/editing/selection/4960137.html
new file mode 100644 (file)
index 0000000..488706a
--- /dev/null
@@ -0,0 +1,9 @@
+<p>This tests for an ASSERTion failure when setting the main frame's selection inside a node in a subframe.</p>
+<iframe src="data:text/html, <body contenteditable='true'>hello world</div>"></iframe>
+<script>
+window.onload = function() {
+    var body = frames[0].document.body;
+    frames[0].focus();
+    getSelection().setBaseAndExtent(body, 0, body, body.childNodes.length);
+}
+</script>
index 7f996fd..c4040c4 100644 (file)
@@ -1,3 +1,16 @@
+2007-01-29  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/4960137>
+        ASSERTION FAILURE calling SelectionController::setBaseAndExtent (11833)
+
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::setSelection): Hand off the selection
+        to the selectionController responsible for it, instead of asserting.
+        A selection object can't be constructed with endpoints in different 
+        documents, so this code is only necessary for one endpoint.
+
 2007-01-29  Ada Chan  <adachan@apple.com>
 
         Reviewed by Brady.
index f1d3ce8..4373fe1 100644 (file)
@@ -105,10 +105,10 @@ void SelectionController::setSelection(const Selection& s, bool closeTyping, boo
         return;
     }
     
-    ASSERT(!s.base().node() || s.base().node()->document() == m_frame->document());
-    ASSERT(!s.extent().node() || s.extent().node()->document() == m_frame->document());
-    ASSERT(!s.start().node() || s.start().node()->document() == m_frame->document());
-    ASSERT(!s.end().node() || s.end().node()->document() == m_frame->document());
+    if (s.base().node() && s.base().node()->document() != m_frame->document()) {
+        s.base().node()->document()->frame()->selectionController()->setSelection(s, closeTyping, clearTypingStyle, userTriggered);
+        return;
+    }
     
     if (closeTyping)
         TypingCommand::closeTyping(m_frame->editor()->lastEditCommand());