Bug 345178 Remove tooltip width limit for tab-preview tooltips and improve preview behavior for small images

r+sr=neil
This commit is contained in:
cst%yecc.com 2006-08-09 22:48:23 +00:00
Родитель ad5e04631c
Коммит 9f2e5ac2f6
3 изменённых файлов: 14 добавлений и 1 удалений

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

@ -54,3 +54,7 @@ tab[busy] {
margin: 0px;
list-style-image: url("chrome://global/skin/icons/tab-new.gif");
}
tooltip[tabpreview="true"] {
max-width: none;
}

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

@ -65,3 +65,7 @@ tab[busy] {
position: relative;
list-style-image: url('chrome://global/skin/icons/tab-drag-indicator.gif');
}
tooltip[tabpreview="true"] {
max-width: none;
}

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

@ -214,6 +214,7 @@
if (!this.mPrefs.getBoolPref("browser.tabs.tooltippreview.enable")) {
label.removeAttribute("width");
aPopup.removeAttribute("tabpreview");
return true;
}
@ -225,6 +226,7 @@
}
label.width = 0;
aPopup.setAttribute("tabpreview", "true");
var win = b.contentWindow;
var w = win.innerWidth;
var h = win.innerHeight;
@ -243,7 +245,10 @@
ctx.fillRect(0, 0, canvasW, canvasH);
var img = b.contentDocument.body.firstChild;
var ratio = img.naturalHeight / img.naturalWidth;
if (ratio * canvasW > canvasH) {
if (img.naturalHeight <= canvasH && img.naturalWidth <= canvasW) {
ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
}
else if (ratio * canvasW > canvasH) {
ctx.drawImage(img, 0, 0, canvasH / ratio, canvasH);
}
else {