Reviewed by Eric.
authorbdakin <bdakin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Apr 2006 18:50:02 +0000 (18:50 +0000)
committerbdakin <bdakin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Apr 2006 18:50:02 +0000 (18:50 +0000)
        Fix for <rdar://problem/4513383> REGRESSION: Crash in
        WebCore::shouldEmitTabBeforeNode() when iterating through document
        text

        * editing/TextIterator.cpp:
        (WebCore::shouldEmitTabBeforeNode): Need to nil-check the renderer.

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

LayoutTests/ChangeLog
LayoutTests/fast/text/textIteratorNilRenderer-expected.checksum [new file with mode: 0644]
LayoutTests/fast/text/textIteratorNilRenderer-expected.png [new file with mode: 0644]
LayoutTests/fast/text/textIteratorNilRenderer-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/textIteratorNilRenderer.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/TextIterator.cpp

index bf8da353daf5c650fec08d88cf2f7a0ea734310d..dac101004210a97c361990c9049a1b34b5a6c2c8 100644 (file)
@@ -1,3 +1,16 @@
+2006-04-24  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Eric.
+
+        Layout test for <rdar://problem/4513383> REGRESSION: Crash in 
+        WebCore::shouldEmitTabBeforeNode() when iterating through document 
+        text
+
+        * fast/text/textIteratorNilRenderer-expected.checksum: Added.
+        * fast/text/textIteratorNilRenderer-expected.png: Added.
+        * fast/text/textIteratorNilRenderer-expected.txt: Added.
+        * fast/text/textIteratorNilRenderer.html: Added.
+
 2006-04-23  Rob Buis  <buis@kde.org>
 
         Reviewed by hyatt.  Landed by eseidel.
diff --git a/LayoutTests/fast/text/textIteratorNilRenderer-expected.checksum b/LayoutTests/fast/text/textIteratorNilRenderer-expected.checksum
new file mode 100644 (file)
index 0000000..839b22c
--- /dev/null
@@ -0,0 +1 @@
+9b2e83c0902ce73e46b8f860d9874b86
\ No newline at end of file
diff --git a/LayoutTests/fast/text/textIteratorNilRenderer-expected.png b/LayoutTests/fast/text/textIteratorNilRenderer-expected.png
new file mode 100644 (file)
index 0000000..8c71054
Binary files /dev/null and b/LayoutTests/fast/text/textIteratorNilRenderer-expected.png differ
diff --git a/LayoutTests/fast/text/textIteratorNilRenderer-expected.txt b/LayoutTests/fast/text/textIteratorNilRenderer-expected.txt
new file mode 100644 (file)
index 0000000..6136f8a
--- /dev/null
@@ -0,0 +1,58 @@
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 2 of #text > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document to 0 of INPUT > LABEL > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document to 0 of INPUT > LABEL > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document to 0 of INPUT > LABEL > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document to 0 of INPUT > LABEL > TD > TR > TBODY > TABLE > FORM > CENTER > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 {CENTER} at (0,0) size 784x57
+        RenderBlock {FORM} at (0,0) size 784x23
+          RenderTable {TABLE} at (41,0) size 701x23
+            RenderTableSection {TBODY} at (0,0) size 701x23
+              RenderTableRow {TR} at (0,0) size 701x23
+                RenderTableCell {TD} at (0,2) size 150x18 [r=0 c=0 rs=2 cs=1]
+                  RenderText {#text} at (0,0) size 4x18
+                    text run at (0,0) width 4: " "
+                RenderTableCell {TD} at (150,0) size 291x23 [r=0 c=1 rs=1 cs=1]
+                  RenderTextField {INPUT} at (2,2) size 287x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+                  RenderText {#text} at (0,0) size 0x0
+                RenderTableCell {TD} at (441,0) size 100x22 [r=0 c=2 rs=1 cs=1]
+                  RenderButton {INPUT} at (2,2) size 96x18 [bgcolor=#C0C0C0]
+                    RenderBlock (anonymous) at (8,2) size 80x13
+                      RenderText at (0,0) size 80x13
+                        text run at (0,0) width 80: "Search Froogle"
+                  RenderText {#text} at (0,0) size 0x0
+                RenderTableCell {TD} at (541,2) size 160x18 [r=0 c=3 rs=2 cs=1]
+                  RenderInline {LABEL} at (0,0) size 117x13
+                    RenderText {#text} at (0,0) size 0x0
+                    RenderBlock {INPUT} at (13,3) size 12x12
+                    RenderText {#text} at (28,3) size 99x13
+                      text run at (28,3) width 99: " Remember this location"
+                  RenderText {#text} at (0,0) size 0x0
+        RenderBlock (anonymous) at (0,39) size 784x18
+          RenderBR {BR} at (392,0) size 0x18
+layer at (204,13) size 281x13
+  RenderBlock {DIV} at (3,3) size 281x13
+selection start: position 0 of child 0 {#text} of child 0 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {FORM} of child 1 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 0 of child 1 {INPUT} of child 3 {LABEL} of child 4 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {FORM} of child 1 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/fast/text/textIteratorNilRenderer.html b/LayoutTests/fast/text/textIteratorNilRenderer.html
new file mode 100644 (file)
index 0000000..dcc7d09
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+<head>
+<style>
+    #qt .addr{display:none}
+</style>
+</head>
+
+<body>
+<center>
+
+<form name=f action="/froogle">
+
+<table cellpadding=0 cellspacing=0 id=qt class=hide-addr>
+<tr>
+<td width=150 rowspan=2>&nbsp;
+<td>
+<input maxlength=256 name=q id=q size=40 value="">
+<td class=addr>
+<input type=text name=addr id=addr value="" disabled>
+
+<td>
+<input name=btnG type=submit id=submit_button value="Search Froogle">
+<td width=150 rowspan=2 style="font-size:x-small;padding-left:1em;">
+<input type=hidden name=sl id=sl value=off disabled>
+<label>
+<input type=checkbox onclick="this.form.elements.sl.value=this.checked?'on':'off'">
+Remember this location
+</label>
+</table>
+</form>
+</table>
+<br>
+</center>
+
+<script>
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(250,20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(150, 20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(250,20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(150, 20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(250,20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(150, 20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(250,20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(150, 20);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+       }
+</script>
+
+</body>
+</html>
index e9cf1c72be565f195ff8aff9031f0d30be77326a..13293229733158be33606de33347409193393cab 100644 (file)
@@ -1,3 +1,14 @@
+2006-04-24  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Eric.
+
+        Fix for <rdar://problem/4513383> REGRESSION: Crash in 
+        WebCore::shouldEmitTabBeforeNode() when iterating through document 
+        text
+
+        * editing/TextIterator.cpp:
+        (WebCore::shouldEmitTabBeforeNode): Need to nil-check the renderer.
+
 2006-04-23  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin.
index baaa65fd104a479b8eeae1201566ab44270abf2c..87ee52892d60c019879dd66a3a31eaf636206003 100644 (file)
@@ -363,12 +363,13 @@ static bool isTableCell(Node* node)
 
 static bool shouldEmitTabBeforeNode(Node* node)
 {
+    RenderObject* r = node->renderer();
+    
     // Table cells are delimited by tabs.
-    if (!isTableCell(node))
+    if (!r || !isTableCell(node))
         return false;
     
     // Want a tab before every cell other than the first one
-    RenderObject* r = node->renderer();
     RenderTableCell* rc = static_cast<RenderTableCell*>(r);
     RenderTable* t = rc->table();
     return t && (t->cellBefore(rc) || t->cellAbove(rc));