Commit 384cf314 authored by justing's avatar justing
Browse files

LayoutTests:

        Reviewed by darin
        
        <rdar://problem/4875189> List is deleted when replacing contents with Chinese/Japanese characters

        Moved from unsupported-content because we've supported editing lists
        for a while now:
        * editing/deleting/4875189-expected.checksum: Added.
        * editing/deleting/4875189-expected.png: Added.
        * editing/deleting/4875189-expected.txt: Added.
        * editing/deleting/4875189.html: Added.
        * editing/unsupported-content/list-delete-002-expected.checksum: Removed.
        * editing/unsupported-content/list-delete-002-expected.png: Removed.
        * editing/unsupported-content/list-delete-002-expected.txt: Removed.
        * editing/unsupported-content/list-delete-002.html: Removed.
        
        Reflects new behavior:
        * editing/deleting/delete-select-all-003-expected.checksum:
        * editing/deleting/delete-select-all-003-expected.png:
        * editing/deleting/delete-select-all-003-expected.txt:
        
        Ditto and also removed a FIXME:
        * editing/deleting/list-item-1-expected.checksum:
        * editing/deleting/list-item-1-expected.png:
        * editing/deleting/list-item-1-expected.txt:
        * editing/deleting/list-item-1.html:

WebCore:

        Reviewed by darin
        
        <rdar://problem/4875189> 
        List is deleted when replacing contents with Chinese/Japanese characters

        * editing/htmlediting.cpp:
        (WebCore::isSpecialElement): Lists are no longer special.
        They can be removed by removing their content and then 
        then hitting delete inside of the empty list item that's 
        left over. Even when that list item is the first thing 
        in the editable region.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21648 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6793e484
2007-05-22 Justin Garcia <justin.garcia@apple.com>
Reviewed by darin
<rdar://problem/4875189> List is deleted when replacing contents with Chinese/Japanese characters
Moved from unsupported-content because we've supported editing lists
for a while now:
* editing/deleting/4875189-expected.checksum: Added.
* editing/deleting/4875189-expected.png: Added.
* editing/deleting/4875189-expected.txt: Added.
* editing/deleting/4875189.html: Added.
* editing/unsupported-content/list-delete-002-expected.checksum: Removed.
* editing/unsupported-content/list-delete-002-expected.png: Removed.
* editing/unsupported-content/list-delete-002-expected.txt: Removed.
* editing/unsupported-content/list-delete-002.html: Removed.
Reflects new behavior:
* editing/deleting/delete-select-all-003-expected.checksum:
* editing/deleting/delete-select-all-003-expected.png:
* editing/deleting/delete-select-all-003-expected.txt:
Ditto and also removed a FIXME:
* editing/deleting/list-item-1-expected.checksum:
* editing/deleting/list-item-1-expected.png:
* editing/deleting/list-item-1-expected.txt:
* editing/deleting/list-item-1.html:
2007-05-22 Kevin McCullough <kmccullough@apple.com>
 
