MCPcopy
hub / github.com/jagenjo/webglstudio.js / Display

Function Display

editor/js/extra/codemirror/codemirror.js:136–232  ·  view source on GitHub ↗
(place, doc, input)

Source from the content-addressed store, hash-verified

134 // display-related state.
135
136 function Display(place, doc, input) {
137 var d = this;
138 this.input = input;
139
140 // Covers bottom-right square when both scrollbars are present.
141 d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
142 d.scrollbarFiller.setAttribute("cm-not-content", "true");
143 // Covers bottom of gutter when coverGutterNextToScrollbar is on
144 // and h scrollbar is present.
145 d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
146 d.gutterFiller.setAttribute("cm-not-content", "true");
147 // Will contain the actual code, positioned to cover the viewport.
148 d.lineDiv = elt("div", null, "CodeMirror-code");
149 // Elements are added to these to represent selection and cursors.
150 d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
151 d.cursorDiv = elt("div", null, "CodeMirror-cursors");
152 // A visibility: hidden element used to find the size of things.
153 d.measure = elt("div", null, "CodeMirror-measure");
154 // When lines outside of the viewport are measured, they are drawn in this.
155 d.lineMeasure = elt("div", null, "CodeMirror-measure");
156 // Wraps everything that needs to exist inside the vertically-padded coordinate system
157 d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
158 null, "position: relative; outline: none");
159 // Moved around its parent to cover visible view.
160 d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
161 // Set to the height of the document, allowing scrolling.
162 d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
163 d.sizerWidth = null;
164 // Behavior of elts with overflow: auto and padding is
165 // inconsistent across browsers. This is used to ensure the
166 // scrollable area is big enough.
167 d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
168 // Will contain the gutters, if any.
169 d.gutters = elt("div", null, "CodeMirror-gutters");
170 d.lineGutter = null;
171 // Actual scrollable element.
172 d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
173 d.scroller.setAttribute("tabIndex", "-1");
174 // The element in which the editor lives.
175 d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
176
177 // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
178 if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
179 if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;
180
181 if (place) {
182 if (place.appendChild) place.appendChild(d.wrapper);
183 else place(d.wrapper);
184 }
185
186 // Current rendered range (may be bigger than the view window).
187 d.viewFrom = d.viewTo = doc.first;
188 d.reportedViewFrom = d.reportedViewTo = doc.first;
189 // Information about the rendered lines.
190 d.view = [];
191 d.renderedView = null;
192 // Holds info about a single rendered line when it was rendered
193 // for measurement, while not in view.

Callers

nothing calls this directly

Calls 1

eltFunction · 0.85

Tested by

no test coverage detected