Delay extracting text until first find event.

This commit is contained in:
Brendan Dahl 2012-10-10 13:58:14 -07:00
parent 1c80c610db
commit c3debc6ee0
3 changed files with 13 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -295,6 +295,12 @@ html[dir='rtl'] .findbar {
-moz-user-select:none; -moz-user-select:none;
} }
#findInput[status="pending"] {
background-image: url(images/loading-small.png);
background-repeat: no-repeat;
background-position: right;
}
.doorHanger { .doorHanger {
border: 1px solid hsla(0,0%,0%,.5); border: 1px solid hsla(0,0%,0%,.5);
border-radius: 2px; border-radius: 2px;

View File

@ -498,6 +498,7 @@ var PDFFindBar = {
this.highlightAll = document.getElementById('findHighlightAll'); this.highlightAll = document.getElementById('findHighlightAll');
this.caseSensitive = document.getElementById('findMatchCase'); this.caseSensitive = document.getElementById('findMatchCase');
this.findMsg = document.getElementById('findMsg'); this.findMsg = document.getElementById('findMsg');
this.findStatusIcon = document.getElementById('findStatusIcon');
var self = this; var self = this;
this.toggleButton.addEventListener('click', function() { this.toggleButton.addEventListener('click', function() {
@ -552,12 +553,16 @@ var PDFFindBar = {
updateUIState: function(state, previous) { updateUIState: function(state, previous) {
var notFound = false; var notFound = false;
var findMsg = ''; var findMsg = '';
var status = 'pending'; var status = '';
switch (state) { switch (state) {
case FindStates.FIND_FOUND: case FindStates.FIND_FOUND:
break; break;
case FindStates.FIND_PENDING:
status = 'pending';
break;
case FindStates.FIND_NOTFOUND: case FindStates.FIND_NOTFOUND:
findMsg = mozL10n.get('find_not_found', null, 'Phrase not found'); findMsg = mozL10n.get('find_not_found', null, 'Phrase not found');
notFound = true; notFound = true;
@ -580,6 +585,7 @@ var PDFFindBar = {
this.findField.classList.remove('notFound'); this.findField.classList.remove('notFound');
} }
this.findField.setAttribute('status', status);
this.findMsg.textContent = findMsg; this.findMsg.textContent = findMsg;
}, },
@ -1151,9 +1157,6 @@ var PDFView = {
thumbnails.push(thumbnailView); thumbnails.push(thumbnailView);
var pageRef = page.ref; var pageRef = page.ref;
pagesRefMap[pageRef.num + ' ' + pageRef.gen + ' R'] = i; pagesRefMap[pageRef.num + ' ' + pageRef.gen + ' R'] = i;
// Trigger text extraction. TODO: Make this happen lasyliy if needed.
PDFFindController.extractText();
} }
self.pagesRefMap = pagesRefMap; self.pagesRefMap = pagesRefMap;