<!DOCTYPE html>
<html>
<body>
<p>This tests selecting all with an open input method composition.
To manually test, type some letter in the editable region below and then select all.
WebKit should not delete contents.</p>
<div id="container"><div contenteditable>PAS</div></div>
<script src="../../resources/dump-as-markup.js"></script>
<script>

if (window.testRunner) {
    var container = document.getElementById('container');
    container.firstChild.focus();
    getSelection().collapse(container.firstChild.firstChild, 5);
    if (window.textInputController) {
        Markup.description(document.getElementsByTagName('p')[0].textContent);

        textInputController.setMarkedText("S", 0, 1);
        document.execCommand('selectAll', false, null);

        Markup.dump(container);
    } else
        Markup.description('FAIL - This test requires textInputController');
}

</script>
</body>
</html>

<!DOCTYPE html>
<html>
<body>
<p>This tests selecting all with an open input method composition.
To manually test, type some letter in the editable region below and then select all.
WebKit should not delete contents.</p>
<div id="container"><div contenteditable>PAS</div></div>
<script src="../../resources/dump-as-markup.js"></script>
<script>

if (window.testRunner) {
    var container = document.getElementById('container');
    container.firstChild.focus();
    getSelection().collapse(container.firstChild.firstChild, 3);
    if (window.textInputController) {
        Markup.description(document.getElementsByTagName('p')[0].textContent);

        textInputController.setMarkedText("S", 0, 1);
        document.execCommand('selectAll', false, null);

        Markup.dump(container);
    } else
        Markup.description('FAIL - This test requires textInputController');
}

</script>
</body>
</html>

Call setPosition with valid offset in another layout test.
Call setPosition with valid offset in another layout test.

Some layout tests call setPosition(node, offset) with large |offset| which is larger than |node|'s length but it is invalid in the standard:
https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-collapse

A typically case is that, image following HTML:
<div>text</div>
if you want to set a caret to between 'x' and 't', you should call Selection.setPostion(div.firstChild, 3).
However, many layout tests call Selection.setPosition(div, 3), which is invalid.
Many of those tests want to just set a caret to a last position of the node so this CL changes to call setPosition(node, node.childNodes.length).

I'm going to change Selection.setPosition to throw an exception for such a invalid call through Range.setStart/End.

This CL is similar to previous one:
https://src.chromium.org/viewvc/blink?revision=173167&view=revision

BUG=

Review URL: https://codereview.chromium.org/272703007

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@173629 bbb929c8-8fbe-4397-9dbb-9b2b20218538
