Split the existing PDFFunction in two classes, a private PDFFunction and a public PDFFunctionFactory, and utilize the latter in PDFDocument to allow various code to access the methods of PDFFunction`

*Follow-up to PR 8909.*

This requires us to pass around `pdfFunctionFactory` to quite a lot of existing code, however I don't see another way of handling this while still guaranteeing that we can access `PDFFunction` as freely as in the old code.

Please note that the patch passes all tests locally (unit, font, reference), and I *very* much hope that we have sufficient test-coverage for the code in question to catch any typos/mistakes in the re-factoring.
This commit is contained in:
Jonas Jenwald 2017-09-19 13:49:30 +02:00
parent 5c961c76bb
commit b8ec518a1e
8 changed files with 226 additions and 124 deletions

View file

@ -18,16 +18,14 @@ import { Page } from '../../src/core/document';
describe('document', function () {
describe('Page', function () {
it('should create correct objId using the idFactory', function () {
var page1 = new Page(/* pdfManager = */ { }, /* xref = */ null,
/* pageIndex = */ 0,
/* pageDict = */ null, /* ref = */ null,
/* fontCache = */ null,
/* builtInCMapCache = */ null);
var page2 = new Page(/* pdfManager = */ { }, /* xref = */ null,
/* pageIndex = */ 1,
/* pageDict = */ null, /* ref = */ null,
/* fontCache = */ null,
/* builtInCMapCache = */ null);
var page1 = new Page({
pdfManager: { },
pageIndex: 0,
});
var page2 = new Page({
pdfManager: { },
pageIndex: 1,
});
var idFactory1 = page1.idFactory, idFactory2 = page2.idFactory;