Class CSSVisitor

java.lang.Object
com.helger.css.decl.visit.CSSVisitor

@Immutable public final class CSSVisitor extends Object
This class is used to walk a CSS domain object and call the respective ICSSVisitor and ICSSUrlVisitor interface methods. Method visitCSS(CascadingStyleSheet, ICSSVisitor) is usually the entry point to iterate over the whole content of a parsed CSS.
Author:
Philip Helger
  • Method Details

    • visitImportRule

      public static void visitImportRule(@Nonnull CSSImportRule aImportRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single import rule.
      Parameters:
      aImportRule - The import rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitNamespaceRule

      public static void visitNamespaceRule(@Nonnull CSSNamespaceRule aNamespaceRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single namespace rule.
      Parameters:
      aNamespaceRule - The namespace rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitAllDeclarations

      public static void visitAllDeclarations(@Nonnull IHasCSSDeclarations<?> aHasDeclarations, @Nonnull ICSSVisitor aVisitor)
      Visit all declarations contained in the passed declaration container.
      Parameters:
      aHasDeclarations - The declarations to be visited. May not be null.
      aVisitor - The visitor to be invoked on each declaration. May not be null.
    • visitStyleRule

      public static void visitStyleRule(@Nonnull CSSStyleRule aStyleRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single style rule.
      Parameters:
      aStyleRule - The style rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitPageRule

      public static void visitPageRule(@Nonnull CSSPageRule aPageRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single page rule.
      Parameters:
      aPageRule - The page rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitFontFaceRule

      public static void visitFontFaceRule(@Nonnull CSSFontFaceRule aFontFaceRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single font-face rule.
      Parameters:
      aFontFaceRule - The font-face rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitMediaRule

      public static void visitMediaRule(@Nonnull CSSMediaRule aMediaRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single media rule.
      Parameters:
      aMediaRule - The media rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitKeyframesRule

      public static void visitKeyframesRule(@Nonnull CSSKeyframesRule aKeyframesRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single keyframes rule.
      Parameters:
      aKeyframesRule - The keyframes rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitViewportRule

      public static void visitViewportRule(@Nonnull CSSViewportRule aViewportRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single viewport rule.
      Parameters:
      aViewportRule - The viewport rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitSupportsRule

      public static void visitSupportsRule(@Nonnull CSSSupportsRule aSupportsRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single supports rule.
      Parameters:
      aSupportsRule - The supports rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitUnknownRule

      public static void visitUnknownRule(@Nonnull CSSUnknownRule aUnknownRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single unknown @ rule.
      Parameters:
      aUnknownRule - The unknown rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitTopLevelRule

      public static void visitTopLevelRule(@Nonnull ICSSTopLevelRule aTopLevelRule, @Nonnull ICSSVisitor aVisitor)
      Visit all elements of a single top-level rule. This includes all rules except @import and @namespace rules.
      Parameters:
      aTopLevelRule - The top-level rule to visit. May not be null.
      aVisitor - The visitor to use. May not be null.
    • visitCSS

      public static void visitCSS(@Nonnull CascadingStyleSheet aCSS, @Nonnull ICSSVisitor aVisitor)
      Visit all CSS elements in the order of their declaration. import rules come first, namespace rules come next and all other top-level rules in the order of their declaration.
      Parameters:
      aCSS - The CSS to visit. May not be null.
      aVisitor - The callback to be invoked for each element found. May not be null.
    • visitCSSUrl

      public static void visitCSSUrl(@Nonnull CascadingStyleSheet aCSS, @Nonnull ICSSUrlVisitor aVisitor)
      Visit all items that can contain URLs in CSS files. Therefore the special visitor class CSSVisitorForUrl is used.
      Parameters:
      aCSS - The CSS to visit. May not be null.
      aVisitor - The callback to invoke for each found occurrence. May not be null.
      See Also:
    • visitAllDeclarationUrls

      public static void visitAllDeclarationUrls(@Nonnull IHasCSSDeclarations<?> aCSS, @Nonnull ICSSUrlVisitor aVisitor)
      Visit all items that can contain URLs in CSS files. Therefore the special visitor class CSSVisitorForUrl is used.
      Parameters:
      aCSS - The CSS to visit. May not be null.
      aVisitor - The callback to invoke for each found occurrence. May not be null.