| <!doctype html> |
| <script src="../resources/run-after-layout-and-paint.js"></script> |
| <!-- Text is injected after page load into the center of the initial text. |
| This results in an InlineTextBox with start() > 0, which allows testing |
| to make sure composition underlines are still painted in the right place. --> |
| <div id="markSplit">abc def</div> |
| <div id="markSplitTruncated" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 8em;">abcdefghi jklmnopqr</div> |
| <script> |
| function injectText(node, offset) { |
| var textNode = node.firstChild; |
| var replacementNode = textNode.splitText(offset); |
| var newTextNode = document.createTextNode(' xxx '); |
| node.insertBefore(newTextNode, replacementNode); |
| } |
| |
| function highlightRange(node) { |
| var range = document.createRange(); |
| var textNode = node.childNodes[2]; |
| range.setStart(textNode, 0); |
| range.setEnd(textNode, 4); |
| if (typeof internals !== 'undefined') |
| internals.addCompositionMarker(range, 'orange', 'thin', 'lightBlue'); |
| } |
| |
| onload = runAfterLayoutAndPaint(function() { |
| injectText(markSplit, 3); |
| // TODO(wkorman): This ITB has start=1, end=3, truncation=USHRT_MAX, len=3. |
| // Validate that the actual painting behavior is what's expected. |
| highlightRange(markSplit); |
| |
| injectText(markSplitTruncated, 9); |
| // TODO(wkorman): This ITB has start=1, end=9, truncation=3, len=9. Validate |
| // that the actual painting behavior is what's expected. |
| highlightRange(markSplitTruncated); |
| }, true); |
| </script> |