mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1303651 - Update pdf.js to version 1.5.476. r=bdahl
This commit is contained in:
parent
96156f6fde
commit
237d452b75
@ -1,3 +1,3 @@
|
||||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 1.5.464
|
||||
Current extension version is: 1.5.476
|
||||
|
@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
|
||||
// Use strict in our context only - users might not want it
|
||||
'use strict';
|
||||
|
||||
var pdfjsVersion = '1.5.464';
|
||||
var pdfjsBuild = '834a7ff';
|
||||
var pdfjsVersion = '1.5.476';
|
||||
var pdfjsBuild = 'c0e82db';
|
||||
|
||||
var pdfjsFilePath =
|
||||
typeof document !== 'undefined' && document.currentScript ?
|
||||
@ -114,6 +114,28 @@ var AnnotationFlag = {
|
||||
LOCKEDCONTENTS: 0x200
|
||||
};
|
||||
|
||||
var AnnotationFieldFlag = {
|
||||
READONLY: 1,
|
||||
REQUIRED: 2,
|
||||
NOEXPORT: 3,
|
||||
MULTILINE: 13,
|
||||
PASSWORD: 14,
|
||||
NOTOGGLETOOFF: 15,
|
||||
RADIO: 16,
|
||||
PUSHBUTTON: 17,
|
||||
COMBO: 18,
|
||||
EDIT: 19,
|
||||
SORT: 20,
|
||||
FILESELECT: 21,
|
||||
MULTISELECT: 22,
|
||||
DONOTSPELLCHECK: 23,
|
||||
DONOTSCROLL: 24,
|
||||
COMB: 25,
|
||||
RICHTEXT: 26,
|
||||
RADIOSINUNISON: 26,
|
||||
COMMITONSELCHANGE: 27,
|
||||
};
|
||||
|
||||
var AnnotationBorderStyleType = {
|
||||
SOLID: 1,
|
||||
DASHED: 2,
|
||||
@ -1405,6 +1427,7 @@ exports.OPS = OPS;
|
||||
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
|
||||
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
||||
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
||||
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
||||
exports.AnnotationFlag = AnnotationFlag;
|
||||
exports.AnnotationType = AnnotationType;
|
||||
exports.FontType = FontType;
|
||||
@ -2295,7 +2318,9 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
|
||||
*/
|
||||
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
|
||||
function WidgetAnnotationElement(parameters) {
|
||||
AnnotationElement.call(this, parameters, true);
|
||||
var isRenderable = parameters.renderInteractiveForms ||
|
||||
(!parameters.data.hasAppearance && !!parameters.data.fieldValue);
|
||||
AnnotationElement.call(this, parameters, isRenderable);
|
||||
}
|
||||
|
||||
Util.inherit(WidgetAnnotationElement, AnnotationElement, {
|
||||
@ -2340,9 +2365,15 @@ var TextWidgetAnnotationElement = (
|
||||
|
||||
var element = null;
|
||||
if (this.renderInteractiveForms) {
|
||||
element = document.createElement('input');
|
||||
element.type = 'text';
|
||||
if (this.data.multiLine) {
|
||||
element = document.createElement('textarea');
|
||||
} else {
|
||||
element = document.createElement('input');
|
||||
element.type = 'text';
|
||||
}
|
||||
|
||||
element.value = this.data.fieldValue;
|
||||
element.disabled = this.data.readOnly;
|
||||
|
||||
if (this.data.maxLen !== null) {
|
||||
element.maxLength = this.data.maxLen;
|
||||
@ -7270,6 +7301,9 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
|
||||
* calling of PDFPage.getViewport method.
|
||||
* @property {string} intent - Rendering intent, can be 'display' or 'print'
|
||||
* (default value is 'display').
|
||||
* @property {boolean} renderInteractiveForms - (optional) Whether or not
|
||||
* interactive form elements are rendered in the display
|
||||
* layer. If so, we do not render them on canvas as well.
|
||||
* @property {Array} transform - (optional) Additional transform, applied
|
||||
* just before viewport transform.
|
||||
* @property {Object} imageLayer - (optional) An object that has beginLayout,
|
||||
@ -7378,6 +7412,8 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
this.pendingCleanup = false;
|
||||
|
||||
var renderingIntent = (params.intent === 'print' ? 'print' : 'display');
|
||||
var renderInteractiveForms = (params.renderInteractiveForms === true ?
|
||||
true : /* Default */ false);
|
||||
|
||||
if (!this.intentStates[renderingIntent]) {
|
||||
this.intentStates[renderingIntent] = Object.create(null);
|
||||
@ -7398,7 +7434,8 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
this.stats.time('Page Request');
|
||||
this.transport.messageHandler.send('RenderPageRequest', {
|
||||
pageIndex: this.pageNumber - 1,
|
||||
intent: renderingIntent
|
||||
intent: renderingIntent,
|
||||
renderInteractiveForms: renderInteractiveForms,
|
||||
});
|
||||
}
|
||||
|
||||
@ -8932,13 +8969,6 @@ exports._UnsupportedManager = _UnsupportedManager;
|
||||
PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
|
||||
true : PDFJS.isEvalSupported);
|
||||
|
||||
/**
|
||||
* Renders interactive form elements.
|
||||
* @var {boolean}
|
||||
*/
|
||||
PDFJS.renderInteractiveForms = (PDFJS.renderInteractiveForms === undefined ?
|
||||
false : PDFJS.renderInteractiveForms);
|
||||
|
||||
|
||||
PDFJS.getDocument = displayAPI.getDocument;
|
||||
PDFJS.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;
|
||||
|
156
browser/extensions/pdfjs/content/build/pdf.worker.js
vendored
156
browser/extensions/pdfjs/content/build/pdf.worker.js
vendored
@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
|
||||
// Use strict in our context only - users might not want it
|
||||
'use strict';
|
||||
|
||||
var pdfjsVersion = '1.5.464';
|
||||
var pdfjsBuild = '834a7ff';
|
||||
var pdfjsVersion = '1.5.476';
|
||||
var pdfjsBuild = 'c0e82db';
|
||||
|
||||
var pdfjsFilePath =
|
||||
typeof document !== 'undefined' && document.currentScript ?
|
||||
@ -1100,6 +1100,28 @@ var AnnotationFlag = {
|
||||
LOCKEDCONTENTS: 0x200
|
||||
};
|
||||
|
||||
var AnnotationFieldFlag = {
|
||||
READONLY: 1,
|
||||
REQUIRED: 2,
|
||||
NOEXPORT: 3,
|
||||
MULTILINE: 13,
|
||||
PASSWORD: 14,
|
||||
NOTOGGLETOOFF: 15,
|
||||
RADIO: 16,
|
||||
PUSHBUTTON: 17,
|
||||
COMBO: 18,
|
||||
EDIT: 19,
|
||||
SORT: 20,
|
||||
FILESELECT: 21,
|
||||
MULTISELECT: 22,
|
||||
DONOTSPELLCHECK: 23,
|
||||
DONOTSCROLL: 24,
|
||||
COMB: 25,
|
||||
RICHTEXT: 26,
|
||||
RADIOSINUNISON: 26,
|
||||
COMMITONSELCHANGE: 27,
|
||||
};
|
||||
|
||||
var AnnotationBorderStyleType = {
|
||||
SOLID: 1,
|
||||
DASHED: 2,
|
||||
@ -2391,6 +2413,7 @@ exports.OPS = OPS;
|
||||
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
|
||||
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
||||
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
||||
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
||||
exports.AnnotationFlag = AnnotationFlag;
|
||||
exports.AnnotationType = AnnotationType;
|
||||
exports.FontType = FontType;
|
||||
@ -27015,6 +27038,30 @@ function adjustWidths(properties) {
|
||||
properties.defaultWidth *= scale;
|
||||
}
|
||||
|
||||
function adjustToUnicode(properties, builtInEncoding) {
|
||||
if (properties.hasIncludedToUnicodeMap) {
|
||||
return; // The font dictionary has a `ToUnicode` entry.
|
||||
}
|
||||
if (properties.hasEncoding) {
|
||||
return; // The font dictionary has an `Encoding` entry.
|
||||
}
|
||||
if (builtInEncoding === properties.defaultEncoding) {
|
||||
return; // No point in trying to adjust `toUnicode` if the encodings match.
|
||||
}
|
||||
if (properties.toUnicode instanceof IdentityToUnicodeMap) {
|
||||
return;
|
||||
}
|
||||
var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
|
||||
for (var charCode in builtInEncoding) {
|
||||
var glyphName = builtInEncoding[charCode];
|
||||
var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
|
||||
if (unicode !== -1) {
|
||||
toUnicode[charCode] = String.fromCharCode(unicode);
|
||||
}
|
||||
}
|
||||
properties.toUnicode.amend(toUnicode);
|
||||
}
|
||||
|
||||
function getFontType(type, subtype) {
|
||||
switch (type) {
|
||||
case 'Type1':
|
||||
@ -27113,7 +27160,13 @@ var ToUnicodeMap = (function ToUnicodeMapClosure() {
|
||||
|
||||
charCodeOf: function(v) {
|
||||
return this._map.indexOf(v);
|
||||
}
|
||||
},
|
||||
|
||||
amend: function (map) {
|
||||
for (var charCode in map) {
|
||||
this._map[charCode] = map[charCode];
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return ToUnicodeMap;
|
||||
@ -27149,7 +27202,11 @@ var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
|
||||
|
||||
charCodeOf: function (v) {
|
||||
return (isInt(v) && v >= this.firstChar && v <= this.lastChar) ? v : -1;
|
||||
}
|
||||
},
|
||||
|
||||
amend: function (map) {
|
||||
error('Should not call amend()');
|
||||
},
|
||||
};
|
||||
|
||||
return IdentityToUnicodeMap;
|
||||
@ -27550,6 +27607,7 @@ var Font = (function FontClosure() {
|
||||
this.fontMatrix = properties.fontMatrix;
|
||||
this.widths = properties.widths;
|
||||
this.defaultWidth = properties.defaultWidth;
|
||||
this.toUnicode = properties.toUnicode;
|
||||
this.encoding = properties.baseEncoding;
|
||||
this.seacMap = properties.seacMap;
|
||||
|
||||
@ -29171,10 +29229,8 @@ var Font = (function FontClosure() {
|
||||
} else {
|
||||
// Most of the following logic in this code branch is based on the
|
||||
// 9.6.6.4 of the PDF spec.
|
||||
var hasEncoding =
|
||||
properties.differences.length > 0 || !!properties.baseEncodingName;
|
||||
var cmapTable =
|
||||
readCmapTable(tables['cmap'], font, this.isSymbolicFont, hasEncoding);
|
||||
var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont,
|
||||
properties.hasEncoding);
|
||||
var cmapPlatformId = cmapTable.platformId;
|
||||
var cmapEncodingId = cmapTable.encodingId;
|
||||
var cmapMappings = cmapTable.mappings;
|
||||
@ -29183,7 +29239,7 @@ var Font = (function FontClosure() {
|
||||
// The spec seems to imply that if the font is symbolic the encoding
|
||||
// should be ignored, this doesn't appear to work for 'preistabelle.pdf'
|
||||
// where the the font is symbolic and it has an encoding.
|
||||
if (hasEncoding &&
|
||||
if (properties.hasEncoding &&
|
||||
(cmapPlatformId === 3 && cmapEncodingId === 1 ||
|
||||
cmapPlatformId === 1 && cmapEncodingId === 0) ||
|
||||
(cmapPlatformId === -1 && cmapEncodingId === -1 && // Temporary hack
|
||||
@ -29347,6 +29403,12 @@ var Font = (function FontClosure() {
|
||||
// TODO: Check the charstring widths to determine this.
|
||||
properties.fixedPitch = false;
|
||||
|
||||
if (properties.builtInEncoding) {
|
||||
// For Type1 fonts that do not include either `ToUnicode` or `Encoding`
|
||||
// data, attempt to use the `builtInEncoding` to improve text selection.
|
||||
adjustToUnicode(properties, properties.builtInEncoding);
|
||||
}
|
||||
|
||||
var mapping = font.getGlyphMapping(properties);
|
||||
var newMapping = adjustMapping(mapping, properties);
|
||||
this.toFontChar = newMapping.toFontChar;
|
||||
@ -37623,6 +37685,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
|
||||
properties.differences = differences;
|
||||
properties.baseEncodingName = baseEncodingName;
|
||||
properties.hasEncoding = !!baseEncodingName || differences.length > 0;
|
||||
properties.dict = dict;
|
||||
return toUnicodePromise.then(function(toUnicode) {
|
||||
properties.toUnicode = toUnicode;
|
||||
@ -37640,8 +37703,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
* {ToUnicodeMap|IdentityToUnicodeMap} object.
|
||||
*/
|
||||
buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
|
||||
properties.hasIncludedToUnicodeMap =
|
||||
!!properties.toUnicode && properties.toUnicode.length > 0;
|
||||
// Section 9.10.2 Mapping Character Codes to Unicode Values
|
||||
if (properties.toUnicode && properties.toUnicode.length !== 0) {
|
||||
if (properties.hasIncludedToUnicodeMap) {
|
||||
return Promise.resolve(properties.toUnicode);
|
||||
}
|
||||
// According to the spec if the font is a simple font we should only map
|
||||
@ -39186,6 +39251,7 @@ exports.PartialEvaluator = PartialEvaluator;
|
||||
coreColorSpace, coreObj, coreEvaluator) {
|
||||
|
||||
var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
|
||||
var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
|
||||
var AnnotationFlag = sharedUtil.AnnotationFlag;
|
||||
var AnnotationType = sharedUtil.AnnotationType;
|
||||
var OPS = sharedUtil.OPS;
|
||||
@ -39218,10 +39284,14 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
||||
/**
|
||||
* @param {XRef} xref
|
||||
* @param {Object} ref
|
||||
* @param {string} uniquePrefix
|
||||
* @param {Object} idCounters
|
||||
* @param {boolean} renderInteractiveForms
|
||||
* @returns {Annotation}
|
||||
*/
|
||||
create: function AnnotationFactory_create(xref, ref,
|
||||
uniquePrefix, idCounters) {
|
||||
uniquePrefix, idCounters,
|
||||
renderInteractiveForms) {
|
||||
var dict = xref.fetchIfRef(ref);
|
||||
if (!isDict(dict)) {
|
||||
return;
|
||||
@ -39240,6 +39310,7 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
||||
ref: isRef(ref) ? ref : null,
|
||||
subtype: subtype,
|
||||
id: id,
|
||||
renderInteractiveForms: renderInteractiveForms,
|
||||
};
|
||||
|
||||
switch (subtype) {
|
||||
@ -39774,9 +39845,13 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {
|
||||
data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
|
||||
var fieldType = Util.getInheritableProperty(dict, 'FT');
|
||||
data.fieldType = isName(fieldType) ? fieldType.name : null;
|
||||
data.fieldFlags = Util.getInheritableProperty(dict, 'Ff') || 0;
|
||||
this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
|
||||
|
||||
data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
|
||||
if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
|
||||
data.fieldFlags = 0;
|
||||
}
|
||||
|
||||
// Hide signatures because we cannot validate them.
|
||||
if (data.fieldType === 'Sig') {
|
||||
this.setFlags(AnnotationFlag.HIDDEN);
|
||||
@ -39815,7 +39890,22 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {
|
||||
data.fullName = fieldName.join('.');
|
||||
}
|
||||
|
||||
Util.inherit(WidgetAnnotation, Annotation, {});
|
||||
Util.inherit(WidgetAnnotation, Annotation, {
|
||||
/**
|
||||
* Check if a provided field flag is set.
|
||||
*
|
||||
* @public
|
||||
* @memberof WidgetAnnotation
|
||||
* @param {number} flag - Bit position, numbered from one instead of
|
||||
* zero, to check
|
||||
* @return {boolean}
|
||||
* @see {@link shared/util.js}
|
||||
*/
|
||||
hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
|
||||
var mask = 1 << (flag - 1);
|
||||
return !!(this.data.fieldFlags & mask);
|
||||
},
|
||||
});
|
||||
|
||||
return WidgetAnnotation;
|
||||
})();
|
||||
@ -39824,6 +39914,8 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
|
||||
function TextWidgetAnnotation(params) {
|
||||
WidgetAnnotation.call(this, params);
|
||||
|
||||
this.renderInteractiveForms = params.renderInteractiveForms;
|
||||
|
||||
// Determine the alignment of text in the field.
|
||||
var alignment = Util.getInheritableProperty(params.dict, 'Q');
|
||||
if (!isInt(alignment) || alignment < 0 || alignment > 2) {
|
||||
@ -39837,29 +39929,38 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
|
||||
maximumLength = null;
|
||||
}
|
||||
this.data.maxLen = maximumLength;
|
||||
|
||||
// Process field flags for the display layer.
|
||||
this.data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
|
||||
this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
|
||||
}
|
||||
|
||||
Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
|
||||
getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator,
|
||||
task) {
|
||||
var operatorList = new OperatorList();
|
||||
|
||||
// Do not render form elements on the canvas when interactive forms are
|
||||
// enabled. The display layer is responsible for rendering them instead.
|
||||
if (this.renderInteractiveForms) {
|
||||
return Promise.resolve(operatorList);
|
||||
}
|
||||
|
||||
if (this.appearance) {
|
||||
return Annotation.prototype.getOperatorList.call(this, evaluator, task);
|
||||
}
|
||||
|
||||
var opList = new OperatorList();
|
||||
var data = this.data;
|
||||
|
||||
// Even if there is an appearance stream, ignore it. This is the
|
||||
// behaviour used by Adobe Reader.
|
||||
if (!data.defaultAppearance) {
|
||||
return Promise.resolve(opList);
|
||||
if (!this.data.defaultAppearance) {
|
||||
return Promise.resolve(operatorList);
|
||||
}
|
||||
|
||||
var stream = new Stream(stringToBytes(data.defaultAppearance));
|
||||
return evaluator.getOperatorList(stream, task,
|
||||
this.fieldResources, opList).
|
||||
var stream = new Stream(stringToBytes(this.data.defaultAppearance));
|
||||
return evaluator.getOperatorList(stream, task, this.fieldResources,
|
||||
operatorList).
|
||||
then(function () {
|
||||
return opList;
|
||||
return operatorList;
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -40306,7 +40407,8 @@ var Page = (function PageClosure() {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
getOperatorList: function Page_getOperatorList(handler, task, intent) {
|
||||
getOperatorList: function Page_getOperatorList(handler, task, intent,
|
||||
renderInteractiveForms) {
|
||||
var self = this;
|
||||
|
||||
var pdfManager = this.pdfManager;
|
||||
@ -40346,6 +40448,8 @@ var Page = (function PageClosure() {
|
||||
});
|
||||
});
|
||||
|
||||
this.renderInteractiveForms = renderInteractiveForms;
|
||||
|
||||
var annotationsPromise = pdfManager.ensure(this, 'annotations');
|
||||
return Promise.all([pageListPromise, annotationsPromise]).then(
|
||||
function(datas) {
|
||||
@ -40429,7 +40533,8 @@ var Page = (function PageClosure() {
|
||||
var annotationRef = annotationRefs[i];
|
||||
var annotation = annotationFactory.create(this.xref, annotationRef,
|
||||
this.uniquePrefix,
|
||||
this.idCounters);
|
||||
this.idCounters,
|
||||
this.renderInteractiveForms);
|
||||
if (annotation) {
|
||||
annotations.push(annotation);
|
||||
}
|
||||
@ -41616,7 +41721,8 @@ var WorkerMessageHandler = {
|
||||
var pageNum = pageIndex + 1;
|
||||
var start = Date.now();
|
||||
// Pre compile the pdf page and fetch the fonts/images.
|
||||
page.getOperatorList(handler, task, data.intent).then(
|
||||
page.getOperatorList(handler, task, data.intent,
|
||||
data.renderInteractiveForms).then(
|
||||
function(operatorList) {
|
||||
finishWorkerTask(task);
|
||||
|
||||
|
@ -101,7 +101,8 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.annotationLayer .textWidgetAnnotation input {
|
||||
.annotationLayer .textWidgetAnnotation input,
|
||||
.annotationLayer .textWidgetAnnotation textarea {
|
||||
background-color: rgba(0, 54, 255, 0.13);
|
||||
border: 1px solid transparent;
|
||||
box-sizing: border-box;
|
||||
@ -112,11 +113,26 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.annotationLayer .textWidgetAnnotation input:hover {
|
||||
.annotationLayer .textWidgetAnnotation textarea {
|
||||
font: message-box;
|
||||
font-size: 9px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.annotationLayer .textWidgetAnnotation input[disabled],
|
||||
.annotationLayer .textWidgetAnnotation textarea[disabled] {
|
||||
background: none;
|
||||
border: 1px solid transparent;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.annotationLayer .textWidgetAnnotation input:hover,
|
||||
.annotationLayer .textWidgetAnnotation textarea:hover {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
.annotationLayer .textWidgetAnnotation input:focus {
|
||||
.annotationLayer .textWidgetAnnotation input:focus,
|
||||
.annotationLayer .textWidgetAnnotation textarea:focus {
|
||||
background: none;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
@ -5054,6 +5054,8 @@ var TEXT_LAYER_RENDER_DELAY = 200; // ms
|
||||
* @property {IPDFAnnotationLayerFactory} annotationLayerFactory
|
||||
* @property {boolean} enhanceTextSelection - Turns on the text selection
|
||||
* enhancement. The default is `false`.
|
||||
* @property {boolean} renderInteractiveForms - Turns on rendering of
|
||||
* interactive form elements. The default is `false`.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -5074,6 +5076,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
var textLayerFactory = options.textLayerFactory;
|
||||
var annotationLayerFactory = options.annotationLayerFactory;
|
||||
var enhanceTextSelection = options.enhanceTextSelection || false;
|
||||
var renderInteractiveForms = options.renderInteractiveForms || false;
|
||||
|
||||
this.id = id;
|
||||
this.renderingId = 'page' + id;
|
||||
@ -5084,6 +5087,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
this.pdfPageRotate = defaultViewport.rotation;
|
||||
this.hasRestrictedScaling = false;
|
||||
this.enhanceTextSelection = enhanceTextSelection;
|
||||
this.renderInteractiveForms = renderInteractiveForms;
|
||||
|
||||
this.eventBus = options.eventBus || domEvents.getGlobalEventBus();
|
||||
this.renderingQueue = renderingQueue;
|
||||
@ -5498,6 +5502,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
canvasContext: ctx,
|
||||
transform: transform,
|
||||
viewport: this.viewport,
|
||||
renderInteractiveForms: this.renderInteractiveForms,
|
||||
// intent: 'default', // === 'display'
|
||||
};
|
||||
var renderTask = this.renderTask = this.pdfPage.render(renderContext);
|
||||
@ -5523,7 +5528,8 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
if (this.annotationLayerFactory) {
|
||||
if (!this.annotationLayer) {
|
||||
this.annotationLayer = this.annotationLayerFactory.
|
||||
createAnnotationLayerBuilder(div, this.pdfPage);
|
||||
createAnnotationLayerBuilder(div, this.pdfPage,
|
||||
this.renderInteractiveForms);
|
||||
}
|
||||
this.annotationLayer.render(this.viewport, 'display');
|
||||
}
|
||||
@ -6164,6 +6170,7 @@ var SimpleLinkService = pdfLinkService.SimpleLinkService;
|
||||
* @typedef {Object} AnnotationLayerBuilderOptions
|
||||
* @property {HTMLDivElement} pageDiv
|
||||
* @property {PDFPage} pdfPage
|
||||
* @property {boolean} renderInteractiveForms
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {DownloadManager} downloadManager
|
||||
*/
|
||||
@ -6179,6 +6186,7 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
|
||||
function AnnotationLayerBuilder(options) {
|
||||
this.pageDiv = options.pageDiv;
|
||||
this.pdfPage = options.pdfPage;
|
||||
this.renderInteractiveForms = options.renderInteractiveForms;
|
||||
this.linkService = options.linkService;
|
||||
this.downloadManager = options.downloadManager;
|
||||
|
||||
@ -6205,9 +6213,9 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
|
||||
div: self.div,
|
||||
annotations: annotations,
|
||||
page: self.pdfPage,
|
||||
renderInteractiveForms: self.renderInteractiveForms,
|
||||
linkService: self.linkService,
|
||||
downloadManager: self.downloadManager,
|
||||
renderInteractiveForms: pdfjsLib.PDFJS.renderInteractiveForms,
|
||||
};
|
||||
|
||||
if (self.div) {
|
||||
@ -6254,12 +6262,15 @@ DefaultAnnotationLayerFactory.prototype = {
|
||||
/**
|
||||
* @param {HTMLDivElement} pageDiv
|
||||
* @param {PDFPage} pdfPage
|
||||
* @param {boolean} renderInteractiveForms
|
||||
* @returns {AnnotationLayerBuilder}
|
||||
*/
|
||||
createAnnotationLayerBuilder: function (pageDiv, pdfPage) {
|
||||
createAnnotationLayerBuilder: function (pageDiv, pdfPage,
|
||||
renderInteractiveForms) {
|
||||
return new AnnotationLayerBuilder({
|
||||
pageDiv: pageDiv,
|
||||
pdfPage: pdfPage,
|
||||
renderInteractiveForms: renderInteractiveForms,
|
||||
linkService: new SimpleLinkService(),
|
||||
});
|
||||
}
|
||||
@ -6321,6 +6332,8 @@ var DEFAULT_CACHE_SIZE = 10;
|
||||
* around the pages. The default is false.
|
||||
* @property {boolean} enhanceTextSelection - (optional) Enables the improved
|
||||
* text selection behaviour. The default is `false`.
|
||||
* @property {boolean} renderInteractiveForms - (optional) Enables rendering of
|
||||
* interactive form elements. The default is `false`.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -6373,6 +6386,7 @@ var PDFViewer = (function pdfViewer() {
|
||||
this.downloadManager = options.downloadManager || null;
|
||||
this.removePageBorders = options.removePageBorders || false;
|
||||
this.enhanceTextSelection = options.enhanceTextSelection || false;
|
||||
this.renderInteractiveForms = options.renderInteractiveForms || false;
|
||||
|
||||
this.defaultRenderingQueue = !options.renderingQueue;
|
||||
if (this.defaultRenderingQueue) {
|
||||
@ -6600,6 +6614,7 @@ var PDFViewer = (function pdfViewer() {
|
||||
textLayerFactory: textLayerFactory,
|
||||
annotationLayerFactory: this,
|
||||
enhanceTextSelection: this.enhanceTextSelection,
|
||||
renderInteractiveForms: this.renderInteractiveForms,
|
||||
});
|
||||
bindOnAfterAndBeforeDraw(pageView);
|
||||
this._pages.push(pageView);
|
||||
@ -7086,12 +7101,15 @@ var PDFViewer = (function pdfViewer() {
|
||||
/**
|
||||
* @param {HTMLDivElement} pageDiv
|
||||
* @param {PDFPage} pdfPage
|
||||
* @param {boolean} renderInteractiveForms
|
||||
* @returns {AnnotationLayerBuilder}
|
||||
*/
|
||||
createAnnotationLayerBuilder: function (pageDiv, pdfPage) {
|
||||
createAnnotationLayerBuilder: function (pageDiv, pdfPage,
|
||||
renderInteractiveForms) {
|
||||
return new AnnotationLayerBuilder({
|
||||
pageDiv: pageDiv,
|
||||
pdfPage: pdfPage,
|
||||
renderInteractiveForms: renderInteractiveForms,
|
||||
linkService: this.linkService,
|
||||
downloadManager: this.downloadManager
|
||||
});
|
||||
@ -7272,6 +7290,7 @@ var PDFViewerApplication = {
|
||||
linkService: pdfLinkService,
|
||||
downloadManager: downloadManager,
|
||||
enhanceTextSelection: false,
|
||||
renderInteractiveForms: false,
|
||||
});
|
||||
pdfRenderingQueue.setViewer(this.pdfViewer);
|
||||
pdfLinkService.setViewer(this.pdfViewer);
|
||||
@ -7432,7 +7451,10 @@ var PDFViewerApplication = {
|
||||
PDFJS.externalLinkTarget = value;
|
||||
}),
|
||||
Preferences.get('renderInteractiveForms').then(function resolved(value) {
|
||||
PDFJS.renderInteractiveForms = value;
|
||||
// TODO: Like the `enhanceTextSelection` preference, move the
|
||||
// initialization and fetching of `Preferences` to occur
|
||||
// before the various viewer components are initialized.
|
||||
self.pdfViewer.renderInteractiveForms = value;
|
||||
}),
|
||||
// TODO move more preferences and other async stuff here
|
||||
]).catch(function (reason) { });
|
||||
|
Loading…
x
Reference in New Issue
Block a user