chromium/third_party/blink/web_tests/paint/markers/ellipsis-ltr-text-in-ltr-flow-with-markers.html

<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
div {
    width: 100px;
    height: 20px;
    font: 12px;
    overflow: hidden;
    white-space: pre;
    text-overflow: ellipsis;
    direction: ltr;
}
</style>

<div id="markAllComposition">markAllComposition</div>
<div id="markStartComposition">markStartComposition</div>
<div id="markEndComposition">markEndComposition</div>

<div id="markAllSpelling">markAllSpelling</div>
<div id="markStartSpelling">markStartSpelling</div>
<div id="markEndSpelling">markEndSpelling</div>

<div id="markAllTextMatch">markAllTextMatch</div>
<div id="markStartTextMatch">markStartTextMatch</div>
<div id="markEndTextMatch">markEndTextMatch</div>

<script>
function addCompositionMarker(elem, start, end) {
    const range = document.createRange();
    const textNode = elem.firstChild;
    range.setStart(textNode, start);
    range.setEnd(textNode, end);
    if (typeof internals !== 'undefined')
        internals.addCompositionMarker(range, 'orange', 'thin', 'solid', 'transparent', 'lightBlue');
};

function addSpellingMarker(elem, start, end) {
    const range = document.createRange();
    const textNode = elem.firstChild;
    range.setStart(textNode, start);
    range.setEnd(textNode, end);
    if (typeof internals !== 'undefined')
        internals.setMarker(document, range, 'spelling');
};

function addTextMatchMarker(elem, start, end) {
    const range = document.createRange();
    const textNode = elem.firstChild;
    range.setStart(textNode, start);
    range.setEnd(textNode, end);
    if (typeof internals !== 'undefined') {
        internals.addTextMatchMarker(range, 'kActive');
        internals.setMarkedTextMatchesAreHighlighted(document, true);
    }
};

onload = runAfterLayoutAndPaint(function() {
    addCompositionMarker(markAllComposition, 0, 18);
    addCompositionMarker(markStartComposition, 0, 9);
    addCompositionMarker(markEndComposition, 7, 18);

    addSpellingMarker(markAllSpelling, 0, 15);
    addSpellingMarker(markStartSpelling, 0, 9);
    addSpellingMarker(markEndSpelling, 7, 15);

    addTextMatchMarker(markAllTextMatch, 0, 16);
    addTextMatchMarker(markStartTextMatch, 0, 9);
    addTextMatchMarker(markEndTextMatch, 7, 16);
}, true);
</script>