<!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">HelloשלוםHelloשלום</div>
<div id="markStartComposition">HelloשלוםHelloשלום</div>
<div id="markEndComposition">HelloשלוםHelloשלום</div>
<div id="markTrickyComposition">HelloשלוםHelloשלום</div>
<div id="markAllSpelling">HelloשלוםHelloשלום</div>
<div id="markStartSpelling">HelloשלוםHelloשלום</div>
<div id="markEndSpelling">HelloשלוםHelloשלום</div>
<div id="markTrickySpelling">HelloשלוםHelloשלום</div>
<div id="markAllTextMatch">HelloשלוםHelloשלום</div>
<div id="markStartTextMatch">HelloשלוםHelloשלום</div>
<div id="markEndTextMatch">HelloשלוםHelloשלום</div>
<div id="markTrickyTextMatch">HelloשלוםHelloשלום</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, 13);
addCompositionMarker(markEndComposition, 4, 18);
addCompositionMarker(markTrickyComposition, 4, 6);
addSpellingMarker(markAllSpelling, 0, 18);
addSpellingMarker(markStartSpelling, 0, 13);
addSpellingMarker(markEndSpelling, 4, 18);
addSpellingMarker(markTrickySpelling, 4, 6);
addTextMatchMarker(markAllTextMatch, 0, 18);
addTextMatchMarker(markStartTextMatch, 0, 13);
addTextMatchMarker(markEndTextMatch, 4, 18);
addTextMatchMarker(markTrickyTextMatch, 4, 6);
}, true);
</script>