From 830070ca419c86aac7917ee54a546ef4cc9d71c2 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Tue, 1 Dec 2020 16:04:43 +0100 Subject: [PATCH] Split underline, strikeout, squiggly annotions div into multiple divs * Follow up of #12505 * Fix bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1679696 --- src/display/annotation_layer.js | 36 +++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 26271cbe6..0f74d199c 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1462,6 +1462,7 @@ class UnderlineAnnotationElement extends AnnotationElement { parameters.data.contents ); super(parameters, isRenderable, /* ignoreBorder = */ true); + this.quadrilaterals = this._createQuadrilaterals(/* ignoreBorder = */ true); } /** @@ -1472,11 +1473,18 @@ class UnderlineAnnotationElement extends AnnotationElement { * @returns {HTMLSectionElement} */ render() { - this.container.className = "underlineAnnotation"; - if (!this.data.hasPopup) { this._createPopup(null, this.data); } + + if (this.quadrilaterals) { + this.quadrilaterals.forEach(quadrilateral => { + quadrilateral.className = "underlineAnnotation"; + }); + return this.quadrilaterals; + } + + this.container.className = "underlineAnnotation"; return this.container; } } @@ -1489,6 +1497,7 @@ class SquigglyAnnotationElement extends AnnotationElement { parameters.data.contents ); super(parameters, isRenderable, /* ignoreBorder = */ true); + this.quadrilaterals = this._createQuadrilaterals(/* ignoreBorder = */ true); } /** @@ -1499,11 +1508,18 @@ class SquigglyAnnotationElement extends AnnotationElement { * @returns {HTMLSectionElement} */ render() { - this.container.className = "squigglyAnnotation"; - if (!this.data.hasPopup) { this._createPopup(null, this.data); } + + if (this.quadrilaterals) { + this.quadrilaterals.forEach(quadrilateral => { + quadrilateral.className = "squigglyAnnotation"; + }); + return this.quadrilaterals; + } + + this.container.className = "squigglyAnnotation"; return this.container; } } @@ -1516,6 +1532,7 @@ class StrikeOutAnnotationElement extends AnnotationElement { parameters.data.contents ); super(parameters, isRenderable, /* ignoreBorder = */ true); + this.quadrilaterals = this._createQuadrilaterals(/* ignoreBorder = */ true); } /** @@ -1526,11 +1543,18 @@ class StrikeOutAnnotationElement extends AnnotationElement { * @returns {HTMLSectionElement} */ render() { - this.container.className = "strikeoutAnnotation"; - if (!this.data.hasPopup) { this._createPopup(null, this.data); } + + if (this.quadrilaterals) { + this.quadrilaterals.forEach(quadrilateral => { + quadrilateral.className = "strikeoutAnnotation"; + }); + return this.quadrilaterals; + } + + this.container.className = "strikeoutAnnotation"; return this.container; } }