Bug 510302 Provide an overlay for content tab elements. r=asuth
This commit is contained in:
Родитель
d517a42d36
Коммит
0709bfb885
|
@ -47,6 +47,7 @@
|
|||
<?xul-overlay href="chrome://messenger/content/extraCustomizeItems.xul"?>
|
||||
<?xul-overlay href="chrome://messenger/content/mailOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://messenger/content/editContactOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://messenger/content/specialTabs.xul"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
|
@ -402,6 +403,7 @@
|
|||
</box> <!-- end of mailContent -->
|
||||
</tabpanels>
|
||||
</tabmail>
|
||||
<vbox id="contentTab"/>
|
||||
</hbox>
|
||||
<panel id="customizeToolbarSheetPopup" noautohide="true">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
|
|
|
@ -89,11 +89,11 @@ var specialTabs = {
|
|||
for (let selectedIndex = 0; selectedIndex < tabInfo.length;
|
||||
++selectedIndex) {
|
||||
if (tabInfo[selectedIndex].mode.name == this.name &&
|
||||
tabInfo[selectedIndex].panel.firstChild
|
||||
tabInfo[selectedIndex].browser
|
||||
.getAttribute("src")
|
||||
.replace(regEx, "") == contentUrl) {
|
||||
// Ensure we go to the correct location on the page.
|
||||
tabInfo[selectedIndex].panel.firstChild
|
||||
tabInfo[selectedIndex].browser
|
||||
.setAttribute("src", aContentPage);
|
||||
return selectedIndex;
|
||||
}
|
||||
|
@ -101,14 +101,17 @@ var specialTabs = {
|
|||
return -1;
|
||||
},
|
||||
openTab: function onTabOpened(aTab, {contentPage: aContentPage}) {
|
||||
// You can't dynamically change an iframe from a non-content to a content
|
||||
// type, therefore we dynamically create the element instead.
|
||||
let iframe = document.createElement("browser");
|
||||
iframe.setAttribute("type", "content-primary");
|
||||
iframe.setAttribute("flex", "1");
|
||||
iframe.setAttribute("autocompleteenabled", false);
|
||||
iframe.setAttribute("disablehistory", true);
|
||||
iframe.setAttribute("id", "contentTabType" + this.lastBrowserId);
|
||||
let clone = document.getElementById("contentTab").firstChild.cloneNode(true);
|
||||
|
||||
clone.setAttribute("id", "contentTab" + this.lastBrowserId);
|
||||
clone.setAttribute("collapsed", false);
|
||||
clone.setAttribute("type", "content-primary");
|
||||
|
||||
aTab.panel.appendChild(clone);
|
||||
|
||||
aTab.browser = aTab.panel.getElementsByTagName("browser")[0];
|
||||
|
||||
aTab.browser.setAttribute("id", "contentTabBrowser" + this.lastBrowserId);
|
||||
|
||||
function onDOMTitleChanged(aEvent) {
|
||||
document.getElementById("tabmail").setTabTitle(aTab);
|
||||
|
@ -116,32 +119,30 @@ var specialTabs = {
|
|||
// Save the function we'll use as listener so we can remove it later.
|
||||
aTab.contentTabType = { titleListener: onDOMTitleChanged };
|
||||
// Add the listener.
|
||||
iframe.addEventListener("DOMTitleChanged",
|
||||
aTab.browser.addEventListener("DOMTitleChanged",
|
||||
aTab.contentTabType.titleListener, true);
|
||||
|
||||
aTab.title = this.loadingTabString;
|
||||
|
||||
aTab.panel.appendChild(iframe);
|
||||
aTab.browser.setAttribute("src", aContentPage);
|
||||
|
||||
iframe.setAttribute("src", aContentPage);
|
||||
|
||||
let findbar = document.createElement("findbar");
|
||||
findbar.setAttribute("browserid", "contentTabType" + this.lastBrowserId);
|
||||
aTab.panel.appendChild(findbar);
|
||||
aTab.findbar = aTab.panel.getElementsByTagName("findbar")[0];
|
||||
aTab.findbar.setAttribute("browserid",
|
||||
"contentTabBrowser" + this.lastBrowserId);
|
||||
this.lastBrowserId++;
|
||||
},
|
||||
closeTab: function onTabClosed(aTab) {
|
||||
aTab.panel.firstChild.removeEventListener("DOMTitleChanged",
|
||||
aTab.browser.removeEventListener("DOMTitleChanged",
|
||||
aTab.contentTabType.titleListener, true);
|
||||
},
|
||||
saveTabState: function onSaveTabState(aTab) {
|
||||
aTab.panel.firstChild.setAttribute("type", "content-targetable");
|
||||
aTab.browser.setAttribute("type", "content-targetable");
|
||||
},
|
||||
showTab: function onShowTab(aTab) {
|
||||
aTab.panel.firstChild.setAttribute("type", "content-primary");
|
||||
aTab.browser.setAttribute("type", "content-primary");
|
||||
},
|
||||
onTitleChanged: function onTitleChanged(aTab) {
|
||||
aTab.title = aTab.panel.firstChild.contentDocument.title;
|
||||
aTab.title = aTab.browser.contentDocument.title;
|
||||
},
|
||||
supportsCommand: function supportsCommand(aTab, aCommand) {
|
||||
switch (aCommand) {
|
||||
|
@ -217,7 +218,7 @@ var specialTabs = {
|
|||
}
|
||||
},
|
||||
getBrowser: function getBrowser(aTab) {
|
||||
return aTab.panel.firstChild;
|
||||
return aTab.browser;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Thunderbird Special Tabs.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Mozilla Messaging.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2009
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Mark Banner <bugzilla@standard8.plus.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<overlay id="specialTabs"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<vbox id="contentTab" collapsed="true">
|
||||
<vbox flex="1">
|
||||
<browser type="content-targetable" flex="1" disablehistory="true"/>
|
||||
<findbar/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</overlay>
|
||||
|
|
@ -42,6 +42,7 @@ messenger.jar:
|
|||
* content/messenger/FilterListDialog.xul (content/FilterListDialog.xul)
|
||||
* content/messenger/FilterListDialog.js (content/FilterListDialog.js)
|
||||
content/messenger/specialTabs.js (content/specialTabs.js)
|
||||
content/messenger/specialTabs.xul (content/specialTabs.xul)
|
||||
* content/messenger/subscribe.xul (content/subscribe.xul)
|
||||
content/messenger/subscribe.js (content/subscribe.js)
|
||||
* content/messenger/aboutDialog.xul (content/aboutDialog.xul)
|
||||
|
|
Загрузка…
Ссылка в новой задаче