зеркало из https://github.com/mozilla/gecko-dev.git
Bug 639102 - Draw thumbnails on FirstPaint. r=mbrubeck, a=pavlov
This commit is contained in:
Родитель
f38340fe54
Коммит
9777bcf2d1
|
@ -1417,9 +1417,6 @@ Browser.WebProgress.prototype = {
|
|||
|
||||
if (aTab == Browser.selectedTab)
|
||||
BrowserUI.update(TOOLBARSTATE_LOADED);
|
||||
|
||||
if (aTab.browser.currentURI.spec != "about:blank")
|
||||
aTab.updateThumbnail();
|
||||
},
|
||||
|
||||
_documentStop: function _documentStop(aTab) {
|
||||
|
@ -1446,6 +1443,8 @@ Browser.WebProgress.prototype = {
|
|||
}
|
||||
|
||||
aTab.scrolledAreaChanged();
|
||||
if (browser.currentURI.spec != "about:blank")
|
||||
aTab.updateThumbnail();
|
||||
browser.messageManager.addMessageListener("MozScrolledAreaChanged", aTab.scrolledAreaChanged);
|
||||
});
|
||||
}
|
||||
|
@ -2519,6 +2518,10 @@ Tab.prototype = {
|
|||
endLoading: function endLoading() {
|
||||
if (!this._loading) throw "Not Loading!";
|
||||
this._loading = false;
|
||||
if (this._drawThumb) {
|
||||
this._drawThumb = false;
|
||||
this.updateThumbnail();
|
||||
}
|
||||
},
|
||||
|
||||
isLoading: function isLoading() {
|
||||
|
@ -2714,6 +2717,11 @@ Tab.prototype = {
|
|||
updateThumbnail: function updateThumbnail() {
|
||||
let browser = this._browser;
|
||||
|
||||
if (this._loading) {
|
||||
this._drawThumb = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not repaint thumbnail if we already painted for this load. Bad things
|
||||
// happen when we do async canvas draws in quick succession.
|
||||
if (!browser || this._thumbnailWindowId == browser.contentWindowId)
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
const tabHeight = 65;
|
||||
|
||||
let ratio = tabHeight / tabWidth;
|
||||
if (browser.contentDocumentWidth > 0)
|
||||
width = Math.min(width, browser.contentDocumentWidth);
|
||||
height = width * ratio;
|
||||
|
||||
let thumbnail = this.thumbnail;
|
||||
|
@ -78,7 +80,7 @@
|
|||
}
|
||||
|
||||
let self = this;
|
||||
let renderer = rendererFactory(browser, thumbnail)
|
||||
let renderer = rendererFactory(browser, thumbnail);
|
||||
renderer.drawContent(function(ctx, callback) {
|
||||
ctx.save();
|
||||
ctx.clearRect(0, 0, tabWidth, tabHeight);
|
||||
|
|
Загрузка…
Ссылка в новой задаче