[Pkg-javascript-commits] [pdf.js] 104/157: Simplify annotation data passing

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 06:46:44 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 995c5ba20509876b90edb76666fe4c75a0b7d0c7
Author: Tim van der Meij <timvandermeij at gmail.com>
Date:   Sat Jul 18 17:52:03 2015 +0200

    Simplify annotation data passing
---
 src/core/annotation.js | 4 ----
 src/core/core.js       | 9 ++-------
 src/display/api.js     | 9 +++------
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/src/core/annotation.js b/src/core/annotation.js
index 3fb6f95..a88acaf 100644
--- a/src/core/annotation.js
+++ b/src/core/annotation.js
@@ -175,10 +175,6 @@ var Annotation = (function AnnotationClosure() {
       }
     },
 
-    getData: function Annotation_getData() {
-      return this.data;
-    },
-
     isInvisible: function Annotation_isInvisible() {
       var data = this.data;
       if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) {
diff --git a/src/core/core.js b/src/core/core.js
index e6ad212..83ab42d 100644
--- a/src/core/core.js
+++ b/src/core/core.js
@@ -111,11 +111,6 @@ var Page = (function PageClosure() {
       return shadow(this, 'view', cropBox);
     },
 
-    get annotationRefs() {
-      return shadow(this, 'annotationRefs',
-                    this.getInheritedPageProp('Annots'));
-    },
-
     get rotate() {
       var rotate = this.getInheritedPageProp('Rotate') || 0;
       // Normalize rotation so it's a multiple of 90 and between 0 and 270
@@ -261,14 +256,14 @@ var Page = (function PageClosure() {
       var annotations = this.annotations;
       var annotationsData = [];
       for (var i = 0, n = annotations.length; i < n; ++i) {
-        annotationsData.push(annotations[i].getData());
+        annotationsData.push(annotations[i].data);
       }
       return annotationsData;
     },
 
     get annotations() {
       var annotations = [];
-      var annotationRefs = (this.annotationRefs || []);
+      var annotationRefs = this.getInheritedPageProp('Annots') || [];
       for (var i = 0, n = annotationRefs.length; i < n; ++i) {
         var annotationRef = annotationRefs[i];
         var annotation = Annotation.fromRef(this.xref, annotationRef);
diff --git a/src/display/api.js b/src/display/api.js
index 7919cb4..5ea6026 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -688,13 +688,10 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
      * annotation objects.
      */
     getAnnotations: function PDFPageProxy_getAnnotations() {
-      if (this.annotationsPromise) {
-        return this.annotationsPromise;
+      if (!this.annotationsPromise) {
+        this.annotationsPromise = this.transport.getAnnotations(this.pageIndex);
       }
-
-      var promise = this.transport.getAnnotations(this.pageIndex);
-      this.annotationsPromise = promise;
-      return promise;
+      return this.annotationsPromise;
     },
     /**
      * Begins the process of rendering a page to the desired context.

-- 
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