(place, docStart)
| 100 | // DISPLAY CONSTRUCTOR |
| 101 | |
| 102 | function makeDisplay(place, docStart) { |
| 103 | var d = {}; |
| 104 | |
| 105 | var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none"); |
| 106 | if (webkit) input.style.width = "1000px"; |
| 107 | else input.setAttribute("wrap", "off"); |
| 108 | // if border: 0; -- iOS fails to open keyboard (issue #1287) |
| 109 | if (ios) input.style.border = "1px solid black"; |
| 110 | input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); input.setAttribute("spellcheck", "false"); |
| 111 | |
| 112 | // Wraps and hides input textarea |
| 113 | d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); |
| 114 | // The actual fake scrollbars. |
| 115 | d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar"); |
| 116 | d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar"); |
| 117 | d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); |
| 118 | d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); |
| 119 | // DIVs containing the selection and the actual code |
| 120 | d.lineDiv = elt("div", null, "CodeMirror-code"); |
| 121 | d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); |
| 122 | // Blinky cursor, and element used to ensure cursor fits at the end of a line |
| 123 | d.cursor = elt("div", "\u00a0", "CodeMirror-cursor"); |
| 124 | // Secondary cursor, shown when on a 'jump' in bi-directional text |
| 125 | d.otherCursor = elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"); |
| 126 | // Used to measure text size |
| 127 | d.measure = elt("div", null, "CodeMirror-measure"); |
| 128 | // Wraps everything that needs to exist inside the vertically-padded coordinate system |
| 129 | d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor], |
| 130 | null, "position: relative; outline: none"); |
| 131 | // Moved around its parent to cover visible view |
| 132 | d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative"); |
| 133 | // Set to the height of the text, causes scrolling |
| 134 | d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); |
| 135 | // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers |
| 136 | d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerCutOff + "px; width: 1px;"); |
| 137 | // Will contain the gutters, if any |
| 138 | d.gutters = elt("div", null, "CodeMirror-gutters"); |
| 139 | d.lineGutter = null; |
| 140 | // Provides scrolling |
| 141 | d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); |
| 142 | d.scroller.setAttribute("tabIndex", "-1"); |
| 143 | // The element in which the editor lives. |
| 144 | d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV, |
| 145 | d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); |
| 146 | // Work around IE7 z-index bug |
| 147 | if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } |
| 148 | if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper); |
| 149 | |
| 150 | // Needed to hide big blue blinking cursor on Mobile Safari |
| 151 | if (ios) input.style.width = "0px"; |
| 152 | if (!webkit) d.scroller.draggable = true; |
| 153 | // Needed to handle Tab key in KHTML |
| 154 | if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; } |
| 155 | // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). |
| 156 | else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px"; |
| 157 | |
| 158 | // Current visible range (may be bigger than the view window). |
| 159 | d.viewOffset = d.lastSizeC = 0; |
no test coverage detected