From 246fc8946a83475d856516831abd42ac307ddd37 Mon Sep 17 00:00:00 2001 From: zema Date: Mon, 5 Sep 2016 10:45:58 +0300 Subject: [PATCH] css properties: min-width, max-width, min-height, max-height --- composer.json | 3 +++ library/HTMLPurifier/CSSDefinition.php | 4 ++++ tests/HTMLPurifier/AttrDef/CSSTest.php | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/composer.json b/composer.json index 2f59d0fe..80fee3db 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,9 @@ "require": { "php": ">=5.2" }, + "require-dev": { + "simpletest/simpletest": "^1.1" + }, "autoload": { "psr-0": { "HTMLPurifier": "library/" }, "files": ["library/HTMLPurifier.composer.php"] diff --git a/library/HTMLPurifier/CSSDefinition.php b/library/HTMLPurifier/CSSDefinition.php index a99172d4..47dfd1f6 100644 --- a/library/HTMLPurifier/CSSDefinition.php +++ b/library/HTMLPurifier/CSSDefinition.php @@ -225,6 +225,10 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition ); $max = $config->get('CSS.MaxImgLength'); + $this->info['min-width'] = + $this->info['max-width'] = + $this->info['min-height'] = + $this->info['max-height'] = $this->info['width'] = $this->info['height'] = $max === null ? diff --git a/tests/HTMLPurifier/AttrDef/CSSTest.php b/tests/HTMLPurifier/AttrDef/CSSTest.php index da2ab6b0..3ec19c76 100644 --- a/tests/HTMLPurifier/AttrDef/CSSTest.php +++ b/tests/HTMLPurifier/AttrDef/CSSTest.php @@ -61,6 +61,10 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness $this->assertDef('width:50px;'); $this->assertDef('width:auto;'); $this->assertDef('width:-50px;', false); + $this->assertDef('min-width:50%;'); + $this->assertDef('min-width:50px;'); + $this->assertDef('min-width:auto;'); + $this->assertDef('min-width:-50px;', false); $this->assertDef('text-decoration:underline;'); $this->assertDef('font-family:sans-serif;'); $this->assertDef("font-family:Gill, 'Times New Roman', sans-serif;");