File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ public function __construct($sText, Settings $oParserSettings = null) {
43
43
}
44
44
$ this ->oParserSettings = $ oParserSettings ;
45
45
$ this ->blockRules = explode ('/ ' , AtRule::BLOCK_RULES );
46
- $ this ->sizeUnits = explode ('/ ' , Size::ABSOLUTE_SIZE_UNITS .'/ ' .Size::RELATIVE_SIZE_UNITS .'/ ' .Size::NON_SIZE_UNITS );
46
+
47
+ foreach (explode ('/ ' , Size::ABSOLUTE_SIZE_UNITS .'/ ' .Size::RELATIVE_SIZE_UNITS .'/ ' .Size::NON_SIZE_UNITS ) as $ val ) {
48
+ $ size = strlen ($ val );
49
+ if (isset ($ this ->sizeUnits [$ size ])) {
50
+ $ this ->sizeUnits [$ size ][] = $ val ;
51
+ } else {
52
+ $ this ->sizeUnits [$ size ] = array ($ val );
53
+ }
54
+ }
55
+ ksort ($ this ->sizeUnits , SORT_NUMERIC );
47
56
}
48
57
49
58
public function setCharset ($ sCharset ) {
@@ -397,11 +406,12 @@ private function parseNumericValue($bForColor = false) {
397
406
$ sSize .= $ this ->consume (1 );
398
407
}
399
408
}
409
+
400
410
$ sUnit = null ;
401
- foreach ($ this ->sizeUnits as $ sDefinedUnit ) {
402
- if ($ this ->comes ( $ sDefinedUnit , true ) ) {
403
- $ sUnit = $ sDefinedUnit ;
404
- $ this ->consume ($ sDefinedUnit );
411
+ foreach ($ this ->sizeUnits as $ len => $ val ) {
412
+ if (( $ pos = array_search ( $ this ->peek ( $ len ), $ val )) !== false ) {
413
+ $ sUnit = $ val [ $ pos ] ;
414
+ $ this ->consume ($ len );
405
415
break ;
406
416
}
407
417
}
You can’t perform that action at this time.
0 commit comments