diff --git a/library/HTMLPurifier/UnitConverter.php b/library/HTMLPurifier/UnitConverter.php index 6f4efba7..6e304610 100644 --- a/library/HTMLPurifier/UnitConverter.php +++ b/library/HTMLPurifier/UnitConverter.php @@ -9,6 +9,7 @@ class HTMLPurifier_UnitConverter const ENGLISH = 1; const METRIC = 2; + const DIGITAL = 3; /** * Units information array. Units are grouped into measuring systems @@ -21,9 +22,10 @@ class HTMLPurifier_UnitConverter */ protected static $units = array( self::ENGLISH => array( - 'pt' => 1, - 'pc' => 12, - 'in' => 72, + 'px' => 3, // This is as per CSS 2.1 and Firefox. Your mileage may vary + 'pt' => 4, + 'pc' => 48, + 'in' => 288, self::METRIC => array('pt', '0.352777778', 'mm'), ), self::METRIC => array( diff --git a/tests/HTMLPurifier/UnitConverterTest.php b/tests/HTMLPurifier/UnitConverterTest.php index 64ff8a3e..09b69b72 100644 --- a/tests/HTMLPurifier/UnitConverterTest.php +++ b/tests/HTMLPurifier/UnitConverterTest.php @@ -56,6 +56,9 @@ class HTMLPurifier_UnitConverterTest extends HTMLPurifier_Harness $this->assertConversion('1pt', '0.01389in'); $this->assertConversion('1.000pt', '0.01389in'); $this->assertConversion('100000pt', '1389in'); + + $this->assertConversion('1in', '96px'); + $this->assertConversion('96px', '1in'); } function testMetric() {