(cm, lineObj, rect, context, includeWidgets)
| 2586 | // "line", "div" (display.lineDiv), "local"./null (editor), "window", |
| 2587 | // or "page". |
| 2588 | function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) { |
| 2589 | if (!includeWidgets) { |
| 2590 | var height = widgetTopHeight(lineObj); |
| 2591 | rect.top += height; rect.bottom += height; |
| 2592 | } |
| 2593 | if (context == "line") { return rect } |
| 2594 | if (!context) { context = "local"; } |
| 2595 | var yOff = heightAtLine(lineObj); |
| 2596 | if (context == "local") { yOff += paddingTop(cm.display); } |
| 2597 | else { yOff -= cm.display.viewOffset; } |
| 2598 | if (context == "page" || context == "window") { |
| 2599 | var lOff = cm.display.lineSpace.getBoundingClientRect(); |
| 2600 | yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); |
| 2601 | var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); |
| 2602 | rect.left += xOff; rect.right += xOff; |
| 2603 | } |
| 2604 | rect.top += yOff; rect.bottom += yOff; |
| 2605 | return rect |
| 2606 | } |
| 2607 | |
| 2608 | // Coverts a box from "div" coords to another coordinate system. |
| 2609 | // Context may be "window", "page", "div", or "local"./null. |
no test coverage detected