Bug 828111 - Workaround multiple reflows issue and slow xbl attachment in the downloads view. r=mak

This commit is contained in:
Asaf Romano 2013-01-09 16:03:41 +02:00
Родитель c5838870ff
Коммит c516f4a078
2 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -2,6 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* The downloads richlistbox may list thousands of items, and it turns out
* XBL binding attachment, and even more so detachment, is a performance hog.
* This hack makes sure we don't apply any binding to inactive items (inactive
* items are history downloads that haven't been in the visible area).
* We can do this because the richlistbox implementation does not interact
* much with the richlistitem binding. However, this may turn out to have
* some side effects (see bug 828111 for the details).
*
* We might be able to do away with this workaround once bug 653881 is fixed.
*/
richlistitem.download {
-moz-binding: none;
}
richlistitem.download[active] {
-moz-binding: url('chrome://browser/content/downloads/download.xml#download-full-ui');
}

Просмотреть файл

@ -1047,10 +1047,20 @@ DownloadsPlacesView.prototype = {
}
}
this._richlistbox.appendChild(elementsToAppendFragment);
this._appendDownloadsFragment(elementsToAppendFragment);
this._ensureVisibleElementsAreActive();
},
_appendDownloadsFragment: function DPV__appendDownloadsFragment(aDOMFragment) {
// Workaround multiple reflows hang by removing the richlistbox
// and adding it back when we're done.
let parentNode = this._richlistbox.parentNode;
let nextSibling = this._richlistbox.nextSibling;
parentNode.removeChild(this._richlistbox);
this._richlistbox.appendChild(aDOMFragment);
parentNode.insertBefore(this._richlistbox, nextSibling);
},
nodeInserted: function DPV_nodeInserted(aParent, aPlacesNode) {
this._addDownloadData(null, aPlacesNode);
},