Skip to content

Commit

Permalink
[show-hint addon] Move call to getScrollInto to avoid a reflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jul 1, 2016
1 parent 34b3a7b commit 6a84559
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@
(completion.options.container || document.body).appendChild(hints);
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1
var startScroll = cm.getScrollInfo();

if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
Expand Down Expand Up @@ -273,7 +275,6 @@
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
}

var startScroll = cm.getScrollInfo();
cm.on("scroll", this.onScroll = function() {
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
var newTop = top + startScroll.top - curScroll.top;
Expand Down

0 comments on commit 6a84559

Please sign in to comment.