Bug 527105 - Hovering over a taskbar preview causes the product name in the title bar to disappear r=rflint sr=mconnor

This commit is contained in:
Rob Arnold 2010-01-17 09:04:00 -05:00
Родитель ca0d383a0f
Коммит 0c3d321b56
2 изменённых файлов: 24 добавлений и 10 удалений

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

@ -805,7 +805,8 @@
</body>
</method>
<method name="updateTitlebar">
<method name="getWindowTitleForBrowser">
<parameter name="aBrowser"/>
<body>
<![CDATA[
var newTitle = "";
@ -813,8 +814,8 @@
var docElement = this.ownerDocument.documentElement;
var sep = docElement.getAttribute("titlemenuseparator");
if (this.docShell.contentViewer)
docTitle = this.contentTitle;
if (aBrowser.docShell.contentViewer)
docTitle = aBrowser.contentTitle;
if (!docTitle)
docTitle = docElement.getAttribute("titledefault");
@ -834,7 +835,7 @@
try {
if (docElement.getAttribute("chromehidden").indexOf("location") != -1) {
var uri = this.mURIFixup.createExposableURI(
this.mCurrentBrowser.currentURI);
aBrowser.currentURI);
if (uri.scheme == "about")
newTitle = uri.spec + sep + newTitle;
else
@ -842,7 +843,15 @@
}
} catch (e) {}
this.ownerDocument.title = newTitle;
return newTitle;
]]>
</body>
</method>
<method name="updateTitlebar">
<body>
<![CDATA[
this.ownerDocument.title = this.getWindowTitleForBrowser(this.mCurrentBrowser);
]]>
</body>
</method>

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

@ -258,6 +258,12 @@ PreviewController.prototype = {
this.dirtyRegion.unionRect(r.x, r.y, r.width, r.height);
},
updateTitleAndTooltip: function () {
let title = this.win.tabbrowser.getWindowTitleForBrowser(this.linkedBrowser);
this.preview.title = title;
this.preview.tooltip = title;
},
//////////////////////////////////////////////////////////////////////////////
//// nsITaskbarPreviewController
@ -345,9 +351,7 @@ PreviewController.prototype = {
// The tab's label is sometimes empty when dragging tabs between windows
// so we force the tab title to be updated (see bug 520579)
this.win.tabbrowser.setTabTitle(this.tab);
let title = this.tab.label;
this.preview.title = title;
this.preview.tooltip = title;
this.updateTitleAndTooltip();
break;
}
}
@ -420,8 +424,6 @@ TabWindow.prototype = {
newTab: function (tab) {
let controller = new PreviewController(this, tab);
let preview = AeroPeek.taskbar.createTaskbarTabPreview(tab.linkedBrowser.docShell, controller);
preview.title = tab.label;
preview.tooltip = tab.label;
preview.visible = AeroPeek.enabled;
preview.active = this.tabbrowser.selectedTab == tab;
// Grab the default favicon
@ -435,6 +437,9 @@ TabWindow.prototype = {
// It's OK to add the preview now while the favicon still loads.
this.previews.splice(tab._tPos, 0, preview);
AeroPeek.addPreview(preview);
// updateTitleAndTooltip relies on having controller.preview which is lazily resolved.
// Now that we've updated this.previews, it will resolve successfully.
controller.updateTitleAndTooltip();
},
// Invoked when the given tab is closed