(display)
| 4308 | |
| 4309 | // Compute the default character width. |
| 4310 | function charWidth(display) { |
| 4311 | if (display.cachedCharWidth != null) { |
| 4312 | return display.cachedCharWidth |
| 4313 | } |
| 4314 | var anchor = elt("span", "xxxxxxxxxx") |
| 4315 | var pre = elt("pre", [anchor]) |
| 4316 | removeChildrenAndAdd(display.measure, pre) |
| 4317 | var rect = anchor.getBoundingClientRect(), |
| 4318 | width = (rect.right - rect.left) / 10 |
| 4319 | if (width > 2) { |
| 4320 | display.cachedCharWidth = width |
| 4321 | } |
| 4322 | return width || 10 |
| 4323 | } |
| 4324 | |
| 4325 | // Do a bulk-read of the DOM positions and sizes needed to draw the |
| 4326 | // view, so that we don't interleave reading and writing to the DOM. |
no test coverage detected