From 2d3862484c7e5f1424a5151022ee07f19bd1628a Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 2 Feb 2012 16:31:42 +0000 Subject: [PATCH] Fix bug in CSSJanus where background-position and background-position-x weren't flipped if negative values were given. Trevor found this by running the original CSSJanus test suite against his NodeJS port; I should port the test suite to PHPUnit some time --- includes/libs/CSSJanus.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/libs/CSSJanus.php b/includes/libs/CSSJanus.php index e6940ea8ce..c8fc296b32 100644 --- a/includes/libs/CSSJanus.php +++ b/includes/libs/CSSJanus.php @@ -113,8 +113,8 @@ class CSSJanus { $patterns['four_notation_color'] = "/(-color\s*:\s*){$patterns['color']}(\s+){$patterns['color']}(\s+){$patterns['color']}(\s+){$patterns['color']}/i"; // The two regexes below are parenthesized differently then in the original implementation to make the // callback's job more straightforward - $patterns['bg_horizontal_percentage'] = "/(background(?:-position)?\s*:\s*[^%]*?)({$patterns['num']})(%\s*(?:{$patterns['quantity']}|{$patterns['ident']}))/"; - $patterns['bg_horizontal_percentage_x'] = "/(background-position-x\s*:\s*)({$patterns['num']})(%)/"; + $patterns['bg_horizontal_percentage'] = "/(background(?:-position)?\s*:\s*[^%]*?)(-?{$patterns['num']})(%\s*(?:{$patterns['quantity']}|{$patterns['ident']}))/"; + $patterns['bg_horizontal_percentage_x'] = "/(background-position-x\s*:\s*)(-?{$patterns['num']})(%)/"; } /** -- 2.20.1