mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-02 20:37:21 +02:00
Merge pull request #20793 from Snuffleupagus/more-getRawEntries
Use the `Dict.prototype.getRawEntries` method more
This commit is contained in:
commit
40bd73551c
@ -2228,9 +2228,9 @@ class WidgetAnnotation extends Annotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dict = new Dict(xref);
|
const dict = new Dict(xref);
|
||||||
for (const key of originalDict.getKeys()) {
|
for (const [key, rawVal] of originalDict.getRawEntries()) {
|
||||||
if (key !== "AP") {
|
if (key !== "AP") {
|
||||||
dict.set(key, originalDict.getRaw(key));
|
dict.set(key, rawVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags !== undefined) {
|
if (flags !== undefined) {
|
||||||
@ -2442,8 +2442,8 @@ class WidgetAnnotation extends Annotation {
|
|||||||
|
|
||||||
if (this._fieldResources.mergedResources.has("Font")) {
|
if (this._fieldResources.mergedResources.has("Font")) {
|
||||||
const oldFont = this._fieldResources.mergedResources.get("Font");
|
const oldFont = this._fieldResources.mergedResources.get("Font");
|
||||||
for (const key of newFont.getKeys()) {
|
for (const [key, rawVal] of newFont.getRawEntries()) {
|
||||||
oldFont.set(key, newFont.getRaw(key));
|
oldFont.set(key, rawVal);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._fieldResources.mergedResources.set("Font", newFont);
|
this._fieldResources.mergedResources.set("Font", newFont);
|
||||||
|
|||||||
@ -459,15 +459,14 @@ function collectActions(xref, dict, eventType) {
|
|||||||
if (!(additionalActions instanceof Dict)) {
|
if (!(additionalActions instanceof Dict)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (const key of additionalActions.getKeys()) {
|
for (const [key, rawActionDict] of additionalActions.getRawEntries()) {
|
||||||
const action = eventType[key];
|
const action = eventType[key];
|
||||||
if (!action) {
|
if (!action) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const actionDict = additionalActions.getRaw(key);
|
|
||||||
const parents = new RefSet();
|
const parents = new RefSet();
|
||||||
const list = [];
|
const list = [];
|
||||||
_collectJS(actionDict, xref, list, parents);
|
_collectJS(rawActionDict, xref, list, parents);
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
actions[action] = list;
|
actions[action] = list;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -312,8 +312,8 @@ class Dict {
|
|||||||
|
|
||||||
clone() {
|
clone() {
|
||||||
const dict = new Dict(this.xref);
|
const dict = new Dict(this.xref);
|
||||||
for (const key of this.getKeys()) {
|
for (const [key, rawVal] of this.getRawEntries()) {
|
||||||
dict.set(key, this.getRaw(key));
|
dict.set(key, rawVal);
|
||||||
}
|
}
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user