Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/filters-search.js

Issue 29328828: Issue 3129/3144 - Fixed: Findbar key handling conflicted with filter editing (Closed)
Patch Set: Implemented solution based on content script (also covers #3144) Created Oct. 5, 2015, 4:35 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/filters-search.js
===================================================================
--- a/chrome/content/ui/filters-search.js
+++ b/chrome/content/ui/filters-search.js
@@ -15,6 +15,8 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+let {BrowserUtils} = Cu.import("resource://gre/modules/BrowserUtils.jsm");
+
/**
* Implementation of the filter search functionality.
* @class
@@ -234,6 +236,8 @@
messageManager:
{
+ FAYT_LINKS_KEY: "'".charCodeAt(0),
+ FAYT_TEXT_KEY: "/".charCodeAt(0),
_messageMap: {
"Findbar:Mouseup": "mouseup",
"Findbar:Keypress": "keypress"
@@ -253,7 +257,29 @@
return;
if (!("_ABPHandler" in listener))
- listener._ABPHandler = (event) => listener.receiveMessage(this._messageFromEvent(event));
+ {
+ listener._ABPHandler = (event) => {
+ if (event.type == "keypress")
+ {
+ if (event.ctrlKey || event.altKey || event.metaKey
+ || event.defaultPrevented)
+ return;
+
+ let findbar = E("findbar");
+ if (findbar.findMode == findbar.FIND_NORMAL
+ && !findbar.findAsYouType
+ && event.charCode != this.FAYT_LINKS_KEY
+ && event.charCode != this.FAYT_TEXT_KEY)
+ return;
+
+ let target = Services.focus.getFocusedElementForWindow(window, true, {});
+ if (!BrowserUtils.shouldFastFind(target, window))
+ return;
+ }
+
+ listener.receiveMessage(this._messageFromEvent(event));
+ };
+ }
E("filtersTree").addEventListener(this._messageMap[message], listener._ABPHandler, false);
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld