Merge pull request #17070 from calixteman/17069
Update the noHTML flag to take into account the hasOwnCanvas one (fixes #17069)
This commit is contained in:
		
						commit
						c4c24c6d18
					
				@ -2845,6 +2845,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
 | 
				
			|||||||
      this._processRadioButton(params);
 | 
					      this._processRadioButton(params);
 | 
				
			||||||
    } else if (this.data.pushButton) {
 | 
					    } else if (this.data.pushButton) {
 | 
				
			||||||
      this.data.hasOwnCanvas = true;
 | 
					      this.data.hasOwnCanvas = true;
 | 
				
			||||||
 | 
					      this.data.noHTML = false;
 | 
				
			||||||
      this._processPushButton(params);
 | 
					      this._processPushButton(params);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      warn("Invalid field flags for button widget annotation");
 | 
					      warn("Invalid field flags for button widget annotation");
 | 
				
			||||||
@ -3570,6 +3571,7 @@ class SignatureWidgetAnnotation extends WidgetAnnotation {
 | 
				
			|||||||
    // to the main-thread (issue 10347).
 | 
					    // to the main-thread (issue 10347).
 | 
				
			||||||
    this.data.fieldValue = null;
 | 
					    this.data.fieldValue = null;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = !this.data.hasOwnCanvas;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getFieldObject() {
 | 
					  getFieldObject() {
 | 
				
			||||||
@ -3591,6 +3593,7 @@ class TextAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
    // No rotation for Text (see 12.5.6.4).
 | 
					    // No rotation for Text (see 12.5.6.4).
 | 
				
			||||||
    this.data.noRotate = true;
 | 
					    this.data.noRotate = true;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const { dict } = params;
 | 
					    const { dict } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.TEXT;
 | 
					    this.data.annotationType = AnnotationType.TEXT;
 | 
				
			||||||
@ -3643,6 +3646,11 @@ class PopupAnnotation extends Annotation {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const { dict } = params;
 | 
					    const { dict } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.POPUP;
 | 
					    this.data.annotationType = AnnotationType.POPUP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // A pop-up is never rendered on the main canvas so we must render its HTML
 | 
				
			||||||
 | 
					    // version.
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
      this.data.rect[0] === this.data.rect[2] ||
 | 
					      this.data.rect[0] === this.data.rect[2] ||
 | 
				
			||||||
      this.data.rect[1] === this.data.rect[3]
 | 
					      this.data.rect[1] === this.data.rect[3]
 | 
				
			||||||
@ -3712,7 +3720,10 @@ class FreeTextAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
  constructor(params) {
 | 
					  constructor(params) {
 | 
				
			||||||
    super(params);
 | 
					    super(params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.data.hasOwnCanvas = true;
 | 
					    // It uses its own canvas in order to be hidden if edited.
 | 
				
			||||||
 | 
					    // But if it has the noHTML flag, it means that we don't want to be able
 | 
				
			||||||
 | 
					    // to modify it so we can just draw it on the main canvas.
 | 
				
			||||||
 | 
					    this.data.hasOwnCanvas = !this.data.noHTML;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const { evaluatorOptions, xref } = params;
 | 
					    const { evaluatorOptions, xref } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.FREETEXT;
 | 
					    this.data.annotationType = AnnotationType.FREETEXT;
 | 
				
			||||||
@ -3926,6 +3937,7 @@ class LineAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
    const { dict, xref } = params;
 | 
					    const { dict, xref } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.LINE;
 | 
					    this.data.annotationType = AnnotationType.LINE;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const lineCoordinates = dict.getArray("L");
 | 
					    const lineCoordinates = dict.getArray("L");
 | 
				
			||||||
    this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
 | 
					    this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
 | 
				
			||||||
@ -3993,6 +4005,7 @@ class SquareAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
    const { dict, xref } = params;
 | 
					    const { dict, xref } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.SQUARE;
 | 
					    this.data.annotationType = AnnotationType.SQUARE;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!this.appearance) {
 | 
					    if (!this.appearance) {
 | 
				
			||||||
      // The default stroke color is black.
 | 
					      // The default stroke color is black.
 | 
				
			||||||
@ -4105,6 +4118,7 @@ class PolylineAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
    const { dict, xref } = params;
 | 
					    const { dict, xref } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.POLYLINE;
 | 
					    this.data.annotationType = AnnotationType.POLYLINE;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
    this.data.vertices = [];
 | 
					    this.data.vertices = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
@ -4193,6 +4207,7 @@ class InkAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
    super(params);
 | 
					    super(params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const { dict, xref } = params;
 | 
					    const { dict, xref } = params;
 | 
				
			||||||
    this.data.annotationType = AnnotationType.INK;
 | 
					    this.data.annotationType = AnnotationType.INK;
 | 
				
			||||||
@ -4531,6 +4546,7 @@ class StampAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.data.annotationType = AnnotationType.STAMP;
 | 
					    this.data.annotationType = AnnotationType.STAMP;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static async createImage(bitmap, xref) {
 | 
					  static async createImage(bitmap, xref) {
 | 
				
			||||||
@ -4680,6 +4696,7 @@ class FileAttachmentAnnotation extends MarkupAnnotation {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.data.annotationType = AnnotationType.FILEATTACHMENT;
 | 
					    this.data.annotationType = AnnotationType.FILEATTACHMENT;
 | 
				
			||||||
    this.data.hasOwnCanvas = this.data.noRotate;
 | 
					    this.data.hasOwnCanvas = this.data.noRotate;
 | 
				
			||||||
 | 
					    this.data.noHTML = false;
 | 
				
			||||||
    this.data.file = file.serializable;
 | 
					    this.data.file = file.serializable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const name = dict.get("Name");
 | 
					    const name = dict.get("Name");
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -615,3 +615,4 @@
 | 
				
			|||||||
!tagged_stamp.pdf
 | 
					!tagged_stamp.pdf
 | 
				
			||||||
!bug1851498.pdf
 | 
					!bug1851498.pdf
 | 
				
			||||||
!issue17065.pdf
 | 
					!issue17065.pdf
 | 
				
			||||||
 | 
					!issue17069.pdf
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								test/pdfs/issue17069.pdf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/pdfs/issue17069.pdf
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -8156,5 +8156,13 @@
 | 
				
			|||||||
      "md5": "16a70b9941ba049a61612109e0e1d719",
 | 
					      "md5": "16a70b9941ba049a61612109e0e1d719",
 | 
				
			||||||
      "rounds": 1,
 | 
					      "rounds": 1,
 | 
				
			||||||
      "type": "eq"
 | 
					      "type": "eq"
 | 
				
			||||||
 | 
					   },
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					      "id": "issue17069",
 | 
				
			||||||
 | 
					      "file": "pdfs/issue17069.pdf",
 | 
				
			||||||
 | 
					      "md5": "e44a3920c83d8e7be112c52da4db8e57",
 | 
				
			||||||
 | 
					      "rounds": 1,
 | 
				
			||||||
 | 
					      "type": "eq",
 | 
				
			||||||
 | 
					      "annotations": true
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user