Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
LayoutTests:
        Reviewed by john

        <http://bugs.webkit.org/show_bug.cgi?id=11333>
        Writely Editor: After inserting a HR element, pressing return key creates a copy of this HR element in the document

        * editing/inserting/insert-br-009-expected.checksum: Added.
        * editing/inserting/insert-br-009-expected.png: Added.
        * editing/inserting/insert-br-009-expected.txt: Added.
        * editing/inserting/insert-br-009.html: Added.
        * editing/inserting/insert-paragraph-01-expected.checksum: Added.
        * editing/inserting/insert-paragraph-01-expected.png: Added.
        * editing/inserting/insert-paragraph-01-expected.txt: Added.
        * editing/inserting/insert-paragraph-01.html: Added.
        * editing/inserting/insert-paragraph-02-expected.checksum: Added.
        * editing/inserting/insert-paragraph-02-expected.png: Added.
        * editing/inserting/insert-paragraph-02-expected.txt: Added.
        * editing/inserting/insert-paragraph-02.html: Added.
        * editing/inserting/insert-paragraph-03-expected.checksum: Added.
        * editing/inserting/insert-paragraph-03-expected.png: Added.
        * editing/inserting/insert-paragraph-03-expected.txt: Added.
        * editing/inserting/insert-paragraph-03.html: Added.
        * editing/inserting/insert-paragraph-04-expected.checksum: Added.
        * editing/inserting/insert-paragraph-04-expected.png: Added.
        * editing/inserting/insert-paragraph-04-expected.txt: Added.
        * editing/inserting/insert-paragraph-04.html: Added.

WebCore:

        Reviewed by john

        <http://bugs.webkit.org/show_bug.cgi?id=11333>
        Writely Editor: After inserting a HR element, pressing return key creates a copy of this HR element in the document

        Added special cases in InsertLineBreakCommand for inserting before
        and after tables and horizontal rules.  Also, perform InsertLineBreak
        instead of InsertParagraphSeparator at these positions.

        * editing/InsertLineBreakCommand.cpp:
        (WebCore::InsertLineBreakCommand::doApply):  Use the canonical form
        of the caret position when we check for the new special cases because
        we know that we canonicalize VisiblePositions to those positions.
        Added code to handle inserting before/after tables and horizontal rules.
        Fixed a bug when inserting at the end of a block (it checked for a collapse
        of the inserted br by looking for the absence of a br, but the line break
        might have been a '\n' in white-space:pre text).  Removed unused LOGs.
        * editing/InsertParagraphSeparatorCommand.cpp:
        (WebCore::InsertParagraphSeparatorCommand::doApply): Perform an
        InsertLineBreakCommand when before/after a table or a horizontal rule
        so that we don't have to maintain two pieces of special case code.
        Migrated to enclosingBlock.
        * editing/htmlediting.cpp: Added a FIXME.
        * editing/visible_units.cpp:
        (WebCore::startOfParagraph): Added a workaround for 8622.



Canonical link: https://commits.webkit.org/14490@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17223 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Justin Garcia committed Oct 23, 2006
1 parent 2dc375f commit 75c847a
Show file tree
Hide file tree
Showing 27 changed files with 312 additions and 20 deletions.
28 changes: 28 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,31 @@
2006-10-20 Justin Garcia <justin.garcia@apple.com>

Reviewed by john

<http://bugs.webkit.org/show_bug.cgi?id=11333>
Writely Editor: After inserting a HR element, pressing return key creates a copy of this HR element in the document

