From 50e49c917de395687530318eb09f8dc3560a7bd7 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Tue, 27 Mar 2012 12:34:31 +1300 Subject: [PATCH] MDL-32081 csslib: Improved handling of parentheses when processing styles --- lib/csslib.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/csslib.php b/lib/csslib.php index 03d728c289c..5fc0f9b16ab 100644 --- a/lib/csslib.php +++ b/lib/csslib.php @@ -638,6 +638,13 @@ class css_optimiser { } switch ($char) { case ';': + if ($inparenthesis) { + $buffer .= $char; + // continue 1: The switch processing chars + // continue 2: The switch processing the state + // continue 3: The for loop + continue 3; + } $currentrule->add_style($buffer); $buffer = ''; $inquotes = false; @@ -656,6 +663,21 @@ class css_optimiser { $this->rawrules++; $buffer = ''; $inquotes = false; + $inparenthesis = false; + // continue 1: The switch processing chars + // continue 2: The switch processing the state + // continue 3: The for loop + continue 3; + case '(': + $inparenthesis = true; + $buffer .= $char; + // continue 1: The switch processing chars + // continue 2: The switch processing the state + // continue 3: The for loop + continue 3; + case ')': + $inparenthesis = false; + $buffer .= $char; // continue 1: The switch processing chars // continue 2: The switch processing the state // continue 3: The for loop