RenderBR {BR} at (14,14) size 0x28
RenderBlock {DIV} at (0,112) size 784x28 [border: (2px solid #FF0000)]
selection is CARET:
-start: position 0 of child 3 {DIV} of root {DIV}
-upstream: position 0 of child 3 {DIV} of root {DIV}
-downstream: position 1 of child 3 {DIV} of root {DIV}
+start: position 0 of child 4 {DIV} of root {DIV}
+upstream: position 0 of child 4 {DIV} of root {DIV}
+downstream: position 1 of child 4 {DIV} of root {DIV}
RenderText {TEXT} at (14,14) size 12x28
text run at (14,14) width 12: "x"
selection is CARET:
-start: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
-upstream: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
-downstream: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
+start: position 1 of child 1 {TEXT} of child 4 {DIV} of root {BODY}
+upstream: position 1 of child 1 {TEXT} of child 4 {DIV} of root {BODY}
+downstream: position 1 of child 1 {TEXT} of child 4 {DIV} of root {BODY}
RenderText {TEXT} at (14,14) size 12x28
text run at (14,14) width 12: "x"
selection is CARET:
-start: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
-upstream: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
-downstream: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
+start: position 1 of child 1 {TEXT} of child 4 {DIV} of root {BODY}
+upstream: position 1 of child 1 {TEXT} of child 4 {DIV} of root {BODY}
+downstream: position 1 of child 1 {TEXT} of child 4 {DIV} of root {BODY}
RenderBlock {DIV} at (0,112) size 784x56 [border: (2px solid #FF0000)]
RenderBR {BR} at (14,14) size 0x28
selection is CARET:
-start: position 0 of child 1 {BR} of child 3 {DIV} of root {BODY}
-upstream: position 0 of child 3 {DIV} of root {BODY}
-downstream: position 0 of child 1 {BR} of child 3 {DIV} of root {BODY}
+start: position 0 of child 1 {BR} of child 5 {DIV} of root {BODY}
+upstream: position 0 of child 5 {DIV} of root {BODY}
+downstream: position 0 of child 1 {BR} of child 5 {DIV} of root {BODY}
RenderText {TEXT} at (14,14) size 12x28
text run at (14,14) width 12: "x"
selection is CARET:
-start: position 1 of child 1 {TEXT} of child 3 {DIV} of root {BODY}
-upstream: position 1 of child 1 {TEXT} of child 3 {DIV} of root {BODY}
-downstream: position 1 of child 1 {TEXT} of child 3 {DIV} of root {BODY}
+start: position 1 of child 1 {TEXT} of child 5 {DIV} of root {BODY}
+upstream: position 1 of child 1 {TEXT} of child 5 {DIV} of root {BODY}
+downstream: position 1 of child 1 {TEXT} of child 5 {DIV} of root {BODY}
RenderText {TEXT} at (0,0) size 8x18
text run at (0,0) width 8: "x"
selection is CARET:
-start: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
-upstream: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
-downstream: position 1 of child 1 {TEXT} of child 2 {DIV} of root {BODY}
+start: position 1 of child 1 {TEXT} of child 5 {DIV} of root {BODY}
+upstream: position 1 of child 1 {TEXT} of child 5 {DIV} of root {BODY}
+downstream: position 1 of child 1 {TEXT} of child 5 {DIV} of root {BODY}
RenderText {TEXT} at (14,14) size 36x28
text run at (14,14) width 36: "xxx"
selection is CARET:
-start: position 3 of child 1 {TEXT} of child 9 {P} of root {BODY}
-upstream: position 3 of child 1 {TEXT} of child 9 {P} of root {BODY}
-downstream: position 3 of child 1 {TEXT} of child 9 {P} of root {BODY}
+start: position 3 of child 1 {TEXT} of child 11 {P} of root {BODY}
+upstream: position 3 of child 1 {TEXT} of child 11 {P} of root {BODY}
+downstream: position 3 of child 1 {TEXT} of child 11 {P} of root {BODY}
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas 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 784x212 [border: (2px solid #0000FF)]
+ RenderBlock {DIV} at (14,14) size 756x112
+ 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 721x56
+ text run at (0,28) width 721: "Inserting blocks for paragraphs should do a better job of finding a block to"
+ text run at (0,56) width 117: "insert after. "
+ RenderInline {A} at (0,0) size 260x28 [color=#0000EE]
+ RenderText {TEXT} at (117,56) size 260x28
+ text run at (117,56) width 260: "<rdar://problem/3996605>"
+ RenderText {TEXT} at (377,56) size 735x56
+ text run at (377,56) width 358: " Insert paragraph command puts new"
+ text run at (0,84) width 554: "block in wrong place, creating difficult-to-handle HTML"
+ RenderBlock {DIV} at (14,142) size 756x56
+ RenderText {TEXT} at (0,0) size 189x28
+ text run at (0,0) width 189: "Expected Results: "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {TEXT} at (0,28) size 442x28
+ text run at (0,28) width 442: "Should see this content in the red box below: "
+ RenderInline {B} at (0,0) size 20x28
+ RenderText {TEXT} at (442,28) size 20x28
+ text run at (442,28) width 20: "fo"
+ RenderText {TEXT} at (462,28) size 12x28
+ text run at (462,28) width 12: "x"
+ RenderBlock {DIV} at (0,236) size 784x32
+ RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
+ RenderInline {B} at (0,0) size 20x28
+ RenderText {TEXT} at (2,2) size 20x28
+ text run at (2,2) width 20: "fo"
+ RenderText {TEXT} at (22,2) size 12x28
+ text run at (22,2) width 12: "x"
+selection is CARET:
+start: position 3 of child 1 {TEXT} of child 1 {B} of child 1 {DIV} of root {DIV}
+upstream: position 3 of child 1 {TEXT} of child 1 {B} of child 1 {DIV} of root {DIV}
+downstream: position 0 of child 2 {TEXT} of child 1 {DIV} of root {DIV}
--- /dev/null
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ font-size: 24px;
+}
+.explanation {
+ border: 2px solid blue;
+ padding: 12px;
+ font-size: 24px;
+ margin-bottom: 24px;
+}
+.scenario { margin-bottom: 16px;}
+.scenario:first-line { font-weight: bold; margin-bottom: 16px;}
+.expected-results:first-line { font-weight: bold }
+</style>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+
+<script>
+
+function editingTest() {
+ extendSelectionForwardByLineCommand();
+ boldCommand();
+ moveSelectionForwardByCharacterCommand();
+ insertParagraphCommand();
+ boldCommand();
+ typeCharacterCommand();
+ moveSelectionBackwardByCharacterCommand();
+ deleteCommand();
+}
+
+</script>
+
+<title>Editing Test</title>
+</head>
+<body>
+
+<div class="explanation">
+<div class="scenario">
+Tests:
+<br>
+Inserting blocks for paragraphs should do a better job of finding a block to insert after.
+<a href="rdar://problem/3996605"><rdar://problem/3996605></a> Insert paragraph command puts new block in wrong place, creating difficult-to-handle HTML
+</div>
+<div class="expected-results">
+Expected Results:
+<br>
+Should see this content in the red box below: <b>fo</b>x
+</div>
+</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">
+fo
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
RenderText {TEXT} at (0,0) size 39x18
text run at (0,0) width 39: "there"
selection is CARET:
-start: position 5 of child 1 {TEXT} of child 1 {B} of child 1 {FONT} of child 5 {P} of root {BODY}
-upstream: position 5 of child 1 {TEXT} of child 1 {B} of child 1 {FONT} of child 5 {P} of root {BODY}
-downstream: position 5 of child 1 {TEXT} of child 1 {B} of child 1 {FONT} of child 5 {P} of root {BODY}
+start: position 5 of child 1 {TEXT} of child 1 {B} of child 1 {FONT} of child 7 {P} of root {BODY}
+upstream: position 5 of child 1 {TEXT} of child 1 {B} of child 1 {FONT} of child 7 {P} of root {BODY}
+downstream: position 5 of child 1 {TEXT} of child 1 {B} of child 1 {FONT} of child 7 {P} of root {BODY}
RenderBlock {BLOCKQUOTE} at (40,0) size 676x28
RenderText {TEXT} at (0,0) size 32x28
text run at (0,0) width 32: "foo"
- RenderBlock {DIV} at (0,182) size 784x184 [border: (2px solid #FF0000)]
+ RenderBlock {DIV} at (0,182) size 784x132 [border: (2px solid #FF0000)]
RenderBlock (anonymous) at (14,14) size 756x28
RenderText {TEXT} at (0,0) size 12x28
text run at (0,0) width 12: "x"
- RenderBlock {DIV} at (14,66) size 756x80
+ RenderBlock {DIV} at (14,66) size 756x28
RenderBlock {BLOCKQUOTE} at (40,0) size 676x28
RenderText {TEXT} at (0,0) size 32x28
text run at (0,0) width 32: "foo"
- RenderBlock {BLOCKQUOTE} at (40,52) size 676x28
- RenderBR {BR} at (0,0) size 0x28
selection is CARET:
-start: position 0 of child 1 {BR} of child 2 {BLOCKQUOTE} of child 2 {DIV} of child 8 {DIV} of root {BODY}
-upstream: position 0 of child 2 {BLOCKQUOTE} of child 2 {DIV} of child 8 {DIV} of root {BODY}
-downstream: position 0 of child 1 {BR} of child 2 {BLOCKQUOTE} of child 2 {DIV} of child 8 {DIV} of root {BODY}
+start: position 1 of child 1 {TEXT} of child 8 {DIV} of root {BODY}
+upstream: position 1 of child 1 {TEXT} of child 8 {DIV} of root {BODY}
+downstream: position 1 of child 1 {TEXT} of child 8 {DIV} of root {BODY}
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 784x140
- RenderBlock {DIV} at (0,0) size 784x140 [border: (2px solid #FF0000)]
- RenderBlock {P} at (14,14) size 756x112
- RenderBlock {P} at (0,0) size 756x28
- RenderText {TEXT} at (0,0) size 32x28
- text run at (0,0) width 32: "foo"
- RenderBlock {P} at (0,28) size 756x28
- RenderText {TEXT} at (0,0) size 31x28
- text run at (0,0) width 31: "bar"
- RenderBlock {P} at (0,56) size 756x28
- RenderText {TEXT} at (0,0) size 32x28
- text run at (0,0) width 32: "foo"
- RenderBlock {P} at (0,84) size 756x28
- RenderText {TEXT} at (0,0) size 31x28
- text run at (0,0) width 31: "bar"
+ RenderBlock {DIV} at (0,0) size 784x84
+ RenderBlock {DIV} at (0,0) size 784x84 [border: (2px solid #FF0000)]
+ RenderBlock {P} at (14,14) size 756x28
+ RenderText {TEXT} at (0,0) size 32x28
+ text run at (0,0) width 32: "foo"
+ RenderBlock {P} at (14,42) size 756x28
+ RenderText {TEXT} at (0,0) size 31x28
+ text run at (0,0) width 31: "bar"
+ RenderBlock {P} at (0,84) size 784x28
+ RenderInline {FONT} at (0,0) size 32x28
+ RenderInline {SPAN} at (0,0) size 32x28
+ RenderText {TEXT} at (0,0) size 32x28
+ text run at (0,0) width 32: "foo"
+ RenderBlock {P} at (0,112) size 784x28
+ RenderInline {FONT} at (0,0) size 31x28
+ RenderInline {SPAN} at (0,0) size 31x28
+ RenderText {TEXT} at (0,0) size 31x28
+ text run at (0,0) width 31: "bar"
selection is CARET:
-start: position 3 of child 1 {TEXT} of child 4 {P} of child 1 {P} of child 2 {DIV} of root {DIV}
-upstream: position 3 of child 1 {TEXT} of child 4 {P} of child 1 {P} of child 2 {DIV} of root {DIV}
-downstream: position 3 of child 1 {TEXT} of child 4 {P} of child 1 {P} of child 2 {DIV} of root {DIV}
+start: position 3 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 5 {P} of child 2 {BODY} of child 1 {HTML} of root {}
+upstream: position 3 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 5 {P} of child 2 {BODY} of child 1 {HTML} of root {}
+downstream: position 3 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 5 {P} of child 2 {BODY} of child 1 {HTML} of root {}
RenderText {TEXT} at (0,0) size 30x69
text run at (0,0) width 30: "x"
selection is CARET:
-start: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 3 {DIV} of root {DIV}
-upstream: position 0 of child 3 {DIV} of root {DIV}
-downstream: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 3 {DIV} of root {DIV}
+start: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 4 {DIV} of root {DIV}
+upstream: position 0 of child 4 {DIV} of root {DIV}
+downstream: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 4 {DIV} of root {DIV}
RenderInline {SPAN} at (0,0) size 0x69
RenderBR {BR} at (0,0) size 0x69
selection is CARET:
-start: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 3 {DIV} of root {DIV}
-upstream: position 0 of child 3 {DIV} of root {DIV}
-downstream: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 3 {DIV} of root {DIV}
+start: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 4 {DIV} of root {DIV}
+upstream: position 0 of child 4 {DIV} of root {DIV}
+downstream: position 0 of child 1 {BR} of child 1 {SPAN} of child 1 {FONT} of child 4 {DIV} of root {DIV}
RenderText {TEXT} at (0,0) size 30x69
text run at (0,0) width 30: "x"
selection is CARET:
-start: position 0 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 4 {DIV} of root {DIV}
-upstream: position 0 of child 4 {DIV} of root {DIV}
-downstream: position 0 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 4 {DIV} of root {DIV}
+start: position 0 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 5 {DIV} of root {DIV}
+upstream: position 0 of child 5 {DIV} of root {DIV}
+downstream: position 0 of child 1 {TEXT} of child 1 {SPAN} of child 1 {FONT} of child 5 {DIV} of root {DIV}
RenderInline {SPAN} at (0,0) size 78x28
RenderText {TEXT} at (78,0) size 78x28
text run at (78,0) width 78: " xxxxxx"
- RenderBlock (anonymous) at (14,70) size 756x0
- RenderBlock (anonymous) at (14,70) size 756x0
selection is RANGE:
start: position 0 of child 5 {TEXT} of root {DIV}
upstream: position 7 of child 1 {TEXT} of child 4 {SPAN} of root {DIV}
RenderInline {B} at (0,0) size 72x28
RenderText {TEXT} at (78,0) size 72x28
text run at (78,0) width 72: "xxxxxx"
- RenderBlock (anonymous) at (14,42) size 756x28
- RenderBlock {DIV} at (0,0) size 756x28
- RenderText {TEXT} at (0,0) size 78x28
- text run at (0,0) width 78: " xxxxxx"
- RenderInline {SPAN} at (0,0) size 78x28
+ RenderBlock {DIV} at (14,42) size 756x28
+ RenderInline {SPAN} at (0,0) size 156x28
+ RenderInline {B} at (0,0) size 78x28
+ RenderText {TEXT} at (0,0) size 78x28
+ text run at (0,0) width 78: " xxxxxx"
+ RenderInline {B} at (0,0) size 78x28
RenderText {TEXT} at (78,0) size 78x28
text run at (78,0) width 78: " xxxxxx"
- RenderBlock (anonymous) at (14,70) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderInline {B} at (0,0) size 0x0
selection is RANGE:
start: position 0 of child 1 {TEXT} of child 2 {B} of child 4 {SPAN} of root {DIV}
upstream: position 7 of child 1 {TEXT} of child 1 {B} of child 4 {SPAN} of root {DIV}
downstream: position 0 of child 1 {TEXT} of child 2 {B} of child 4 {SPAN} of root {DIV}
-end: position 7 of child 1 {TEXT} of child 2 {DIV} of child 2 {B} of child 4 {SPAN} of root {DIV}
-upstream: position 7 of child 1 {TEXT} of child 2 {DIV} of child 2 {B} of child 4 {SPAN} of root {DIV}
-downstream: position 0 of child 1 {TEXT} of child 2 {SPAN} of child 2 {DIV} of child 2 {B} of child 4 {SPAN} of root {DIV}
+end: position 7 of child 1 {TEXT} of child 1 {B} of child 1 {SPAN} of child 5 {DIV} of root {DIV}
+upstream: position 7 of child 1 {TEXT} of child 1 {B} of child 1 {SPAN} of child 5 {DIV} of root {DIV}
+downstream: position 0 of child 1 {TEXT} of child 2 {B} of child 1 {SPAN} of child 5 {DIV} of root {DIV}
RenderInline {SPAN} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderInline {SPAN} at (0,0) size 150x28
- RenderInline {SPAN} at (0,0) size 150x28
- RenderText {TEXT} at (0,0) size 150x28
- text run at (0,0) width 150: "xxxxxx xxxxxx"
- RenderBlock (anonymous) at (14,42) size 756x28
- RenderBlock {DIV} at (0,0) size 756x28
- RenderText {TEXT} at (0,0) size 156x28
- text run at (0,0) width 156: " xxxxxx xxxxxx"
- RenderBlock (anonymous) at (14,70) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
+ RenderText {TEXT} at (0,0) size 150x28
+ text run at (0,0) width 150: "xxxxxx xxxxxx"
+ RenderBlock {DIV} at (14,42) size 756x28
+ RenderText {TEXT} at (0,0) size 156x28
+ text run at (0,0) width 156: " xxxxxx xxxxxx"
selection is CARET:
-start: position 14 of child 1 {TEXT} of child 2 {DIV} of child 4 {SPAN} of root {DIV}
-upstream: position 14 of child 1 {TEXT} of child 2 {DIV} of child 4 {SPAN} of root {DIV}
-downstream: position 14 of child 1 {TEXT} of child 2 {DIV} of child 4 {SPAN} of root {DIV}
+start: position 14 of child 1 {TEXT} of child 5 {DIV} of root {DIV}
+upstream: position 14 of child 1 {TEXT} of child 5 {DIV} of root {DIV}
+downstream: position 14 of child 1 {TEXT} of child 5 {DIV} of root {DIV}
RenderText {TEXT} at (0,0) size 0x0
RenderInline {SPAN} at (0,0) size 150x28
RenderInline {B} at (0,0) size 150x28
- RenderInline {SPAN} at (0,0) size 150x28
- RenderText {TEXT} at (0,0) size 150x28
- text run at (0,0) width 150: "xxxxxx xxxxxx"
- RenderBlock (anonymous) at (14,42) size 756x28
- RenderBlock {DIV} at (0,0) size 756x28
+ RenderText {TEXT} at (0,0) size 150x28
+ text run at (0,0) width 150: "xxxxxx xxxxxx"
+ RenderBlock {DIV} at (14,42) size 756x28
+ RenderInline {B} at (0,0) size 156x28
RenderText {TEXT} at (0,0) size 156x28
text run at (0,0) width 156: " xxxxxx xxxxxx"
- RenderBlock (anonymous) at (14,70) size 756x0
- RenderInline {SPAN} at (0,0) size 0x0
- RenderInline {B} at (0,0) size 0x0
selection is CARET:
-start: position 14 of child 1 {TEXT} of child 2 {DIV} of child 1 {B} of child 4 {SPAN} of root {DIV}
-upstream: position 14 of child 1 {TEXT} of child 2 {DIV} of child 1 {B} of child 4 {SPAN} of root {DIV}
-downstream: position 14 of child 1 {TEXT} of child 2 {DIV} of child 1 {B} of child 4 {SPAN} of root {DIV}
+start: position 14 of child 1 {TEXT} of child 1 {B} of child 5 {DIV} of root {DIV}
+upstream: position 14 of child 1 {TEXT} of child 1 {B} of child 5 {DIV} of root {DIV}
+downstream: position 14 of child 1 {TEXT} of child 1 {B} of child 5 {DIV} of root {DIV}
+2005-03-01 Ken Kocienda <kocienda@apple.com>
+
+ Reviewed by John
+
+ Fix for this bug:
+
+ <rdar://problem/3996605> Insert paragraph command puts new block in wrong place, creating difficult-to-handle HTML
+
+ * khtml/editing/htmlediting.cpp:
+ (khtml::InsertParagraphSeparatorCommand::doApply): Look for the upstream-most block to insert after
+ when at the visible end of a block. This helps to avoid some undesirable sequences of markup which
+ Dave says will be vary hard to render. Changing the command in this way avoids the "limitations"
+ of the render tree by not asking it to render markup we do not want to make anyway.
+
+ All these tests change, but either in insignificant ways, or for the better.
+
+ * layout-tests/editing/deleting/delete-3959464-fix-expected.txt:
+ * layout-tests/editing/inserting/insert-div-001-expected.txt:
+ * layout-tests/editing/inserting/insert-div-002-expected.txt:
+ * layout-tests/editing/inserting/insert-div-004-expected.txt:
+ * layout-tests/editing/inserting/insert-div-005-expected.txt:
+ * layout-tests/editing/inserting/insert-div-009-expected.txt:
+ * layout-tests/editing/inserting/insert-div-024-expected.txt:
+ * layout-tests/editing/pasteboard/paste-text-011-expected.txt:
+ * layout-tests/editing/pasteboard/paste-text-013-expected.txt:
+ * layout-tests/editing/pasteboard/paste-text-015-expected.txt:
+ * layout-tests/editing/style/block-style-004-expected.txt:
+ * layout-tests/editing/style/block-style-005-expected.txt:
+ * layout-tests/editing/style/block-style-006-expected.txt:
+ * layout-tests/editing/style/remove-underline-across-paragraph-expected.txt:
+ * layout-tests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
+ * layout-tests/editing/style/remove-underline-after-paragraph-expected.txt:
+ * layout-tests/editing/style/remove-underline-after-paragraph-in-bold-expected.txt:
+
+ New test to check specific problem mentioned in the bug.
+
+ * layout-tests/editing/inserting/insert-div-026-expected.txt: Added.
+ * layout-tests/editing/inserting/insert-div-026.html: Added.
+
2005-02-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
if (downstreamInDifferentBlock || isLastInBlock) {
LOG(Editing, "insert paragraph separator: last in block case");
NodeImpl *refNode = isLastInBlock && !startBlockIsRoot ? startBlock : pos.node();
- insertNodeAfter(blockToInsert, refNode);
+ NodeImpl *parent = refNode->parentNode();
+ NodeImpl *rootEditable = refNode->rootEditableElement();
+ ASSERT(parent);
+ ASSERT(rootEditable);
+ while (parent && rootEditable && refNode != rootEditable && isLastVisiblePositionInNode(visiblePos, parent)) {
+ refNode = parent;
+ parent = parent->parentNode();
+ }
+ if (refNode == rootEditable)
+ appendNode(blockToInsert, refNode);
+ else
+ insertNodeAfter(blockToInsert, refNode);
insertBlockPlaceholder(blockToInsert);
setEndingSelection(Position(blockToInsert, 0), DOWNSTREAM);
applyStyleAfterInsertion();