1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-03 23:25:47 +01:00

Fix itemlist scrolling changes in revision 1e95cff03040.

This commit is contained in:
Kris Maglione
2010-09-24 17:38:25 -04:00
parent 6e0aa6a23b
commit 0c34437805
2 changed files with 5 additions and 5 deletions

View File

@@ -1643,7 +1643,7 @@ const ItemList = Class("ItemList", {
</div>
</div>, this._divNodes);
this._doc.body.replaceChild(this._div, this._doc.body.firstChild);
util.scrollIntoView(this._div);
util.scrollIntoView(this._div, true);
this._items.contextList.forEach(function init_eachContext(context) {
delete context.cache.nodes;
@@ -1813,7 +1813,7 @@ const ItemList = Class("ItemList", {
this._fill(newOffset);
if (index >= 0) {
this._getCompletion(index).setAttribute("selected", "true");
this._getCompletion(index).scrollIntoView(false);
util.scrollIntoView(this._getCompletion(index));
}
//if (index == 0)

View File

@@ -668,11 +668,11 @@ const Util = Module("Util", {
*
* @param {Node} elem The element to make visible.
*/
scrollIntoView: function scrollIntoView(elem) {
scrollIntoView: function scrollIntoView(elem, alignWithTop) {
let win = elem.ownerDocument.defaultView;
let rect = elem.getBoundingClientRect();
if (!(rect && rect.top < win.innerHeight && rect.bottom >= 0 && rect.left < win.innerWidth && rect.right >= 0))
elem.scrollIntoView();
if (!(rect && rect.bottom <= win.innerHeight && rect.top >= 0 && rect.right <= win.innerWidth && rect.left >= 0))
elem.scrollIntoView(arguments.length > 1 ? alignWithTop : Math.abs(rect.top) < Math.abs(win.innerHeight - rect.bottom));
},
/**