mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #6187 from Snuffleupagus/more-efficient-getDestination
A couple of improvements of `getDestination` (unit-test included)
This commit is contained in:
commit
1416a1b521
2 changed files with 12 additions and 12 deletions
|
@ -485,7 +485,7 @@ var Catalog = (function CatalogClosure() {
|
|||
}
|
||||
|
||||
var xref = this.xref;
|
||||
var dest, nameTreeRef, nameDictionaryRef;
|
||||
var dest = null, nameTreeRef, nameDictionaryRef;
|
||||
var obj = this.catDict.get('Names');
|
||||
if (obj && obj.has('Dests')) {
|
||||
nameTreeRef = obj.getRaw('Dests');
|
||||
|
@ -493,17 +493,11 @@ var Catalog = (function CatalogClosure() {
|
|||
nameDictionaryRef = this.catDict.get('Dests');
|
||||
}
|
||||
|
||||
if (nameDictionaryRef) {
|
||||
// reading simple destination dictionary
|
||||
obj = nameDictionaryRef;
|
||||
obj.forEach(function catalogForEach(key, value) {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
if (key === destinationId) {
|
||||
dest = fetchDestination(value);
|
||||
}
|
||||
});
|
||||
if (nameDictionaryRef) { // Simple destination dictionary.
|
||||
var value = nameDictionaryRef.get(destinationId);
|
||||
if (value) {
|
||||
dest = fetchDestination(value);
|
||||
}
|
||||
}
|
||||
if (nameTreeRef) {
|
||||
var nameTree = new NameTree(nameTreeRef, xref);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue