mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Text widget annotations: implement unit testing and sanitize data values
This commit is contained in:
parent
4d1592883d
commit
323e86c442
3 changed files with 71 additions and 5 deletions
|
@ -671,8 +671,19 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
|
|||
function TextWidgetAnnotation(params) {
|
||||
WidgetAnnotation.call(this, params);
|
||||
|
||||
this.data.textAlignment = Util.getInheritableProperty(params.dict, 'Q');
|
||||
this.data.maxLen = Util.getInheritableProperty(params.dict, 'MaxLen');
|
||||
// Determine the alignment of text in the field.
|
||||
var alignment = Util.getInheritableProperty(params.dict, 'Q');
|
||||
if (!isInt(alignment) || alignment < 0 || alignment > 2) {
|
||||
alignment = null;
|
||||
}
|
||||
this.data.textAlignment = alignment;
|
||||
|
||||
// Determine the maximum length of text in the field.
|
||||
var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
|
||||
if (!isInt(maximumLength) || maximumLength < 0) {
|
||||
maximumLength = null;
|
||||
}
|
||||
this.data.maxLen = maximumLength;
|
||||
}
|
||||
|
||||
Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue