<!DOCTYPE html><!--  webkit-test-runner [ LiveRangeSelectionEnabled=true ]  -->
<html>
<body>
<script src="../../resources/dump-as-markup.js"></script>
<div contenteditable="true">
<span id="imgTest">text1<img src="abe.png"/>text2</span>
<br>
<span id="inputTest">text1<input type="text"></input>text2</span>
<br>
<span id="objectTest">text1<object style="display: inline" border="1"></object>text2</span>
</div>
<script>
Markup.description('Testcase for bug https://webkit.org/b/115023: Editing: wrong text position when you click enter on the text behind the image.\n'+
'The test passes if "text2" appears on a new line with the caret placed at the beginning of that line.');

Markup.waitUntilDone();

var test = document.getElementById('imgTest');
test.focus();
var selection = window.getSelection();
selection.collapse(test, test.childNodes.length - 1);
document.execCommand("InsertParagraph");
Markup.dump(test);

test = document.getElementById('inputTest');
test.focus();
selection = window.getSelection();
selection.collapse(test, test.childNodes.length - 1);
document.execCommand("InsertParagraph");
Markup.dump(test);

test = document.getElementById('objectTest');
test.focus();
selection = window.getSelection();
selection.collapse(test, test.childNodes.length - 1);
document.execCommand("InsertParagraph");
Markup.dump(test);

Markup.notifyDone();
</script>
</body>
</html>
