CSS-Orientation

 view release on metacpan or  search on metacpan

lib/CSS/Orientation.pm  view on Meta::CPAN

                                                                          $POSSIBLY_NEGATIVE_QUANTITY_SPACE,
                                                                          $POSSIBLY_NEGATIVE_QUANTITY );



# Compile the cursor resize regexes
our $CURSOR_EAST_RE = resprintf( $LOOKBEHIND_NOT_LETTER . '([ns]?)e-resize' );
our $CURSOR_WEST_RE = resprintf( $LOOKBEHIND_NOT_LETTER . '([ns]?)w-resize' );

# Matches the condition where we need to replace the horizontal component
# of a background-position value when expressed in horizontal percentage.
# Had to make two regexes because in the case of position-x there is only
# one quantity, and otherwise we don't want to match and change cases with only
# one quantity.
our $BG_HORIZONTAL_PERCENTAGE_RE = resprintf( q'background(-position)?(%s:%s)' .
                                         q'([^%%]*?)(%s)%%' .
                                         q'(%s(?:%s|top|center|bottom))', $WHITESPACE,
                                                                           $WHITESPACE,
                                                                           $NUM,
                                                                           $WHITESPACE,
                                                                           $POSSIBLY_NEGATIVE_QUANTITY );

our $BG_HORIZONTAL_PERCENTAGE_X_RE = resprintf( q'background-position-x(%s:%s)' .
                                           q'(%s)%%', $WHITESPACE,
                                                       $WHITESPACE,
                                                       $NUM );
# Non-percentage units used for CSS lengths
our $LENGTH_UNIT = q'(?:em|ex|px|cm|mm|in|pt|pc)';
# To make sure the lone 0 is not just starting a number (like "02") or a percentage like ("0 %")
our $LOOKAHEAD_END_OF_ZERO = sprintf( '(?![0-9]|%s%%)', $WHITESPACE );
# A length with a unit specified. Matches "0" too, as it's a length, not a percentage.
our $LENGTH = sprintf( '(?:-?%s(?:%s%s)|0+%s)', $NUM,
                                    $WHITESPACE,
                                    $LENGTH_UNIT,
                                    $LOOKAHEAD_END_OF_ZERO );

# Zero length. Used in the replacement functions.
our $ZERO_LENGTH = resprintf( q'(?:-?0+(?:%s%s)|0+%s)$', $WHITESPACE,
                                                      $LENGTH_UNIT,
                                                      $LOOKAHEAD_END_OF_ZERO );



( run in 0.362 second using v1.01-cache-2.11-cpan-624ce96ca49 )