Reduce the number of redundant updatetextlayermatches
events dispatched when calculating matches in PDFFindController
Currently `PDFFindController._calculateMatch` is (indirectly) dispatching an `updatetextlayermatches` event for every *single* page of the document. For short documents, such as the `tracemonkey` file, this probably doesn't matter too much, but for documents with a couple of thousand pages it seems unfortunate. It shouldn't be necessary, in general, to dispatch `updatetextlayermatches` events here, since that's already being taken care of in `PDFFindController._updateMatch` which is always called when a match has been found. However, when `highlightAll` is set we still need to ensure that pages which finished rendered *before* searching begun are updated correctly.
This commit is contained in:
parent
42b7bb4751
commit
014b7a3147
@ -345,7 +345,11 @@ class PDFFindController {
|
||||
this._calculateWordMatch(query, pageIndex, pageContent, entireWord);
|
||||
}
|
||||
|
||||
this._updatePage(pageIndex);
|
||||
// When `highlightAll` is set, ensure that the matches on previously
|
||||
// rendered (and still active) pages are correctly highlighted.
|
||||
if (this._state.highlightAll) {
|
||||
this._updatePage(pageIndex);
|
||||
}
|
||||
if (this._resumePageIdx === pageIndex) {
|
||||
this._resumePageIdx = null;
|
||||
this._nextPageMatch();
|
||||
|
Loading…
x
Reference in New Issue
Block a user