Skip to content

Commit

Permalink
Reorder operation in measureLine to save one relayout
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Oct 15, 2012
1 parent 8531034 commit eae22b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/codemirror.js
Expand Up @@ -756,12 +756,13 @@ window.CodeMirror = (function() {
var atEnd = ch && ch == line.text.length;
var pre = lineContent(cm, line, atEnd ? ch - 1 : ch);
removeChildrenAndAdd(display.measure, pre);
var anchor = pre.anchor, outer = display.lineDiv.getBoundingClientRect();
var anchor = pre.anchor;
// We'll sample once at the top, once at the bottom of the line,
// to get the real line height (in case there tokens on the line
// with bigger fonts)
anchor.style.verticalAlign = "top";
var box1 = anchor.getBoundingClientRect(), left = box1.left - outer.left, right = box1.right - outer.left;
var outer = display.lineDiv.getBoundingClientRect(), box1 = anchor.getBoundingClientRect();
var left = box1.left - outer.left, right = box1.right - outer.left;
if (ie) {
var left1 = anchor.offsetLeft;
// In IE, verticalAlign does not influence offsetTop, unless
Expand Down

0 comments on commit eae22b7

Please sign in to comment.