Bug 345178 Remove tooltip width limit for tab-preview tooltips and improve preview behavior for small images
r+sr=neil git-svn-id: svn://10.0.0.236/trunk@207014 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user