[Pkg-javascript-commits] [pdf.js] 50/161: Fix coding style in test/driver.js

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit e808bf57362e7c99aa715cd63d3caf3c5128873a
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Fri Mar 14 15:25:38 2014 +0100

    Fix coding style in test/driver.js
---
 test/driver.js | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/test/driver.js b/test/driver.js
index 464eb2a..d492f56 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -87,15 +87,17 @@ function cleanup() {
   // Clear out all the stylesheets since a new one is created for each font.
   while (document.styleSheets.length > 0) {
     var styleSheet = document.styleSheets[0];
-    while (styleSheet.cssRules.length > 0)
+    while (styleSheet.cssRules.length > 0) {
       styleSheet.deleteRule(0);
+    }
     var ownerNode = styleSheet.ownerNode;
     ownerNode.parentNode.removeChild(ownerNode);
   }
   var guard = document.getElementById('content-end');
   var body = document.body;
-  while (body.lastChild !== guard)
+  while (body.lastChild !== guard) {
     body.removeChild(body.lastChild);
+  }
 
   // Wipe out the link to the pdfdoc so it can be GC'ed.
   for (var i = 0; i < manifest.length; i++) {
@@ -107,10 +109,12 @@ function cleanup() {
 }
 
 function exceptionToString(e) {
-  if (typeof e !== 'object')
+  if (typeof e !== 'object') {
     return String(e);
-  if (!('message' in e))
+  }
+  if (!('message' in e)) {
     return JSON.stringify(e);
+  }
   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;
     // vScale and hScale already contain the scaling to pixel units
     var fontHeight = geom.fontSize * Math.abs(geom.vScale);
-    var fontAscent = geom.ascent ? geom.ascent * fontHeight :
-      geom.descent ? (1 + geom.descent) * fontHeight : fontHeight;
+    var fontAscent = (geom.ascent ? geom.ascent * fontHeight :
+      (geom.descent ? (1 + geom.descent) * fontHeight : fontHeight));
     ctx.save();
     ctx.beginPath();
     ctx.strokeStyle = 'red';
@@ -429,13 +433,15 @@ function checkScrolling() {
 }
 
 function log(str) {
-  if (stdout.insertAdjacentHTML)
+  if (stdout.insertAdjacentHTML) {
     stdout.insertAdjacentHTML('BeforeEnd', str);
-  else
+  } else {
     stdout.innerHTML += str;
+  }
 
-  if (str.lastIndexOf('\n') >= 0)
+  if (str.lastIndexOf('\n') >= 0) {
     checkScrolling();
+  }
 }
 
 })(); // DriverClosure

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list