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

Unified Diff: Source/core/css/CSSHelper.h

Issue 87453003: Less magic numbers in converting CSS lengths of cm/mm/pc/pt types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSHelper.h
diff --git a/Source/core/css/CSSHelper.h b/Source/core/css/CSSHelper.h
index ac2c792933a07b521cc320a87bbcc40902385fac..6775631a6e91eb3ff4e9f82568e8c130b44de50f 100644
--- a/Source/core/css/CSSHelper.h
+++ b/Source/core/css/CSSHelper.h
@@ -29,7 +29,11 @@ namespace WebCore {
// We always assume 96 CSS pixels in a CSS inch. This is the cold hard truth of the Web.
// At high DPI, we may scale a CSS pixel, but the ratio of the CSS pixel to the so-called
// "absolute" CSS length units like inch and pt is always fixed and never changes.
-const float cssPixelsPerInch = 96;
+const double cssPixelsPerInch = 96;
+const double cssPixelsPerCentimeter = cssPixelsPerInch / 2.54; // 2.54 cm/in
+const double cssPixelsPerMillimeter = cssPixelsPerCentimeter / 10;
+const double cssPixelsPerPoint = cssPixelsPerInch / 72;
+const double cssPixelsPerPica = cssPixelsPerInch / 6;
} // namespace WebCore
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698