summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-15 18:20:24 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-15 18:20:24 +0200
commit0b2ad9c9dd2282dc9fe2ec5c7e8ffd05fccca617 (patch)
treef6ad5ddb064e63c3ab8e16e471b63c50966f6bb5 /application/palemoon/base/content
parentf54f002abc95acf23cfaa93579e60b58148128d1 (diff)
parent333142b5af61c3fd67ad4e79467c03efb3641b20 (diff)
downloadUXP-0b2ad9c9dd2282dc9fe2ec5c7e8ffd05fccca617.tar
UXP-0b2ad9c9dd2282dc9fe2ec5c7e8ffd05fccca617.tar.gz
UXP-0b2ad9c9dd2282dc9fe2ec5c7e8ffd05fccca617.tar.lz
UXP-0b2ad9c9dd2282dc9fe2ec5c7e8ffd05fccca617.tar.xz
UXP-0b2ad9c9dd2282dc9fe2ec5c7e8ffd05fccca617.zip
Merge branch 'findbar-pertab'
Diffstat (limited to 'application/palemoon/base/content')
-rw-r--r--application/palemoon/base/content/browser.js21
-rw-r--r--application/palemoon/base/content/tabbrowser.xml52
2 files changed, 59 insertions, 14 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index ba791f709..6df6488b1 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -53,20 +53,13 @@ var gEditUIVisible = true;
// Smart getter for the findbar. If you don't wish to force the creation of
// the findbar, check gFindBarInitialized first.
-var gFindBarInitialized = false;
-XPCOMUtils.defineLazyGetter(window, "gFindBar", function() {
- let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- let findbar = document.createElementNS(XULNS, "findbar");
- findbar.id = "FindToolbar";
-
- let browserBottomBox = document.getElementById("browser-bottombox");
- browserBottomBox.insertBefore(findbar, browserBottomBox.firstChild);
-
- // Force a style flush to ensure that our binding is attached.
- findbar.clientTop;
- findbar.browser = gBrowser.mCurrentBrowser;
- window.gFindBarInitialized = true;
- return findbar;
+
+this.__defineGetter__("gFindBar", function() {
+ return window.gBrowser.getFindBar();
+});
+
+this.__defineGetter__("gFindBarInitialized", function() {
+ return window.gBrowser.isFindBarInitialized();
});
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index c054318ec..74bd04467 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -128,6 +128,10 @@
false
</field>
+ <field name="_lastFindValue">
+ ""
+ </field>
+
<property name="_numPinnedTabs" readonly="true">
<getter><![CDATA[
for (var i = 0; i < this.tabs.length; i++) {
@@ -154,6 +158,43 @@
]]></getter>
</property>
+ <method name="isFindBarInitialized">
+ <parameter name="aTab"/>
+ <body><![CDATA[
+ return (aTab || this.selectedTab)._findBar != undefined;
+ ]]></body>
+ </method>
+
+ <method name="getFindBar">
+ <parameter name="aTab"/>
+ <body><![CDATA[
+ if (!aTab)
+ aTab = this.selectedTab;
+
+ if (aTab._findBar)
+ return aTab._findBar;
+
+ let findBar = document.createElementNS(this.namespaceURI, "findbar");
+ let browser = this.getBrowserForTab(aTab);
+ let browserContainer = this.getBrowserContainer(browser);
+ browserContainer.appendChild(findBar);
+
+ // Force a style flush to ensure that our binding is attached.
+ findBar.clientTop;
+
+ findBar.browser = browser;
+ findBar._findField.value = this._lastFindValue;
+
+ aTab._findBar = findBar;
+
+ let event = document.createEvent("Events");
+ event.initEvent("TabFindInitialized", true, false);
+ aTab.dispatchEvent(event);
+
+ return findBar;
+ ]]></body>
+ </method>
+
<method name="updateWindowResizers">
<body><![CDATA[
if (!window.gShowPageResizers)
@@ -2236,6 +2277,17 @@
this._swapBrowserDocShells(aOurTab, otherBrowser);
}
+ // Handle findbar data (if any)
+ let otherFindBar = aOtherTab._findBar;
+ if (otherFindBar &&
+ otherFindBar.findMode == otherFindBar.FIND_NORMAL) {
+ let ourFindBar = this.getFindBar(aOurTab);
+ ourFindBar._findField.value = otherFindBar._findField.value;
+ if (!otherFindBar.hidden) {
+ ourFindBar.onFindCommand();
+ }
+ }
+
// Finish tearing down the tab that's going away.
remoteBrowser._endRemoveTab(aOtherTab);