@@ -284,8 +284,8 @@ discard block |
||
| 284 | 284 | // Normalize all whitespace strings to single spaces. Easier to work with that way. |
| 285 | 285 | $css = preg_replace('/\s+/', ' ', $css); |
| 286 | 286 | |
| 287 | - // Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters |
|
| 288 | - $css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css); |
|
| 287 | + // Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters |
|
| 288 | + $css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css); |
|
| 289 | 289 | |
| 290 | 290 | // Shorten & preserve calculations calc(...) since spaces are important |
| 291 | 291 | $css = preg_replace_callback('/calc(\(((?:[^\(\)]+|(?1))*)\))/i', array($this, 'replace_calc'), $css); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | // Add "/" back to fix Opera -o-device-pixel-ratio query |
| 389 | 389 | $css = preg_replace('/'. self::QUERY_FRACTION .'/', '/', $css); |
| 390 | 390 | |
| 391 | - // Replace multiple semi-colons in a row by a single one |
|
| 391 | + // Replace multiple semi-colons in a row by a single one |
|
| 392 | 392 | // See SF bug #1980989 |
| 393 | 393 | $css = preg_replace('/;;+/', ';', $css); |
| 394 | 394 | |
@@ -603,10 +603,10 @@ discard block |
||
| 603 | 603 | return 'calc('. self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - private function preserve_old_IE_specific_matrix_definition($matches) |
|
| 607 | - { |
|
| 608 | - $this->preserved_tokens[] = $matches[1]; |
|
| 609 | - return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
|
| 606 | + private function preserve_old_IE_specific_matrix_definition($matches) |
|
| 607 | + { |
|
| 608 | + $this->preserved_tokens[] = $matches[1]; |
|
| 609 | + return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | private function rgb_to_hex($matches) |
@@ -701,9 +701,15 @@ |
||
| 701 | 701 | private function hue_to_rgb($v1, $v2, $vh) |
| 702 | 702 | { |
| 703 | 703 | $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh); |
| 704 | - if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh; |
|
| 705 | - if ($vh * 2 < 1) return $v2; |
|
| 706 | - if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6; |
|
| 704 | + if ($vh * 6 < 1) { |
|
| 705 | + return $v1 + ($v2 - $v1) * 6 * $vh; |
|
| 706 | + } |
|
| 707 | + if ($vh * 2 < 1) { |
|
| 708 | + return $v2; |
|
| 709 | + } |
|
| 710 | + if ($vh * 3 < 2) { |
|
| 711 | + return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6; |
|
| 712 | + } |
|
| 707 | 713 | return $v1; |
| 708 | 714 | } |
| 709 | 715 | |