Class CssPropertyNormalizer


  • class CssPropertyNormalizer
    extends java.lang.Object
    Utilities class with functionality to normalize CSS properties.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.regex.Pattern URL_PATTERN  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static int appendQuotedString​(java.lang.StringBuilder buffer, java.lang.String source, int start)
      Appends quoted string.
      private static int appendUrlContent​(java.lang.StringBuilder buffer, java.lang.String source, int start)
      Appends url content and end parenthesis if url is correct.
      (package private) static java.lang.String normalize​(java.lang.String str)
      Normalize a property.
      private static boolean trimSpaceAfter​(char ch)
      Checks if spaces can be trimmed after a specific character.
      private static boolean trimSpaceBefore​(char ch)
      Checks if spaces can be trimmed before a specific character.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • URL_PATTERN

        private static final java.util.regex.Pattern URL_PATTERN
    • Constructor Detail

      • CssPropertyNormalizer

        CssPropertyNormalizer()
    • Method Detail

      • normalize

        static java.lang.String normalize​(java.lang.String str)
        Normalize a property.
        Parameters:
        str - the property
        Returns:
        the normalized property
      • appendQuotedString

        private static int appendQuotedString​(java.lang.StringBuilder buffer,
                                              java.lang.String source,
                                              int start)
        Appends quoted string.
        Parameters:
        buffer - the current buffer
        source - a source
        start - where to start in the source. Should point at quote symbol.
        Returns:
        the new position in the source
      • appendUrlContent

        private static int appendUrlContent​(java.lang.StringBuilder buffer,
                                            java.lang.String source,
                                            int start)
        Appends url content and end parenthesis if url is correct.
        Parameters:
        buffer - the current buffer
        source - a source
        start - where to start in the source. Should point at first symbol after "url(".
        Returns:
        the new position in the source
      • trimSpaceAfter

        private static boolean trimSpaceAfter​(char ch)
        Checks if spaces can be trimmed after a specific character.
        Parameters:
        ch - the character
        Returns:
        true, if spaces can be trimmed after the character
      • trimSpaceBefore

        private static boolean trimSpaceBefore​(char ch)
        Checks if spaces can be trimmed before a specific character.
        Parameters:
        ch - the character
        Returns:
        true, if spaces can be trimmed before the character