Bug 916483 - Replace usage of fastFind with finder. r=mleibovic

This commit is contained in:
Taylor Skidmore 2013-11-22 15:01:17 -05:00
Родитель 154ca5a22d
Коммит 2d874bc4b3
1 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -4,7 +4,7 @@
"use strict"; "use strict";
var FindHelper = { var FindHelper = {
_fastFind: null, _finder: null,
_targetTab: null, _targetTab: null,
_initialViewport: null, _initialViewport: null,
_viewportChanged: false, _viewportChanged: false,
@ -31,41 +31,41 @@ var FindHelper = {
}, },
doFind: function(aSearchString) { doFind: function(aSearchString) {
if (!this._fastFind) { if (!this._finder) {
this._targetTab = BrowserApp.selectedTab; this._targetTab = BrowserApp.selectedTab;
this._fastFind = this._targetTab.browser.fastFind; this._finder = this._targetTab.browser.finder;
this._finder.addResultListener(this);
this._initialViewport = JSON.stringify(this._targetTab.getViewport()); this._initialViewport = JSON.stringify(this._targetTab.getViewport());
this._viewportChanged = false; this._viewportChanged = false;
} }
let result = this._fastFind.find(aSearchString, false); this._finder.fastFind(aSearchString, false);
this.handleResult(result);
}, },
findAgain: function(aString, aFindBackwards) { findAgain: function(aString, aFindBackwards) {
// This can happen if the user taps next/previous after re-opening the search bar // This can happen if the user taps next/previous after re-opening the search bar
if (!this._fastFind) { if (!this._finder) {
this.doFind(aString); this.doFind(aString);
return; return;
} }
let result = this._fastFind.findAgain(aFindBackwards, false); this._finder.findAgain(aFindBackwards, false, false);
this.handleResult(result);
}, },
findClosed: function() { findClosed: function() {
// If there's no find in progress, there's nothing to clean up // If there's no find in progress, there's nothing to clean up
if (!this._fastFind) if (!this._finder)
return; return;
this._fastFind.collapseSelection(); this._finder.removeSelection();
this._fastFind = null; this._finder.removeResultListener(this);
this._finder = null;
this._targetTab = null; this._targetTab = null;
this._initialViewport = null; this._initialViewport = null;
this._viewportChanged = false; this._viewportChanged = false;
}, },
handleResult: function(aResult) { onFindResult: function(aResult, aFindBackwards, aLinkURL) {
if (aResult == Ci.nsITypeAheadFind.FIND_NOTFOUND) { if (aResult == Ci.nsITypeAheadFind.FIND_NOTFOUND) {
if (this._viewportChanged) { if (this._viewportChanged) {
if (this._targetTab != BrowserApp.selectedTab) { if (this._targetTab != BrowserApp.selectedTab) {