Fix coding style in test/driver.js
This commit is contained in:
parent
ba8a59034c
commit
e808bf5736
@ -87,15 +87,17 @@ function cleanup() {
|
|||||||
// Clear out all the stylesheets since a new one is created for each font.
|
// Clear out all the stylesheets since a new one is created for each font.
|
||||||
while (document.styleSheets.length > 0) {
|
while (document.styleSheets.length > 0) {
|
||||||
var styleSheet = document.styleSheets[0];
|
var styleSheet = document.styleSheets[0];
|
||||||
while (styleSheet.cssRules.length > 0)
|
while (styleSheet.cssRules.length > 0) {
|
||||||
styleSheet.deleteRule(0);
|
styleSheet.deleteRule(0);
|
||||||
|
}
|
||||||
var ownerNode = styleSheet.ownerNode;
|
var ownerNode = styleSheet.ownerNode;
|
||||||
ownerNode.parentNode.removeChild(ownerNode);
|
ownerNode.parentNode.removeChild(ownerNode);
|
||||||
}
|
}
|
||||||
var guard = document.getElementById('content-end');
|
var guard = document.getElementById('content-end');
|
||||||
var body = document.body;
|
var body = document.body;
|
||||||
while (body.lastChild !== guard)
|
while (body.lastChild !== guard) {
|
||||||
body.removeChild(body.lastChild);
|
body.removeChild(body.lastChild);
|
||||||
|
}
|
||||||
|
|
||||||
// Wipe out the link to the pdfdoc so it can be GC'ed.
|
// Wipe out the link to the pdfdoc so it can be GC'ed.
|
||||||
for (var i = 0; i < manifest.length; i++) {
|
for (var i = 0; i < manifest.length; i++) {
|
||||||
@ -107,10 +109,12 @@ function cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exceptionToString(e) {
|
function exceptionToString(e) {
|
||||||
if (typeof e !== 'object')
|
if (typeof e !== 'object') {
|
||||||
return String(e);
|
return String(e);
|
||||||
if (!('message' in e))
|
}
|
||||||
|
if (!('message' in e)) {
|
||||||
return JSON.stringify(e);
|
return JSON.stringify(e);
|
||||||
|
}
|
||||||
return e.message + ('stack' in e ? ' at ' + e.stack.split('\n')[0] : '');
|
return e.message + ('stack' in e ? ' at ' + e.stack.split('\n')[0] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,8 +202,8 @@ SimpleTextLayerBuilder.prototype = {
|
|||||||
var ctx = this.ctx, viewport = this.viewport;
|
var ctx = this.ctx, viewport = this.viewport;
|
||||||
// vScale and hScale already contain the scaling to pixel units
|
// vScale and hScale already contain the scaling to pixel units
|
||||||
var fontHeight = geom.fontSize * Math.abs(geom.vScale);
|
var fontHeight = geom.fontSize * Math.abs(geom.vScale);
|
||||||
var fontAscent = geom.ascent ? geom.ascent * fontHeight :
|
var fontAscent = (geom.ascent ? geom.ascent * fontHeight :
|
||||||
geom.descent ? (1 + geom.descent) * fontHeight : fontHeight;
|
(geom.descent ? (1 + geom.descent) * fontHeight : fontHeight));
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.strokeStyle = 'red';
|
ctx.strokeStyle = 'red';
|
||||||
@ -429,13 +433,15 @@ function checkScrolling() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function log(str) {
|
function log(str) {
|
||||||
if (stdout.insertAdjacentHTML)
|
if (stdout.insertAdjacentHTML) {
|
||||||
stdout.insertAdjacentHTML('BeforeEnd', str);
|
stdout.insertAdjacentHTML('BeforeEnd', str);
|
||||||
else
|
} else {
|
||||||
stdout.innerHTML += str;
|
stdout.innerHTML += str;
|
||||||
|
}
|
||||||
|
|
||||||
if (str.lastIndexOf('\n') >= 0)
|
if (str.lastIndexOf('\n') >= 0) {
|
||||||
checkScrolling();
|
checkScrolling();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})(); // DriverClosure
|
})(); // DriverClosure
|
||||||
|
Loading…
Reference in New Issue
Block a user