diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-09-11 20:10:59 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-09-11 20:10:59 +0200 |
commit | 4e834fe0178258cfd4941b30679071553acf4261 (patch) | |
tree | 01d0568e6c429e3686dd8ec2e33d780b4e1e03eb | |
parent | eaf6d11e60fee4d1743ef02523a18cee7a2f6457 (diff) | |
parent | 3498f263a8096b2aa0c1cb5142b6f04d1d680120 (diff) | |
download | uxp-4e834fe0178258cfd4941b30679071553acf4261.tar.gz |
Merge branch 'fbgw'
-rw-r--r-- | application/palemoon/base/content/browser.js | 21 | ||||
-rw-r--r-- | application/palemoon/base/content/tabbrowser.xml | 127 | ||||
-rw-r--r-- | application/palemoon/themes/linux/browser.css | 6 | ||||
-rw-r--r-- | application/palemoon/themes/osx/browser.css | 6 | ||||
-rw-r--r-- | application/palemoon/themes/windows/browser.css | 6 | ||||
-rw-r--r-- | modules/libpref/init/all.js | 1 | ||||
-rw-r--r-- | toolkit/content/browser-content.js | 29 | ||||
-rw-r--r-- | toolkit/content/jar.mn | 2 | ||||
-rw-r--r-- | toolkit/content/widgets/findbar.xml | 5 |
9 files changed, 77 insertions, 126 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index c7a2633d42..5cf43850ae 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -53,13 +53,20 @@ var gEditUIVisible = true; // Smart getter for the findbar. If you don't wish to force the creation of // the findbar, check gFindBarInitialized first. - -this.__defineGetter__("gFindBar", function() { - return window.gBrowser.getFindBar(); -}); - -this.__defineGetter__("gFindBarInitialized", function() { - return window.gBrowser.isFindBarInitialized(); +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; }); XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index d5735149e1..3de1c6be2d 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -128,10 +128,6 @@ false </field> - <field name="_lastFindValue"> - "" - </field> - <property name="_numPinnedTabs" readonly="true"> <getter><![CDATA[ for (var i = 0; i < this.tabs.length; i++) { @@ -158,43 +154,6 @@ ]]></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) @@ -1082,6 +1041,11 @@ // Bug 666809 - SecurityUI support for e10s var webProgress = this.mCurrentBrowser.webProgress; var securityUI = this.mCurrentBrowser.securityUI; + + // Update global findbar with new content browser + if (gFindBarInitialized) { + gFindBar.browser = newBrowser; + } this._callProgressListeners(null, "onLocationChange", [webProgress, null, loc, 0], true, @@ -1104,11 +1068,9 @@ this.mCurrentTab.removeAttribute("unread"); this.selectedTab.lastAccessed = Date.now(); - let oldFindBar = oldTab._findBar; - if (oldFindBar && - oldFindBar.findMode == oldFindBar.FIND_NORMAL && - !oldFindBar.hidden) - this._lastFindValue = oldFindBar._findField.value; + // Bug 666816 - TypeAheadFind support for e10s + if (!gMultiProcessBrowser) + this._fastFind.setDocShell(this.mCurrentBrowser.docShell); this.updateTitlebar(); @@ -1159,11 +1121,6 @@ // Adjust focus oldBrowser._urlbarFocused = (gURLBar && gURLBar.focused); - if (this.isFindBarInitialized(oldTab)) { - let findBar = this.getFindBar(oldTab); - oldTab._findBarFocused = (!findBar.hidden && - findBar._findField.getAttribute("focused") == "true"); - } do { // When focus is in the tab bar, retain it there. if (document.activeElement == oldTab) { @@ -1199,12 +1156,11 @@ } } - // Focus the find bar if it was previously focused for that tab. - if (gFindBarInitialized && !gFindBar.hidden && - this.selectedTab._findBarFocused) { - gFindBar._findField.focus(); + // If the find bar is focused, keep it focused. + if (gFindBarInitialized && + !gFindBar.hidden && + gFindBar.getElement("findbar-textbox").getAttribute("focused") == "true") break; - } // Otherwise, focus the content area. let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager); @@ -1622,6 +1578,7 @@ this.mTabListeners[position] = tabListener; this.mTabFilters[position] = filter; + b._fastFind = this.fastFind; b.droppedLinkHandler = handleDroppedLink; // If we just created a new tab that loads the default @@ -2310,17 +2267,6 @@ 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); @@ -2873,6 +2819,21 @@ onget="return this.mCurrentBrowser.currentURI;" readonly="true"/> + <field name="_fastFind">null</field> + <property name="fastFind" + readonly="true"> + <getter> + <![CDATA[ + if (!this._fastFind) { + this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"] + .createInstance(Components.interfaces.nsITypeAheadFind); + this._fastFind.init(this.docShell); + } + return this._fastFind; + ]]> + </getter> + </property> + <field name="_lastSearchString">null</field> <field name="_lastSearchHighlight">false</field> @@ -3176,28 +3137,6 @@ window.focus(); break; } - case "Findbar:Keypress": - let tab = this.getTabForBrowser(browser); - // If the find bar for this tab is not yet alive, only initialize - // it if there's a possibility FindAsYouType will be used. - // There's no point in doing it for most random keypresses. - if (!this.isFindBarInitialized(tab) && - aMessage.data.shouldFastFind) { - let shouldFastFind = this._findAsYouType; - if (!shouldFastFind) { - // Please keep in sync with toolkit/content/widgets/findbar.xml - const FAYT_LINKS_KEY = "'"; - const FAYT_TEXT_KEY = "/"; - let charCode = aMessage.data.fakeEvent.charCode; - let key = charCode ? String.fromCharCode(charCode) : null; - shouldFastFind = key == FAYT_LINKS_KEY || key == FAYT_TEXT_KEY; - } - if (shouldFastFind) { - // Make sure we return the result. - return this.getFindBar(tab).receiveMessage(aMessage); - } - } - break; } ]]></body> </method> @@ -3264,11 +3203,6 @@ this.mCurrentBrowser); } messageManager.addMessageListener("DOMWebNotificationClicked", this); - - // To correctly handle keypresses for potential FindAsYouType, while - // the tab's find bar is not yet initialized. - this._findAsYouType = Services.prefs.getBoolPref("accessibility.typeaheadfind"); - messageManager.addMessageListener("Findbar:Keypress", this); ]]> </constructor> @@ -3523,7 +3457,6 @@ tab.setAttribute("onerror", "this.removeAttribute('image');"); this.adjustTabstrip(); - Services.prefs.addObserver("accessibility.typeaheadfind", this._prefObserver, false); Services.prefs.addObserver("browser.tabs.", this._prefObserver, false); window.addEventListener("resize", this, false); window.addEventListener("load", this, false); @@ -3539,7 +3472,6 @@ <destructor> <![CDATA[ - Services.prefs.removeObserver("accessibility.typeaheadfind", this._prefObserver); Services.prefs.removeObserver("browser.tabs.", this._prefObserver); ]]> </destructor> @@ -3605,9 +3537,6 @@ observe: function (subject, topic, data) { switch (data) { - case "accessibility.typeaheadfind": - this._findAsYouType = Services.prefs.getBoolPref(data); - break; case "browser.tabs.closeButtons": this.tabContainer.mCloseButtons = Services.prefs.getIntPref(data); this.tabContainer.adjustTabstrip(); diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index 987406264b..c6587babcc 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1570,12 +1570,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- background-color: Window; } -.browserContainer > findbar { - background-color: -moz-dialog; - color: -moz-DialogText; - text-shadow: none; -} - /* Throbber */ #navigator-throbber { width: 16px; diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index 97073b1611..a915af3a3c 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1601,12 +1601,6 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- -moz-padding-start: 0px; } -.browserContainer > findbar { - background-color: -moz-dialog; - color: -moz-DialogText; - text-shadow: none; -} - /* ::::: throbber ::::: */ #navigator-throbber { diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 1aefa428c4..45f0e066c2 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -1788,12 +1788,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- -moz-padding-start: 0px; } -.browserContainer > findbar { - background-color: -moz-dialog; - color: -moz-DialogText; - text-shadow: none; -} - /* ::::: throbber ::::: */ #navigator-throbber { diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 1eee30210d..0ec5f15961 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -908,6 +908,7 @@ pref("findbar.highlightAll", false); pref("findbar.modalHighlight", false); pref("findbar.entireword", false); pref("findbar.iteratorTimeout", 100); +pref("findbar.termPerTab", false); // use Mac OS X Appearance panel text smoothing setting when rendering text, disabled by default pref("gfx.use_text_smoothing_setting", false); diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js index 2276f8a0d1..e1114672c1 100644 --- a/toolkit/content/browser-content.js +++ b/toolkit/content/browser-content.js @@ -841,6 +841,35 @@ var FindBar = { fakeEvent[k] = event[k]; } } +#ifdef MC_PALEMOON + let findBarId = "FindToolbar"; + // The FindBar is in the chrome window's context, not in tabbrowser + // - see also bug 537013 + let chromeWin = null; + try { + chromeWin = content + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem) + .rootTreeItem + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindow) + .QueryInterface(Ci.nsIDOMChromeWindow); + } catch (e) { + Cu.reportError( + "The FindBar - the chrome window's context was not detected:\n" + e); + } + if (chromeWin && chromeWin.document.getElementById(findBarId)) { + try { + chromeWin.document.getElementById(findBarId) + .browser = Services.wm.getMostRecentWindow("navigator:browser") + .gBrowser.mCurrentBrowser; + } catch (e) { + Cu.reportError( + "The FindBar - cannot set the property 'browser':\n" + e); + } + } +#endif // sendSyncMessage returns an array of the responses from all listeners let rv = sendSyncMessage("Findbar:Keypress", { diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index e1d432cb34..c11d3abed4 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -39,7 +39,7 @@ toolkit.jar: content/global/plugins.html content/global/plugins.css content/global/browser-child.js - content/global/browser-content.js +* content/global/browser-content.js * content/global/buildconfig.html content/global/contentAreaUtils.js #ifndef MOZ_FENNEC diff --git a/toolkit/content/widgets/findbar.xml b/toolkit/content/widgets/findbar.xml index b92fb1d051..c312a6a25a 100644 --- a/toolkit/content/widgets/findbar.xml +++ b/toolkit/content/widgets/findbar.xml @@ -282,6 +282,7 @@ return this._browser; ]]></getter> <setter><![CDATA[ + let prefsvc = this._prefsvc; if (this._browser) { if (this._browser.messageManager) { this._browser.messageManager.removeMessageListener("Findbar:Keypress", this); @@ -300,7 +301,9 @@ this._browser.messageManager.addMessageListener("Findbar:Mouseup", this); this._browser.finder.addResultListener(this); - this._findField.value = this._browser._lastSearchString; + if (prefsvc.getBoolPref("findbar.termPerTab") == true) { + this._findField.value = this._browser._lastSearchString; + } } return val; ]]></setter> |