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