Merge pull request #4759 from timvandermeij/old-code

Refactoring annotation.js and removing old TODOs/comments
This commit is contained in:
Yury Delendik 2014-05-08 20:23:25 -05:00
commit 12d9022d36
2 changed files with 2 additions and 41 deletions

View File

@ -458,8 +458,6 @@ if (isCommonJS) exports.spyOn = spyOn;
/**
* Creates a Jasmine spec that will be added to the current suite.
*
* // TODO: pending tests
*
* @example
* it('should be true', function() {
* expect(true).toEqual(true);
@ -563,11 +561,6 @@ if (isCommonJS) exports.afterEach = afterEach;
* are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
* of setup in some tests.
*
* @example
* // TODO: a simple suite
*
* // TODO: a simple suite with a nested describe block
*
* @param {String} description A string, usually the class under test.
* @param {Function} specDefinitions function that defines several specs.
*/

View File

@ -501,44 +501,12 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
// Even if there is an appearance stream, ignore it. This is the
// behaviour used by Adobe Reader.
var defaultAppearance = data.defaultAppearance;
if (!defaultAppearance) {
if (!data.defaultAppearance) {
return Promise.resolve(opList);
}
// Include any font resources found in the default appearance
var stream = new Stream(stringToBytes(defaultAppearance));
var stream = new Stream(stringToBytes(data.defaultAppearance));
evaluator.getOperatorList(stream, this.fieldResources, opList);
var appearanceFnArray = opList.fnArray;
var appearanceArgsArray = opList.argsArray;
var fnArray = [];
// TODO(mack): Add support for stroke color
data.rgb = [0, 0, 0];
// TODO THIS DOESN'T MAKE ANY SENSE SINCE THE fnArray IS EMPTY!
for (var i = 0, n = fnArray.length; i < n; ++i) {
var fnId = appearanceFnArray[i];
var args = appearanceArgsArray[i];
if (fnId === OPS.setFont) {
data.fontRefName = args[0];
var size = args[1];
if (size < 0) {
data.fontDirection = -1;
data.fontSize = -size;
} else {
data.fontDirection = 1;
data.fontSize = size;
}
} else if (fnId === OPS.setFillRGBColor) {
data.rgb = args;
} else if (fnId === OPS.setFillGray) {
var rgbValue = args[0] * 255;
data.rgb = [rgbValue, rgbValue, rgbValue];
}
}
return Promise.resolve(opList);
}
});