mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 16:31:53 +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 ENGLISH = 1;
|
||||||
const METRIC = 2;
|
const METRIC = 2;
|
||||||
|
const DIGITAL = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Units information array. Units are grouped into measuring systems
|
* Units information array. Units are grouped into measuring systems
|
||||||
@ -21,9 +22,10 @@ class HTMLPurifier_UnitConverter
|
|||||||
*/
|
*/
|
||||||
protected static $units = array(
|
protected static $units = array(
|
||||||
self::ENGLISH => array(
|
self::ENGLISH => array(
|
||||||
'pt' => 1,
|
'px' => 3, // This is as per CSS 2.1 and Firefox. Your mileage may vary
|
||||||
'pc' => 12,
|
'pt' => 4,
|
||||||
'in' => 72,
|
'pc' => 48,
|
||||||
|
'in' => 288,
|
||||||
self::METRIC => array('pt', '0.352777778', 'mm'),
|
self::METRIC => array('pt', '0.352777778', 'mm'),
|
||||||
),
|
),
|
||||||
self::METRIC => array(
|
self::METRIC => array(
|
||||||
|
@ -56,6 +56,9 @@ class HTMLPurifier_UnitConverterTest extends HTMLPurifier_Harness
|
|||||||
$this->assertConversion('1pt', '0.01389in');
|
$this->assertConversion('1pt', '0.01389in');
|
||||||
$this->assertConversion('1.000pt', '0.01389in');
|
$this->assertConversion('1.000pt', '0.01389in');
|
||||||
$this->assertConversion('100000pt', '1389in');
|
$this->assertConversion('100000pt', '1389in');
|
||||||
|
|
||||||
|
$this->assertConversion('1in', '96px');
|
||||||
|
$this->assertConversion('96px', '1in');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testMetric() {
|
function testMetric() {
|
||||||
|
Loading…
Reference in New Issue
Block a user