(cm, lineObj, rect, context)
| 2674 | // "line", "div" (display.lineDiv), "local"/null (editor), "window", |
| 2675 | // or "page". |
| 2676 | function intoCoordSystem(cm, lineObj, rect, context) { |
| 2677 | if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { |
| 2678 | var size = widgetHeight(lineObj.widgets[i]); |
| 2679 | rect.top += size; rect.bottom += size; |
| 2680 | } |
| 2681 | if (context == "line") return rect; |
| 2682 | if (!context) context = "local"; |
| 2683 | var yOff = heightAtLine(lineObj); |
| 2684 | if (context == "local") yOff += paddingTop(cm.display); |
| 2685 | else yOff -= cm.display.viewOffset; |
| 2686 | if (context == "page" || context == "window") { |
| 2687 | var lOff = cm.display.lineSpace.getBoundingClientRect(); |
| 2688 | yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); |
| 2689 | var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); |
| 2690 | rect.left += xOff; rect.right += xOff; |
| 2691 | } |
| 2692 | rect.top += yOff; rect.bottom += yOff; |
| 2693 | return rect; |
| 2694 | } |
| 2695 | |
| 2696 | // Coverts a box from "div" coords to another coordinate system. |
| 2697 | // Context may be "window", "page", "div", or "local"/null. |
no test coverage detected