Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: chrome/browser/resources/print_preview/print_preview_utils.js

Issue 8345025: Print Preview: Adding support for localized margin units and format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing tests Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/print_preview_utils.js
diff --git a/chrome/browser/resources/print_preview/print_preview_utils.js b/chrome/browser/resources/print_preview/print_preview_utils.js
index 90ecd1603accb153b7e25bd4c5b976d097cdc0e0..e16c445381d3a5b7f6c3be502c748de515235def 100644
--- a/chrome/browser/resources/print_preview/print_preview_utils.js
+++ b/chrome/browser/resources/print_preview/print_preview_utils.js
@@ -190,7 +190,6 @@ function getPageSrcURL(id, pageNumber) {
return 'chrome://print/' + id + '/' + pageNumber + '/print.pdf';
}
-
/**
* Returns a random integer within the specified range, |endPointA| and
* |endPointB| are included.
@@ -205,7 +204,9 @@ function randomInteger(endPointA, endPointB) {
}
// Number of points per inch.
-POINTS_PER_INCH = 72;
+var POINTS_PER_INCH = 72;
+// Number of points per millimeter.
+var POINTS_PER_MILLIMETER = 2.83464567;
/**
* Converts |value| from inches to points.
@@ -224,3 +225,21 @@ function convertInchesToPoints(value) {
function convertPointsToInches(value) {
return value / POINTS_PER_INCH;
}
+
+/**
+ * Converts |value| from millimeters to points.
+ * @param {number} value The number in millimeters.
+ * @return {number} |value| in points.
+ */
+function convertMillimetersToPoints(value) {
+ return value * POINTS_PER_MILLIMETER;
+}
+
+/**
+ * Converts |value| from points to millimeters.
+ * @param {number} value The number in points.
+ * @return {number} |value| in millimeters.
+ */
+function convertPointsToMillimeters(value) {
+ return value / POINTS_PER_MILLIMETER;
+}

Powered by Google App Engine
This is Rietveld 408576698