[Pkg-javascript-commits] [pdf.js] 144/207: Refactoring PDFFindController in the text layer builder
David Prévot
taffit at moszumanska.debian.org
Mon Jul 28 15:36:41 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit fa33b9c6430a6b3f23b1ec3c9e917ea8ef3397fa
Author: Tim van der Meij <timvandermeij at gmail.com>
Date: Mon Jun 23 22:19:18 2014 +0200
Refactoring PDFFindController in the text layer builder
---
web/text_layer_builder.js | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js
index 598d9a3..f2a53e5 100644
--- a/web/text_layer_builder.js
+++ b/web/text_layer_builder.js
@@ -39,10 +39,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.viewport = options.viewport;
this.isViewerInPresentationMode = options.isViewerInPresentationMode;
this.textDivs = [];
-
- if (typeof PDFFindController === 'undefined') {
- window.PDFFindController = null;
- }
+ this.findController = window.PDFFindController || null;
}
TextLayerBuilder.prototype = {
@@ -152,8 +149,8 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
var iIndex = 0;
var bidiTexts = this.textContent.items;
var end = bidiTexts.length - 1;
- var queryLen = (PDFFindController === null ?
- 0 : PDFFindController.state.query.length);
+ var queryLen = (this.findController === null ?
+ 0 : this.findController.state.query.length);
var ret = [];
for (var m = 0, len = matches.length; m < len; m++) {
@@ -206,12 +203,12 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
var bidiTexts = this.textContent.items;
var textDivs = this.textDivs;
var prevEnd = null;
- var isSelectedPage = (PDFFindController === null ?
- false : (this.pageIdx === PDFFindController.selected.pageIdx));
- var selectedMatchIdx = (PDFFindController === null ?
- -1 : PDFFindController.selected.matchIdx);
- var highlightAll = (PDFFindController === null ?
- false : PDFFindController.state.highlightAll);
+ var isSelectedPage = (this.findController === null ?
+ false : (this.pageIdx === this.findController.selected.pageIdx));
+ var selectedMatchIdx = (this.findController === null ?
+ -1 : this.findController.selected.matchIdx);
+ var highlightAll = (this.findController === null ?
+ false : this.findController.state.highlightAll);
var infinity = {
divIdx: -1,
offset: undefined
@@ -314,14 +311,14 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
clearedUntilDivIdx = match.end.divIdx + 1;
}
- if (PDFFindController === null || !PDFFindController.active) {
+ if (this.findController === null || !this.findController.active) {
return;
}
// Convert the matches on the page controller into the match format
// used for the textLayer.
- this.matches = this.convertMatches(PDFFindController === null ?
- [] : (PDFFindController.pageMatches[this.pageIdx] || []));
+ this.matches = this.convertMatches(this.findController === null ?
+ [] : (this.findController.pageMatches[this.pageIdx] || []));
this.renderMatches(this.matches);
}
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list