mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 23:28:42 +00:00
Add support for pixel as a pseudo-English unit.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1753 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
6d7a17e9b6
commit
c3fab7200e
@ -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(
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user