(display)
| 2887 | |
| 2888 | // Compute the default character width. |
| 2889 | function charWidth(display) { |
| 2890 | if (display.cachedCharWidth != null) { return display.cachedCharWidth } |
| 2891 | var anchor = elt("span", "xxxxxxxxxx"); |
| 2892 | var pre = elt("pre", [anchor], "CodeMirror-line-like"); |
| 2893 | removeChildrenAndAdd(display.measure, pre); |
| 2894 | var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; |
| 2895 | if (width > 2) { display.cachedCharWidth = width; } |
| 2896 | return width || 10 |
| 2897 | } |
| 2898 | |
| 2899 | // Do a bulk-read of the DOM positions and sizes needed to draw the |
| 2900 | // view, so that we don't interleave reading and writing to the DOM. |
no test coverage detected