(line)
| 1025 | // Given a line object, find its line number by walking up through |
| 1026 | // its parent links. |
| 1027 | function lineNo(line) { |
| 1028 | if (line.parent == null) { |
| 1029 | return null |
| 1030 | } |
| 1031 | var cur = line.parent, |
| 1032 | no = indexOf(cur.lines, line) |
| 1033 | for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { |
| 1034 | for (var i = 0; ; ++i) { |
| 1035 | if (chunk.children[i] == cur) { |
| 1036 | break |
| 1037 | } |
| 1038 | no += chunk.children[i].chunkSize() |
| 1039 | } |
| 1040 | } |
| 1041 | return no + cur.first |
| 1042 | } |
| 1043 | |
| 1044 | // Find the line at the given vertical position, using the height |
| 1045 | // information in the document tree. |
no test coverage detected