* editing/inserting/insert-br-009-expected.checksum: Added.
* editing/inserting/insert-br-009-expected.png: Added.
* editing/inserting/insert-br-009-expected.txt: Added.
* editing/inserting/insert-br-009.html: Added.
* editing/inserting/insert-paragraph-01-expected.checksum: Added.
* editing/inserting/insert-paragraph-01-expected.png: Added.
* editing/inserting/insert-paragraph-01-expected.txt: Added.
* editing/inserting/insert-paragraph-01.html: Added.
* editing/inserting/insert-paragraph-02-expected.checksum: Added.
* editing/inserting/insert-paragraph-02-expected.png: Added.
* editing/inserting/insert-paragraph-02-expected.txt: Added.
* editing/inserting/insert-paragraph-02.html: Added.
* editing/inserting/insert-paragraph-03-expected.checksum: Added.
* editing/inserting/insert-paragraph-03-expected.png: Added.
* editing/inserting/insert-paragraph-03-expected.txt: Added.
* editing/inserting/insert-paragraph-03.html: Added.
* editing/inserting/insert-paragraph-04-expected.checksum: Added.
* editing/inserting/insert-paragraph-04-expected.png: Added.
* editing/inserting/insert-paragraph-04-expected.txt: Added.
* editing/inserting/insert-paragraph-04.html: Added.

2006-10-20 Geoffrey Garen <ggaren@apple.com>

