Index: third_party/WebKit/LayoutTests/editing/active-suggestion-marker-split.html |
diff --git a/third_party/WebKit/LayoutTests/editing/active-suggestion-marker-split.html b/third_party/WebKit/LayoutTests/editing/active-suggestion-marker-split.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e863ccb0df7957fdd4325d04b0c51f517461e024 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/active-suggestion-marker-split.html |
@@ -0,0 +1,36 @@ |
+<!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.addActiveSuggestionMarker(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> |