(cm, lineObj, rect, context)
| 2788 | // "line", "div" (display.lineDiv), "local"/null (editor), "window", |
| 2789 | // or "page". |
| 2790 | function intoCoordSystem(cm, lineObj, rect, context) { |
| 2791 | if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { |
| 2792 | var size = widgetHeight(lineObj.widgets[i]); |
| 2793 | rect.top += size; rect.bottom += size; |
| 2794 | } |
| 2795 | if (context == "line") return rect; |
| 2796 | if (!context) context = "local"; |
| 2797 | var yOff = heightAtLine(lineObj); |
| 2798 | if (context == "local") yOff += paddingTop(cm.display); |
| 2799 | else yOff -= cm.display.viewOffset; |
| 2800 | if (context == "page" || context == "window") { |
| 2801 | var lOff = cm.display.lineSpace.getBoundingClientRect(); |
| 2802 | yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); |
| 2803 | var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); |
| 2804 | rect.left += xOff; rect.right += xOff; |
| 2805 | } |
| 2806 | rect.top += yOff; rect.bottom += yOff; |
| 2807 | return rect; |
| 2808 | } |
| 2809 | |
| 2810 | // Coverts a box from "div" coords to another coordinate system. |
| 2811 | // Context may be "window", "page", "div", or "local"/null. |
no test coverage detected