RS by Beth "pants on fire" Dakin.
Expand Down
@@ -0,0 +1 @@
06a9921d2f31aeb62fcb75ec8d218dc5
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions LayoutTests/editing/inserting/insert-br-009-expected.txt
@@ -0,0 +1,26 @@
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:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > 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 {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 774x36
text run at (0,0) width 316: "This tests for a bug in InsertLineBreakCommand. "
text run at (316,0) width 458: "Only one line break should be inserted and the caret should end up at the"
text run at (0,18) width 194: "end of the bordered div below."
RenderBlock {DIV} at (0,52) size 784x56 [border: (1px solid #000000)]
RenderText {#text} at (1,1) size 80x18
text run at (1,1) width 80: "Hello world."
text run at (81,1) width 0: " "
RenderText {#text} at (1,19) size 0x18
text run at (1,19) width 0: " "
RenderText {#text} at (1,37) size 0x18
text run at (1,37) width 0: " "
caret: position 0 of child 2 {#text} of child 1 {DIV} of child 0 {BODY} of child 0 {HTML} of document
11 changes: 11 additions & 0 deletions LayoutTests/editing/inserting/insert-br-009.html
@@ -0,0 +1,11 @@
<p>This tests for a bug in InsertLineBreakCommand. Only one line break should be inserted and the caret should end up at the end of the bordered div below.</p><div contenteditable="true" id="div" style="white-space:pre; border: 1px solid black;">Hello world.

</div>

<script>
var sel = window.getSelection();
var div = document.getElementById("div");
sel.setPosition(div, 0);
sel.modify("move", "forward", "line");
document.execCommand("InsertLineBreak");
</script>
@@ -0,0 +1 @@
8502a7a6c36819e5a467687b118771b0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-01-expected.txt
@@ -0,0 +1,25 @@
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: shouldChangeSelectedDOMRange:range from 0 of TABLE > DIV > BODY > HTML > #document to 0 of TABLE > DIV > BODY > HTML > #document toDOMRange:range from 0 of TABLE > DIV > BODY > HTML > #document to 0 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 {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 769x36
text run at (0,0) width 353: "This tests inserting a paragraph separator before a table. "
text run at (353,0) width 416: "There should be an empty paragraph before the table and the caret"
text run at (0,18) width 192: "should be just before the table."
RenderBlock {DIV} at (0,52) size 784x46
RenderBlock (anonymous) at (0,0) size 784x18
RenderBR {BR} at (0,0) size 0x18
RenderTable {TABLE} at (0,18) size 31x28 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 29x26
RenderTableRow {TR} at (0,2) size 29x22
RenderTableCell {TD} at (2,2) size 25x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo"
caret: position 0 of child 1 {TABLE} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
9 changes: 9 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-01.html
@@ -0,0 +1,9 @@
<p>This tests inserting a paragraph separator before a table. There should be an empty paragraph before the table and the caret should be just before the table.</p>
<div contenteditable="true" id="div"><table border="1"><tr><td>foo</td></tr></table></div>

<script>
var sel = window.getSelection();
var div = document.getElementById("div");
sel.setPosition(div, 0);
document.execCommand("InsertParagraph");
</script>
@@ -0,0 +1 @@
ccd32bf82878146c98da8dd3c9bdf729
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-02-expected.txt
@@ -0,0 +1,33 @@
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 2 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: shouldChangeSelectedDOMRange:range from 1 of TABLE > DIV > BODY > HTML > #document to 1 of TABLE > DIV > BODY > HTML > #document toDOMRange:range from 1 of DIV > BODY > HTML > #document to 1 of 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 {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 770x36
text run at (0,0) width 341: "This tests inserting a paragraph separator after a table. "
text run at (341,0) width 429: "There should be an empty paragraph between the table and 'bar' and"
text run at (0,18) width 271: "the caret should be in the empty paragraph."
RenderBlock {DIV} at (0,52) size 784x64
RenderTable {TABLE} at (0,0) size 31x28 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 29x26
RenderTableRow {TR} at (0,2) size 29x22
RenderTableCell {TD} at (2,2) size 25x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 21x18
text run at (2,2) width 21: "foo"
RenderBlock (anonymous) at (0,28) size 784x36
RenderBR {BR} at (0,0) size 0x18
RenderText {#text} at (0,18) size 20x18
text run at (0,18) width 20: "bar"
caret: position 0 of child 1 {BR} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
14 changes: 14 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-02.html
@@ -0,0 +1,14 @@
<p>This tests inserting a paragraph separator after a table. There should be an empty paragraph between the table and 'bar' and the caret should be in the empty paragraph.</p>
<div contenteditable="true" id="div"><table border="1"><tr><td>foo</td></tr></table>bar</div>

<script>
var sel = window.getSelection();
var div = document.getElementById("div");
sel.setPosition(div, 0);
sel.modify("move", "forward", "character");
sel.modify("move", "forward", "character");
sel.modify("move", "forward", "character");
sel.modify("move", "forward", "character");
sel.modify("move", "forward", "character");
document.execCommand("InsertParagraph");
</script>
@@ -0,0 +1 @@
d7fa2730b0a757db2ee6a7f6f444a5ef
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-03-expected.txt
@@ -0,0 +1,28 @@
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: shouldChangeSelectedDOMRange:range from 3 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document toDOMRange:range from 3 of DIV > BODY > HTML > #document to 3 of 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 {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 760x36
text run at (0,0) width 414: "This tests inserting a paragraph separator before a horizontal rule. "
text run at (414,0) width 346: "You should see 'foo', empty paragraph, horizontal rule,"
text run at (0,18) width 371: "'bar', and the caret should be just before the horizontal rule."
RenderBlock {DIV} at (0,52) size 784x72
RenderBlock (anonymous) at (0,0) size 784x36
RenderText {#text} at (0,0) size 21x18
text run at (0,0) width 21: "foo"
RenderBR {BR} at (21,14) size 0x0
RenderBR {BR} at (0,18) size 0x18
RenderBlock {HR} at (0,44) size 784x2 [border: (1px inset #000000)]
RenderBlock (anonymous) at (0,54) size 784x18
RenderText {#text} at (0,0) size 20x18
text run at (0,0) width 20: "bar"
caret: position 0 of child 3 {HR} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
11 changes: 11 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-03.html
@@ -0,0 +1,11 @@
<p>This tests inserting a paragraph separator before a horizontal rule. You should see 'foo', empty paragraph, horizontal rule, 'bar', and the caret should be just before the horizontal rule.</p>
<div contenteditable="true" id="div">foo<hr>bar</div>

<script>
var sel = window.getSelection();
var div = document.getElementById("div");
sel.setPosition(div, 0);
sel.modify("move", "forward", "word");
sel.modify("move", "forward", "character");
document.execCommand("InsertParagraph");
</script>
@@ -0,0 +1 @@
6693c962d1dfd64fdf8e7cf90a1b353e
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-04-expected.txt
@@ -0,0 +1,40 @@
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > B > BODY > HTML > #document to 3 of DIV > B > 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 2 of DIV > B > BODY > HTML > #document to 2 of DIV > B > BODY > HTML > #document toDOMRange:range from 2 of DIV > B > BODY > HTML > #document to 2 of DIV > B > 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 {P} at (0,0) size 784x54
RenderText {#text} at (0,0) size 782x36
text run at (0,0) width 402: "This tests inserting a paragraph separator after a horizontal rule. "
text run at (402,0) width 380: "You should see 'foo', empty paragraph, horizontal rule, 'bar',"
text run at (0,18) width 329: "and the caret should be just after the horizontal rule. "
RenderInline {B} at (0,0) size 777x36
RenderText {#text} at (329,18) size 777x36
text run at (329,18) width 168: "This demonstrates 8345. "
text run at (497,18) width 280: "The caret after a horizontal rule is drawn"
text run at (0,36) width 381: "in the same location as the caret before a horizontal rule."
RenderBlock (anonymous) at (0,70) size 784x0
RenderInline {B} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderBlock (anonymous) at (0,70) size 784x72
RenderBlock {DIV} at (0,0) size 784x72
RenderBlock (anonymous) at (0,0) size 784x18
RenderText {#text} at (0,0) size 21x18
text run at (0,0) width 21: "foo"
RenderBlock {HR} at (0,26) size 784x2 [border: (1px inset #000000)]
RenderBlock (anonymous) at (0,36) size 784x36
RenderBR {BR} at (0,0) size 0x18
RenderText {#text} at (0,18) size 24x18
text run at (0,18) width 24: "bar"
RenderBlock (anonymous) at (0,142) size 784x0
RenderInline {B} at (0,0) size 0x0
caret: position 0 of child 2 {BR} of child 1 {DIV} of child 1 {B} of child 0 {BODY} of child 0 {HTML} of document
12 changes: 12 additions & 0 deletions LayoutTests/editing/inserting/insert-paragraph-04.html
@@ -0,0 +1,12 @@
<p>This tests inserting a paragraph separator after a horizontal rule. You should see 'foo', empty paragraph, horizontal rule, 'bar', and the caret should be just after the horizontal rule. <b>This demonstrates 8345. The caret after a horizontal rule is drawn in the same location as the caret before a horizontal rule.</p>
<div contenteditable="true" id="div">foo<hr>bar</div>

<script>
var sel = window.getSelection();
var div = document.getElementById("div");
sel.setPosition(div, 0);
sel.modify("move", "forward", "word");
sel.modify("move", "forward", "character");
sel.modify("move", "forward", "character");
document.execCommand("InsertParagraph");
</script>
28 changes: 28 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,31 @@
2006-10-23 Justin Garcia <justin.garcia@apple.com>

Reviewed by john

<http://bugs.webkit.org/show_bug.cgi?id=11333>
Writely Editor: After inserting a HR element, pressing return key creates a copy of this HR element in the document

Added special cases in InsertLineBreakCommand for inserting before
and after tables and horizontal rules. Also, perform InsertLineBreak
instead of InsertParagraphSeparator at these positions.

* editing/InsertLineBreakCommand.cpp:
(WebCore::InsertLineBreakCommand::doApply): Use the canonical form
of the caret position when we check for the new special cases because
we know that we canonicalize VisiblePositions to those positions.
Added code to handle inserting before/after tables and horizontal rules.
Fixed a bug when inserting at the end of a block (it checked for a collapse
of the inserted br by looking for the absence of a br, but the line break
might have been a '\n' in white-space:pre text). Removed unused LOGs.
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply): Perform an
InsertLineBreakCommand when before/after a table or a horizontal rule
so that we don't have to maintain two pieces of special case code.
Migrated to enclosingBlock.
* editing/htmlediting.cpp: Added a FIXME.
* editing/visible_units.cpp:
(WebCore::startOfParagraph): Added a workaround for 8622.

2006-10-23 Adam Roben <aroben@apple.com>

Reviewed by Adele.
Expand Down

0 comments on commit 75c847a

Please sign in to comment.