1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Annotations: move container border removal to the display layer

The display layer is responsible for creating the HTML elements for the
annotations from the core layer. If we need to ignore border styling for
the containers of certain elements, the display layer should do so and
not the core layer. I noticed this during the implementation of line
annotations, for which we actually need the original border width in the
display layer, even though we ignore it for the container. If we set the
border style to zero in the core layer, this becomes impossible.

To prevent this, this patch moves the container border removal code from
the core layer to the display layer. This makes the core layer output
the unchanged annotation data and lets the display layer remove any
border styling if necessary.
This commit is contained in:
Tim van der Meij 2017-04-02 20:31:21 +02:00
parent 57d9a64c14
commit 30d63b0c50
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
2 changed files with 14 additions and 24 deletions

View file

@ -989,9 +989,6 @@ var HighlightAnnotation = (function HighlightAnnotationClosure() {
this.data.annotationType = AnnotationType.HIGHLIGHT;
this._preparePopup(parameters.dict);
// PDF viewers completely ignore any border styles.
this.data.borderStyle.setWidth(0);
}
Util.inherit(HighlightAnnotation, Annotation, {});
@ -1005,9 +1002,6 @@ var UnderlineAnnotation = (function UnderlineAnnotationClosure() {
this.data.annotationType = AnnotationType.UNDERLINE;
this._preparePopup(parameters.dict);
// PDF viewers completely ignore any border styles.
this.data.borderStyle.setWidth(0);
}
Util.inherit(UnderlineAnnotation, Annotation, {});
@ -1021,9 +1015,6 @@ var SquigglyAnnotation = (function SquigglyAnnotationClosure() {
this.data.annotationType = AnnotationType.SQUIGGLY;
this._preparePopup(parameters.dict);
// PDF viewers completely ignore any border styles.
this.data.borderStyle.setWidth(0);
}
Util.inherit(SquigglyAnnotation, Annotation, {});
@ -1037,9 +1028,6 @@ var StrikeOutAnnotation = (function StrikeOutAnnotationClosure() {
this.data.annotationType = AnnotationType.STRIKEOUT;
this._preparePopup(parameters.dict);
// PDF viewers completely ignore any border styles.
this.data.borderStyle.setWidth(0);
}
Util.inherit(StrikeOutAnnotation, Annotation, {});