Remove InteractiveAnnotation abstraction

This became obsolete in bdeca30fbf. All it does is call the Annotation contructor and add hasHtml. This patch lets the Link and Text annotations directly extend the Annotation class and add hasHtml themselves.

This patch also removes an unused global.
This commit is contained in:
Tim van der Meij 2015-07-06 11:58:26 +02:00
parent 56e3a66c16
commit 5aa1d9fdfd

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
/* globals PDFJS, Util, isDict, isName, stringToPDFString, warn, Dict, Stream,
stringToBytes, assert, Promise, isArray, ObjectLoader, OperatorList,
stringToBytes, Promise, isArray, ObjectLoader, OperatorList,
isValidUrl, OPS, createPromiseCapability, AnnotationType,
stringToUTF8String, AnnotationBorderStyleType */
@ -570,21 +570,9 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
return TextWidgetAnnotation;
})();
var InteractiveAnnotation = (function InteractiveAnnotationClosure() {
function InteractiveAnnotation(params) {
Annotation.call(this, params);
this.data.hasHtml = true;
}
Util.inherit(InteractiveAnnotation, Annotation, { });
return InteractiveAnnotation;
})();
var TextAnnotation = (function TextAnnotationClosure() {
function TextAnnotation(params) {
InteractiveAnnotation.call(this, params);
Annotation.call(this, params);
var dict = params.dict;
var data = this.data;
@ -594,6 +582,7 @@ var TextAnnotation = (function TextAnnotationClosure() {
data.annotationType = AnnotationType.TEXT;
data.content = stringToPDFString(content || '');
data.title = stringToPDFString(title || '');
data.hasHtml = true;
if (data.hasAppearance) {
data.name = 'NoIcon';
@ -608,18 +597,19 @@ var TextAnnotation = (function TextAnnotationClosure() {
}
}
Util.inherit(TextAnnotation, InteractiveAnnotation, { });
Util.inherit(TextAnnotation, Annotation, { });
return TextAnnotation;
})();
var LinkAnnotation = (function LinkAnnotationClosure() {
function LinkAnnotation(params) {
InteractiveAnnotation.call(this, params);
Annotation.call(this, params);
var dict = params.dict;
var data = this.data;
data.annotationType = AnnotationType.LINK;
data.hasHtml = true;
var action = dict.get('A');
if (action && isDict(action)) {
@ -683,7 +673,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
return url;
}
Util.inherit(LinkAnnotation, InteractiveAnnotation, { });
Util.inherit(LinkAnnotation, Annotation, { });
return LinkAnnotation;
})();