Reviewed by.
9309422066e5a8ed451bef904d296f15
\ No newline at end of file
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 784x36
RenderText {#text} at (0,0) size 782x36
text run at (0,0) width 782: "This test deletes the contents of a list, then it performs another delete, which should remove the empty list item. There should"
text run at (0,18) width 163: "be two paragraphs below."
RenderBlock {DIV} at (0,52) size 784x36
RenderText {#text} at (0,0) size 99x18
text run at (0,0) width 99: "Paragraph One."
RenderBR {BR} at (99,14) size 0x0
RenderText {#text} at (0,18) size 102x18
text run at (0,18) width 102: "Paragraph Two."
caret: position 14 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
<p>This test deletes the contents of a list, then it performs another delete, which should remove the empty list item. There should be two paragraphs below.</p>
<div id="div" contentEditable="true">Paragraph One.<ul><li id="li">bar</li></ul>Paragraph Two.</div>
<script>
var li = document.getElementById("li");
var sel = window.getSelection();
sel.setBaseAndExtent(li, 0, li, li.childNodes.length);
document.execCommand("Delete");
document.execCommand("Delete");
</script>
b17ccac186547b5bb42ecf2d653027b1
\ No newline at end of file
3f7446355423e8a658619b46fbecf057
\ No newline at end of file
......@@ -5,7 +5,7 @@ EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of LI > UL > DIV > B
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > LI > UL > DIV > BODY > HTML > #document to 5 of #text > LI > UL > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
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
......@@ -13,7 +13,9 @@ layer 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 784x56 [border: (2px solid #FF0000)]
RenderBlock (anonymous) at (14,14) size 756x28
RenderBR {BR} at (0,0) size 0x28
caret: position 0 of child 0 {BR} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
RenderBlock {DIV} at (0,0) size 784x104 [border: (2px solid #FF0000)]
RenderBlock {UL} at (14,38) size 756x28
RenderListItem {LI} at (40,0) size 716x28
RenderListMarker at (-22,0) size 9x28: bullet
RenderBR {BR} at (0,0) size 0x28
caret: position 0 of child 0 {BR} of child 0 {LI} of child 1 {UL} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
7e0b961a048b0d7b56944f358313ef86
\ No newline at end of file
ac0e1f60146ed92bfe2ffa33d1ae3427
\ No newline at end of file
......@@ -4,7 +4,11 @@ EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotificatio
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: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of LI > UL > UL > DIV > BODY > HTML > #document to 0 of LI > UL > UL > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
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
......@@ -12,20 +16,16 @@ layer 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
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 713x18
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
text run at (264,0) width 449: "Then it deletes the empty list item. The list item below it should remain."
RenderBlock {DIV} at (0,34) size 784x36
RenderBlock {UL} at (0,0) size 784x36
RenderBlock (anonymous) at (40,0) size 744x18
RenderListItem {LI} at (40,0) size 744x18
RenderListMarker at (-17,0) size 7x18: bullet
RenderBR {BR} at (0,0) size 0x18
RenderListItem {LI} at (40,18) size 744x18
RenderListMarker at (-17,0) size 7x18: bullet
RenderBR {BR} at (0,0) size 0x18
caret: position 0 of child 0 {BR} of child 0 {UL} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
caret: position 0 of child 0 {BR} of child 0 {LI} of child 0 {UL} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
......@@ -3,7 +3,7 @@ if (window.layoutTestController)
layoutTestController.dumpEditingCallbacks();
</script>
<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>
<p>This test deletes the contents of a sub-list. Then it deletes the empty list item. The list item below it should remain.</p>
<div id="div" contentEditable="true"><ul><ul><li>foo</li></ul><li><br></li></ul></div>
<script>
......@@ -13,5 +13,6 @@ var sel = window.getSelection();
sel.setPosition(div, 0);
sel.modify("extend", "forward", "word");
document.execCommand("Delete");
document.execCommand("Delete");
</script>
</body>
\ No newline at end of file
deea9d6ed42f8d52f26a5271f19deaa4
\ No newline at end of file
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > 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: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > LI > UL > DIV > DIV > BODY > HTML > #document to 10 of #text > LI > UL > DIV > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 2 of DIV > DIV > BODY > HTML > #document to 2 of DIV > 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 784x584
RenderBlock {DIV} at (0,0) size 784x250 [border: (4px solid #0000FF)]
RenderBlock {DIV} at (20,20) size 744x72
RenderText {#text} at (0,0) size 67x28
text run at (0,0) width 67: "Tests: "
RenderBR {BR} at (0,0) size 0x0
RenderText {#text} at (0,28) size 663x22
text run at (0,28) width 663: "Our ability to \"edit around\" content the HTML editing code does not yet handle very well. "
RenderBR {BR} at (663,45) size 0x0
RenderInline {I} at (0,0) size 99x22
RenderText {#text} at (0,50) size 99x22
text run at (0,50) width 99: "For this test: "
RenderText {#text} at (99,50) size 392x22
text run at (99,50) width 392: "Select and delete a list and some surrounding content."
RenderBlock (anonymous) at (20,92) size 744x22
RenderBR {BR} at (0,0) size 0x22
RenderBlock {DIV} at (20,114) size 744x116
RenderText {#text} at (0,0) size 189x28
text run at (0,0) width 189: "Expected Results: "
RenderBR {BR} at (189,22) size 0x0
RenderText {#text} at (0,28) size 709x44
text run at (0,28) width 709: "The content in the red box must exactly match the content in the green box (except for the border"
text run at (0,50) width 53: "color). "
RenderBR {BR} at (53,67) size 0x0
RenderInline {I} at (0,0) size 99x22
RenderText {#text} at (0,72) size 99x22
text run at (0,72) width 99: "For this test: "
RenderText {#text} at (99,72) size 744x44
text run at (99,72) width 304: "Only selected content should get deleted. "
text run at (403,72) width 341: "Surrounding content that is not selected should"
text run at (0,94) width 201: "(obviously) not be affected."
RenderBlock {DIV} at (0,260) size 784x32 [border: (2px solid #008000)]
RenderText {#text} at (2,2) size 113x28
text run at (2,2) width 113: "before after"
RenderBlock {DIV} at (0,302) size 784x60
RenderBlock {DIV} at (0,0) size 784x60 [border: (2px solid #FF0000)]
RenderText {#text} at (2,2) size 62x28
text run at (2,2) width 62: "before"
RenderBR {BR} at (64,24) size 0x0
RenderText {#text} at (2,30) size 45x28
text run at (2,30) width 45: "after"
caret: position 0 of child 2 {#text} of child 1 {DIV} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
<html>
<head>
<style>
.editing {
border: 2px solid red;
font-size: 24px;
}
.explanation {
border: 4px solid blue;
padding: 16px;
font-size: 18px;
margin-bottom: 10px;
}
.scenario:first-line { font-weight: bold; font-size: 24px; }
.expected:first-line { font-weight: bold; font-size: 24px; }
.results { margin-bottom: 10px; border: 2px solid green; font-size: 24px; }
</style>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function editingTest() {
moveSelectionForwardByLineCommand();
for (i = 0; i < 2; i++)
extendSelectionForwardByLineCommand();
for (i = 0; i < 10; i++)
extendSelectionForwardByCharacterCommand();
deleteCommand();
}
</script>
<title>Editing Test</title>
</head>
<body>
<div class="explanation">
<div class="scenario">
Tests:
<br>
Our ability to "edit around" content the HTML editing code does not yet handle very well.
<br><i>For this test: </i>Select and delete a list and some surrounding content.
</div>
<br>
<div class="expected">
Expected Results:
<br>
The content in the red box must exactly match the content in the green box (except for the border color).
<br><i>For this test: </i>Only selected content should get deleted.
Surrounding content that is not selected should (obviously) not be affected.
</div>
</div>
<div class="results">
before after
</div>
<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
<div id="test" class="editing">
before
<ul>
<li>line one</li>
<li>line two</li>
<li>line three</li>
</ul>
after
</div>
</div>
<script>
runEditingTest();
</script>
</body>
</html>
2007-05-22 Justin Garcia <justin.garcia@apple.com>
Reviewed by darin
<rdar://problem/4875189>
List is deleted when replacing contents with Chinese/Japanese characters
* editing/htmlediting.cpp:
(WebCore::isSpecialElement): Lists are no longer special.
They can be removed by removing their content and then
then hitting delete inside of the empty list item that's
left over. Even when that list item is the first thing
in the editable region.
2007-05-22 Darin Adler <darin@apple.com>
 
Reviewed by Tim Hatcher.
......@@ -411,9 +411,6 @@ bool isSpecialElement(const Node *n)
if (n->isLink())
return true;
if (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(dlTag))
return true;
RenderObject *renderer = n->renderer();
if (!renderer)
return false;
......
Markdown is supported
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