(cm, prepared, ch, bias)
| 3770 | } |
| 3771 | |
| 3772 | function measureCharInner(cm, prepared, ch, bias) { |
| 3773 | var place = nodeAndOffsetInLineMap(prepared.map, ch, bias) |
| 3774 | var node = place.node, |
| 3775 | start = place.start, |
| 3776 | end = place.end, |
| 3777 | collapse = place.collapse |
| 3778 | |
| 3779 | var rect |
| 3780 | if (node.nodeType == 3) { |
| 3781 | // If it is a text node, use a range to retrieve the coordinates. |
| 3782 | for (var i$1 = 0; i$1 < 4; i$1++) { |
| 3783 | // Retry a maximum of 4 times when nonsense rectangles are returned |
| 3784 | while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { |
| 3785 | --start |
| 3786 | } |
| 3787 | while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { |
| 3788 | ++end |
| 3789 | } |
| 3790 | if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) { |
| 3791 | rect = node.parentNode.getBoundingClientRect() |
| 3792 | } else { |
| 3793 | rect = getUsefulRect(range(node, start, end).getClientRects(), bias) |
| 3794 | } |
| 3795 | if (rect.left || rect.right || start == 0) { |
| 3796 | break |
| 3797 | } |
| 3798 | end = start |
| 3799 | start = start - 1 |
| 3800 | collapse = "right" |
| 3801 | } |
| 3802 | if (ie && ie_version < 11) { |
| 3803 | rect = maybeUpdateRectForZooming(cm.display.measure, rect) |
| 3804 | } |
| 3805 | } else { |
| 3806 | // If it is a widget, simply get the box for the whole widget. |
| 3807 | if (start > 0) { |
| 3808 | collapse = bias = "right" |
| 3809 | } |
| 3810 | var rects |
| 3811 | if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) { |
| 3812 | rect = rects[bias == "right" ? rects.length - 1 : 0] |
| 3813 | } else { |
| 3814 | rect = node.getBoundingClientRect() |
| 3815 | } |
| 3816 | } |
| 3817 | if (ie && ie_version < 9 && !start && (!rect || (!rect.left && !rect.right))) { |
| 3818 | var rSpan = node.parentNode.getClientRects()[0] |
| 3819 | if (rSpan) { |
| 3820 | rect = { left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom } |
| 3821 | } else { |
| 3822 | rect = nullRect |
| 3823 | } |
| 3824 | } |
| 3825 | |
| 3826 | var rtop = rect.top - prepared.rect.top, |
| 3827 | rbot = rect.bottom - prepared.rect.top |
| 3828 | var mid = (rtop + rbot) / 2 |
| 3829 | var heights = prepared.view.measure.heights |
no test coverage detected