diff --git a/docs/progress.html b/docs/progress.html
index d3faab2d..a5bbf2ba 100644
--- a/docs/progress.html
+++ b/docs/progress.html
@@ -159,7 +159,7 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
100, 200, 300, 400, 500, 600, 700, 800, 900), maybe special code for
in-between integers
letter-spacing | COMPOSITE(<length>, normal) |
-line-height | COMPOSITE(<number>,
+ |
line-height | COMPOSITE(<number>,
<length>, <percentage>, normal) |
list-style-position | ENUM(inside, outside),
Strange behavior in browsers |
@@ -169,21 +169,21 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
CSS 3. Mostly IE lack of support.
list-style | SHORTHAND |
margin | MULTIPLE |
-margin-* | COMPOSITE(<length>,
+ |
margin-* | COMPOSITE(<length>,
<percentage>, auto) |
padding | MULTIPLE |
-padding-* | COMPOSITE(<length>(positive),
+ |
padding-* | COMPOSITE(<length>(positive),
<percentage>(positive)) |
text-align | ENUM(left, right,
center, justify) |
text-decoration | No blink (argh my eyes), not
enum, can be combined (composite sorta): underline, overline,
line-through |
-text-indent | COMPOSITE(<length>,
+ |
text-indent | COMPOSITE(<length>,
<percentage>) |
text-transform | ENUM(capitalize, uppercase,
lowercase, none) |
-width | COMPOSITE(<length>,
+ |
width | COMPOSITE(<length>,
<percentage>, auto), Interesting |
word-spacing | COMPOSITE(<length>, auto),
IE 5 no support |
diff --git a/library/HTMLPurifier/CSSDefinition.php b/library/HTMLPurifier/CSSDefinition.php
index 72eb34fa..105a6797 100644
--- a/library/HTMLPurifier/CSSDefinition.php
+++ b/library/HTMLPurifier/CSSDefinition.php
@@ -86,7 +86,41 @@ class HTMLPurifier_CSSDefinition
new HTMLPurifier_AttrDef_CSSLength()
));
+ $this->info['line-height'] = new HTMLPurifier_AttrDef_Composite(array(
+ new HTMLPurifier_AttrDef_Enum(array('normal')),
+ new HTMLPurifier_AttrDef_Number(true), // no negatives
+ new HTMLPurifier_AttrDef_CSSLength(true),
+ new HTMLPurifier_AttrDef_Percentage(true)
+ ));
+ $this->info['margin-top'] =
+ $this->info['margin-bottom'] =
+ $this->info['margin-left'] =
+ $this->info['margin-right'] = new HTMLPurifier_AttrDef_Composite(array(
+ new HTMLPurifier_AttrDef_CSSLength(),
+ new HTMLPurifier_AttrDef_Percentage(),
+ new HTMLPurifier_AttrDef_Enum(array('auto'))
+ ));
+
+ // non-negative
+ $this->info['padding-top'] =
+ $this->info['padding-bottom'] =
+ $this->info['padding-left'] =
+ $this->info['padding-right'] = new HTMLPurifier_AttrDef_Composite(array(
+ new HTMLPurifier_AttrDef_CSSLength(true),
+ new HTMLPurifier_AttrDef_Percentage(true)
+ ));
+
+ $this->info['text-indent'] = new HTMLPurifier_AttrDef_Composite(array(
+ new HTMLPurifier_AttrDef_CSSLength(),
+ new HTMLPurifier_AttrDef_Percentage()
+ ));
+
+ $this->info['width'] = new HTMLPurifier_AttrDef_Composite(array(
+ new HTMLPurifier_AttrDef_CSSLength(true),
+ new HTMLPurifier_AttrDef_Percentage(true),
+ new HTMLPurifier_AttrDef_Enum(array('auto'))
+ ));
// this could use specialized code
$this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
diff --git a/tests/HTMLPurifier/AttrDef/CSSTest.php b/tests/HTMLPurifier/AttrDef/CSSTest.php
index 36eecfbb..aff1d656 100644
--- a/tests/HTMLPurifier/AttrDef/CSSTest.php
+++ b/tests/HTMLPurifier/AttrDef/CSSTest.php
@@ -34,6 +34,24 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
$this->assertDef('font-size:200%;');
$this->assertDef('font-size:larger;');
$this->assertDef('font-size:12pt;');
+ $this->assertDef('line-height:2;');
+ $this->assertDef('line-height:2em;');
+ $this->assertDef('line-height:20%;');
+ $this->assertDef('line-height:normal;');
+ $this->assertDef('line-height:-20%;', false);
+ $this->assertDef('margin-left:5px;');
+ $this->assertDef('margin-right:20%;');
+ $this->assertDef('margin-top:auto;');
+ $this->assertDef('padding-bottom:5px;');
+ $this->assertDef('padding-top:20%;');
+ $this->assertDef('padding-top:-20%;', false);
+ $this->assertDef('text-indent:3em;');
+ $this->assertDef('text-indent:5%;');
+ $this->assertDef('text-indent:-3em;');
+ $this->assertDef('width:50%;');
+ $this->assertDef('width:50px;');
+ $this->assertDef('width:auto;');
+ $this->assertDef('width:-50px;', false);
// duplicates
$this->assertDef('text-align:right;text-align:left;',