+2006-09-14 Graham Dennis <graham.dennis@gmail.com>
+
+ Reviewed by Justin Garcia.
+
+ Modified testcase for:
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=10726
+ Crash in ApplyStyleCommand::applyRelativeFontStyleChange
+
+ * editing/style/table-selection-expected.checksum:
+ * editing/style/table-selection-expected.png:
+ * editing/style/table-selection-expected.txt:
+ * editing/style/table-selection.html:
+ This testcase was for 10579, which is very similar to this bug (10726)
+ Now the testcase tests both bugs.
+
2006-09-13 Adam Roben <aroben@apple.com>
Rubberstamped by hyatt.
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
+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"
+ RenderBlock {DIV} at (0,0) size 784x78 [border: (2px solid #FF0000)]
+ RenderTable {TABLE} at (14,14) size 30x50
+ RenderTableSection {TBODY} at (0,0) size 30x50
+ RenderTableRow {TR} at (0,2) size 30x22
+ RenderTableCell {TD} at (2,2) size 26x22 [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 24x20
+ text run at (1,1) width 24: "foo"
+ RenderTableRow {TR} at (0,26) size 30x22
+ RenderTableCell {TD} at (2,26) size 26x22 [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (1,1) size 23x20
+ text run at (1,1) width 23: "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
end = endPosition();
}
- Node *beyondEnd = end.node()->traverseNextNode(); // Calculate loop end point.
+ // Calculate loop end point.
+ // 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();
+
start = start.upstream(); // Move upstream to ensure we do not add redundant spans.
Node *startNode = start.node();
if (startNode->isTextNode() && start.offset() >= startNode->caretMaxOffset()) // Move out of text node if range does not include its characters.