Commit cdacf131 authored by justing's avatar justing
Browse files

LayoutTests:

        Reviewed by john
        
        <rdar://problem/4747695> 
        Gmail Editor: Crash at WebCore::Range::startPosition() when decreasing a indent

        * editing/deleting/list-item-1-expected.checksum: Added.
        * editing/deleting/list-item-1-expected.png: Added.
        * editing/deleting/list-item-1-expected.txt: Added.
        * editing/deleting/list-item-1.html: Added.
        * editing/execCommand/remove-list-item-1-expected.checksum: Added.
        * editing/execCommand/remove-list-item-1-expected.png: Added.
        * editing/execCommand/remove-list-item-1-expected.txt: Added.
        * editing/execCommand/remove-list-item-1.html: Added.

WebCore:

        Reviewed by john
        
        <rdar://problem/4747695> 
        Gmail Editor: Crash at WebCore::Range::startPosition() when decreasing a indent
        
        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::initializeStartEnd): Stop expanding
        to select special elements that are fully selected after expansion
        moves to positions that are visually distinct from the originals.
        * editing/InsertListCommand.cpp:
        (WebCore::InsertListCommand::doApply): If the content of the list 
        item will be moved into another list, put it in a list item.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 478db1e6
2006-09-26 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
<rdar://problem/4747695>
Gmail Editor: Crash at WebCore::Range::startPosition() when decreasing a indent
* editing/deleting/list-item-1-expected.checksum: Added.
* editing/deleting/list-item-1-expected.png: Added.
* editing/deleting/list-item-1-expected.txt: Added.
* editing/deleting/list-item-1.html: Added.
* editing/execCommand/remove-list-item-1-expected.checksum: Added.
* editing/execCommand/remove-list-item-1-expected.png: Added.
* editing/execCommand/remove-list-item-1-expected.txt: Added.
* editing/execCommand/remove-list-item-1.html: Added.
2006-09-26 David Harrison <harrison@apple.com>
 
Reviewed by John and TimH.
9f1c55259f96d59388221dfee3d1cdb6
\ No newline at end of file
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: shouldDeleteDOMRange:range from 0 of #text > LI > UL > UL > DIV > BODY > HTML > #document to 3 of #text > LI > UL > UL > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of UL > DIV > BODY > HTML > #document to 0 of UL > DIV > 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 784x36
RenderText {#text} at (0,0) size 760x36
text run at (0,0) width 264: "This test deletes the contents of a sub-list. "
text run at (264,0) width 296: "Since it is fully selected, it should be removed. "
text run at (560,0) width 200: "But the list item below it should"
text run at (0,18) width 51: "remain. "
RenderInline {B} at (0,0) size 561x18
RenderText {#text} at (51,18) size 561x18
text run at (51,18) width 561: "The fact that the caret ends up in an orphaned list child might be considered a bug."
RenderBlock {DIV} at (0,52) size 784x36
RenderBlock {UL} at (0,0) size 784x36
RenderBlock (anonymous) at (40,0) size 744x18
RenderBR {BR} at (0,0) size 0x18
RenderListItem {LI} at (40,18) size 744x18
RenderListMarker at (-17,0) size 7x18
RenderBR {BR} at (0,0) size 0x18
caret: position 0 of child 0 {BR} of child 0 {UL} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
<body>
<p>This test deletes the contents of a sub-list. Since it is fully selected, it should be removed. But the list item below it should remain. <b>The fact that the caret ends up in an orphaned list child might be considered a bug.</b></p>
<div id="div" contentEditable="true"><ul><ul><li>foo</li></ul><li><br></li></ul></div>
<script>
var div = document.getElementById("div");
var sel = window.getSelection();
sel.setPosition(div, 0);
sel.modify("extend", "forward", "word");
document.execCommand("Delete");
</script>
</body>
\ No newline at end of file
f71e9baa7942de1f2c72720ec80e9ac6
\ No newline at end of file
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 0 of LI > UL > DIV > BODY > HTML > #document to 0 of LI > UL > DIV > 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 784x18
RenderText {#text} at (0,0) size 288x18
text run at (0,0) width 288: "Outdenting a sublist should remove one level."
RenderBlock {DIV} at (0,34) size 784x18
RenderBlock {UL} at (0,0) size 784x18
RenderBlock (anonymous) at (40,0) size 744x0
RenderListItem {LI} at (40,0) size 744x18
RenderListMarker at (-17,0) size 7x18
RenderText {#text} at (0,0) size 21x18
text run at (0,0) width 21: "foo"
caret: position 0 of child 0 {#text} of child 0 {LI} of child 0 {UL} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document
<body>
<p>Outdenting a sublist should remove one level.</p>
<div id="div" contentEditable="true"><ul><ul><li>foo</li></ul></ul></div>
<script>
var div = document.getElementById("div");
var sel = window.getSelection();
sel.setPosition(div, 0);
document.execCommand("Outdent");
</script>
</body>
\ No newline at end of file
2006-09-26 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
<rdar://problem/4747695>
Gmail Editor: Crash at WebCore::Range::startPosition() when decreasing a indent
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::initializeStartEnd): Stop expanding
to select special elements that are fully selected after expansion
moves to positions that are visually distinct from the originals.
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApply): If the content of the list
item will be moved into another list, put it in a list item.
2006-09-26 Geoffrey Garen <ggaren@apple.com>
 
Reviewed by Darin.
......@@ -86,7 +86,7 @@ void DeleteSelectionCommand::initializeStartEnd()
else if (end.node()->hasTagName(hrTag))
end = Position(end.node(), 1);
while (1) {
while (VisiblePosition(start) == m_selectionToDelete.visibleStart() && VisiblePosition(end) == m_selectionToDelete.visibleEnd()) {
startSpecialContainer = 0;
endSpecialContainer = 0;
......
......@@ -131,13 +131,20 @@ void InsertListCommand::doApply()
// When removing a list, we must always create a placeholder to act as a point of insertion
// for the list content being removed.
RefPtr<Element> placeholder = createBreakElement(document());
RefPtr<Node> nodeToInsert = placeholder;
// If the content of the list item will be moved into another list, put it in a list item
// so that we don't create an orphaned list child.
if (enclosingList(listNode)) {
nodeToInsert = createListItemElement(document());
appendNode(placeholder.get(), nodeToInsert.get());
}
if (nextListChild && previousListChild) {
splitElement(static_cast<Element *>(listNode), nextListChild);
insertNodeBefore(placeholder.get(), listNode);
insertNodeBefore(nodeToInsert.get(), listNode);
} else if (nextListChild)
insertNodeBefore(placeholder.get(), listNode);
insertNodeBefore(nodeToInsert.get(), listNode);
else
insertNodeAfter(placeholder.get(), listNode);
insertNodeAfter(nodeToInsert.get(), listNode);
VisiblePosition insertionPoint = VisiblePosition(Position(placeholder.get(), 0));
moveParagraphs(start, end, insertionPoint, true);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment