chromium/third_party/blink/web_tests/editing/selection/mixed-editability-inline-height.html

<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<body contenteditable="true">
<p id="p"><span id="span" contenteditable="false" style="display: inline-block; height: 10mm; width:10mm; background-color:yellow;"></span></p>
<div id="console"></div><!-- to keep the test target at the top of the document -->
<script>
description('This confirms that settin the caret before an empty non-editable inline-block element with height.');

var sel = getSelection();
var range = document.createRange();
var p = document.getElementById('p');
range.setStart(p, 0);
range.setEnd(p, 0); // not needed, but to ensure the same code path as bug 428986
sel.removeAllRanges();
sel.addRange(range);
shouldBe('getSelection().rangeCount', '1');
shouldBe('getSelection().anchorNode', 'p');
shouldBe('getSelection().anchorOffset', '0');
shouldBe('getSelection().anchorNode', 'getSelection().focusNode');
shouldBe('getSelection().anchorOffset', 'getSelection().focusOffset');
caretShouldBe('span.getBoundingClientRect().left');

sel.modify('move', 'forward', 'character');
shouldBe('getSelection().rangeCount', '1');
shouldBe('getSelection().anchorNode', 'p');
shouldBe('getSelection().anchorOffset', '1');
shouldBe('getSelection().anchorNode', 'getSelection().focusNode');
shouldBe('getSelection().anchorOffset', 'getSelection().focusOffset');
caretShouldBe('span.getBoundingClientRect().right', 2);

function caretShouldBe(expected, tolerance) {
    if (!window.internals) {
        debug("TEST SKIPPED, cannot test the caret position without window.internals");
        return;
    }
    shouldBe('internals.absoluteCaretBounds().left', expected, false, tolerance);
}
</script>
</body>