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

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

Issue 4964592316841984: Issue 2041 - Filter Preferences: Findbar not fully functional in Firefox 36 (Closed)
Patch Set: Created Feb. 25, 2015, 5:08 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 | metadata.gecko » ('j') | 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
@@ -21,18 +21,30 @@
*/
var FilterSearch =
{
/**
* Initializes findbar widget.
*/
init: function()
{
+ let filters = E("filtersTree");
+ for (let prop in FilterSearch.fakeBrowser)
+ filters[prop] = FilterSearch.fakeBrowser[prop];
+ Object.defineProperty(filters, "_lastSearchString", {
+ get: function()
+ {
+ return this.finder.searchString;
+ },
+ enumerable: true,
+ configurable: true
+ });
+
let findbar = E("findbar");
- findbar.browser = FilterSearch.fakeBrowser;
+ findbar.browser = filters;
findbar.addEventListener("keypress", function(event)
{
// Work-around for bug 490047
if (event.keyCode == KeyEvent.DOM_VK_RETURN)
event.preventDefault();
}, false);
@@ -198,90 +210,30 @@ FilterSearch.fakeBrowser =
requestMatchesCount: function(searchString, matchLimit, linksOnly) {},
highlight: function(highlight, word) {},
enableSelection: function() {},
removeSelection: function() {},
focusContent: function() {},
keyPress: function() {}
},
- get _lastSearchString()
- {
- return this.finder.searchString;
- },
-
- // This was used before Firefox 27 instead of the "finder" property.
Thomas Greiner 2015/02/27 15:57:46 According to metadata.gecko, this version is still
Wladimir Palant 2015/02/27 16:20:53 Please see review description ;)
- fastFind:
- {
- get searchString()
- {
- return FilterSearch.fakeBrowser.finder.searchString;
- },
-
- set searchString(searchString)
- {
- FilterSearch.fakeBrowser.finder.searchString = searchString;
- },
-
- foundLink: null,
- foundEditable: null,
-
- get caseSensitive()
- {
- return FilterSearch.fakeBrowser.finder.caseSensitive;
- },
-
- set caseSensitive(caseSensitive)
- {
- FilterSearch.fakeBrowser.finder.caseSensitive = caseSensitive;
- },
-
- get currentWindow() FilterSearch.fakeBrowser.contentWindow,
-
- find: function(searchString, linksOnly)
- {
- FilterSearch.fakeBrowser.finder.fastFind(searchString, linksOnly);
- return FilterSearch.fakeBrowser.finder.lastResult;
- },
-
- findAgain: function(findBackwards, linksOnly)
- {
- FilterSearch.fakeBrowser.finder.findAgain(findBackwards, linksOnly);
- return FilterSearch.fakeBrowser.finder.lastResult;
- },
-
- // Irrelevant for us
- init: function() {},
- setDocShell: function() {},
- setSelectionModeAndRepaint: function() {},
- collapseSelection: function() {}
- },
currentURI: Utils.makeURI("http://example.com/"),
contentWindow:
{
focus: function()
{
E("filtersTree").focus();
},
scrollByLines: function(num)
{
E("filtersTree").boxObject.scrollByLines(num);
},
scrollByPages: function(num)
{
E("filtersTree").boxObject.scrollByPages(num);
},
- },
-
- addEventListener: function(event, handler, capture)
- {
- E("filtersTree").addEventListener(event, handler, capture);
- },
- removeEventListener: function(event, handler, capture)
- {
- E("filtersTree").addEventListener(event, handler, capture);
- },
+ }
};
window.addEventListener("load", function()
{
FilterSearch.init();
}, false);
« no previous file with comments | « no previous file | metadata.gecko » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld