Don't directly access the private map
in setGState
, and ensure that we avoid indirect objects
*This patch is based on something I noticed while debugging some of the PDF files in issue 6931.* In a number of the cases in `setGState`, we're implicitly assuming that we're not dealing with indirect objects (i.e. `Ref`s). See e.g. the 'Font' case, or the various cases where we simply do `gStateObj.push([key, value]);` (since the code in `canvas.js` won't be able to deal with a `Ref` for those cases). The reason that I didn't use `Dict_forEach` instead, is that it would re-introduce the unncessary closures that PR 5205 removed.
This commit is contained in:
parent
2d4a1aa0af
commit
a1fe2cb443
@ -468,11 +468,12 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
xref, stateManager) {
|
xref, stateManager) {
|
||||||
// This array holds the converted/processed state data.
|
// This array holds the converted/processed state data.
|
||||||
var gStateObj = [];
|
var gStateObj = [];
|
||||||
var gStateMap = gState.map;
|
var gStateKeys = gState.getKeys();
|
||||||
var self = this;
|
var self = this;
|
||||||
var promise = Promise.resolve();
|
var promise = Promise.resolve();
|
||||||
for (var key in gStateMap) {
|
for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
|
||||||
var value = gStateMap[key];
|
var key = gStateKeys[i];
|
||||||
|
var value = gState.get(key);
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'Type':
|
case 'Type':
|
||||||
break;
|
break;
|
||||||
@ -505,12 +506,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
gStateObj.push([key, false]);
|
gStateObj.push([key, false]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var dict = xref.fetchIfRef(value);
|
if (isDict(value)) {
|
||||||
if (isDict(dict)) {
|
promise = promise.then(function (dict) {
|
||||||
promise = promise.then(function () {
|
|
||||||
return self.handleSMask(dict, resources, operatorList,
|
return self.handleSMask(dict, resources, operatorList,
|
||||||
task, stateManager);
|
task, stateManager);
|
||||||
});
|
}.bind(this, value));
|
||||||
gStateObj.push([key, true]);
|
gStateObj.push([key, true]);
|
||||||
} else {
|
} else {
|
||||||
warn('Unsupported SMask type');
|
warn('Unsupported SMask type');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user