Reviewed by Justin.
Testcase for:
http://bugzilla.opendarwin.org/show_bug.cgi?id=10579
AppleStyleCommand::applyBlockStyle crash
* editing/style/table-selection-expected.checksum: Added.
* editing/style/table-selection-expected.png: Added.
* editing/style/table-selection-expected.txt: Added.
* editing/style/table-selection.html: Added.
WebCore:
Reviewed by Justin.
http://bugzilla.opendarwin.org/show_bug.cgi?id=10579
AppleStyleCommand::applyBlockStyle crash
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle): Prevent a crash by
making sure that the 'beyondEnd' node is after the start node.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16194
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-02 Graham Dennis <graham.dennis@gmail.com>
+
+ Reviewed by Justin.
+
+ Testcase for:
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=10579
+ AppleStyleCommand::applyBlockStyle crash
+
+ * editing/style/table-selection-expected.checksum: Added.
+ * editing/style/table-selection-expected.png: Added.
+ * editing/style/table-selection-expected.txt: Added.
+ * editing/style/table-selection.html: Added.
+
2006-09-01 Adele Peterson <adele@apple.com>
Reviewed by Tim Omernick.
--- /dev/null
+149cf71db7fafcb4a948a23d00b3a2ba
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 4 of BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 2 of TABLE > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 2 of TABLE > 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 784x74 [border: (2px solid #FF0000)]
+ RenderTable {TABLE} at (14,14) size 27x46
+ RenderTableSection {TBODY} at (0,0) size 27x46
+ RenderTableRow {TR} at (0,2) size 27x20
+ RenderTableCell {TD} at (2,2) size 23x20 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 21x18
+ text run at (1,1) width 21: "foo"
+ RenderTableRow {TR} at (0,24) size 27x20
+ RenderTableCell {TD} at (2,24) size 23x20 [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 20x18
+ text run at (1,1) width 20: "bar"
+selection start: position 1 of child 0 {#text} of child 0 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end: position 2 of child 1 {TABLE} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ var selection = window.getSelection();
+ selection.setPosition(document.getElementById("selStart"), 0);
+ extendSelectionForwardByLineCommand();
+ extendSelectionForwardByLineCommand();
+ justifyCenterCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body id="root" contenteditable>
+<div id="test" class="editing">
+<table> <tr> <td id="selStart"> foo </td> </tr> <tr> <td id="selEnd"> bar </td> </tr> </table>
+</div>
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
+2006-09-02 Graham Dennis <graham.dennis@gmail.com>
+
+ Reviewed by Justin.
+
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=10579
+ AppleStyleCommand::applyBlockStyle crash
+
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyBlockStyle): Prevent a crash by
+ making sure that the 'beyondEnd' node is after the start node.
+
2006-09-02 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Reviewed by Tim H.
// Also, gather up all the nodes we want to process in a DeprecatedPtrList before
// doing anything. This averts any bugs iterating over these nodes
// once you start removing and applying style.
- Node *beyondEnd = end.node()->traverseNextNode();
+
+ // If the end node is before the start node (can only happen if the end node is
+ // an ancestor of the start node), we gather nodes up to the next sibling of the end node
+ Node *beyondEnd;
+ if (start.node()->isAncestor(end.node()))
+ beyondEnd = end.node()->traverseNextSibling();
+ else
+ beyondEnd = end.node()->traverseNextNode();
+
DeprecatedPtrList<Node> nodes;
for (Node *node = start.node(); node != beyondEnd; node = node->traverseNextNode())
nodes.append(node);