Package com.helger.css.decl.visit
Class CSSVisitor
java.lang.Object
com.helger.css.decl.visit.CSSVisitor
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 Summary
Modifier and TypeMethodDescriptionstatic voidvisitAllDeclarations(IHasCSSDeclarations<?> aHasDeclarations, ICSSVisitor aVisitor) Visit all declarations contained in the passed declaration container.static voidvisitAllDeclarationUrls(IHasCSSDeclarations<?> aCSS, ICSSUrlVisitor aVisitor) Visit all items that can contain URLs in CSS files.static voidvisitCSS(CascadingStyleSheet aCSS, 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.static voidvisitCSSUrl(CascadingStyleSheet aCSS, ICSSUrlVisitor aVisitor) Visit all items that can contain URLs in CSS files.static voidvisitFontFaceRule(CSSFontFaceRule aFontFaceRule, ICSSVisitor aVisitor) Visit all elements of a single font-face rule.static voidvisitImportRule(CSSImportRule aImportRule, ICSSVisitor aVisitor) Visit all elements of a single import rule.static voidvisitKeyframesRule(CSSKeyframesRule aKeyframesRule, ICSSVisitor aVisitor) Visit all elements of a single keyframes rule.static voidvisitMediaRule(CSSMediaRule aMediaRule, ICSSVisitor aVisitor) Visit all elements of a single media rule.static voidvisitNamespaceRule(CSSNamespaceRule aNamespaceRule, ICSSVisitor aVisitor) Visit all elements of a single namespace rule.static voidvisitPageRule(CSSPageRule aPageRule, ICSSVisitor aVisitor) Visit all elements of a single page rule.static voidvisitStyleRule(CSSStyleRule aStyleRule, ICSSVisitor aVisitor) Visit all elements of a single style rule.static voidvisitSupportsRule(CSSSupportsRule aSupportsRule, ICSSVisitor aVisitor) Visit all elements of a single supports rule.static voidvisitTopLevelRule(ICSSTopLevelRule aTopLevelRule, ICSSVisitor aVisitor) Visit all elements of a single top-level rule.static voidvisitUnknownRule(CSSUnknownRule aUnknownRule, ICSSVisitor aVisitor) Visit all elements of a single unknown @ rule.static voidvisitViewportRule(CSSViewportRule aViewportRule, ICSSVisitor aVisitor) Visit all elements of a single viewport rule.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to be invoked on each declaration. May not benull.
-
visitStyleRule
Visit all elements of a single style rule.- Parameters:
aStyleRule- The style rule to visit. May not benull.aVisitor- The visitor to use. May not benull.
-
visitPageRule
Visit all elements of a single page rule.- Parameters:
aPageRule- The page rule to visit. May not benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
visitMediaRule
Visit all elements of a single media rule.- Parameters:
aMediaRule- The media rule to visit. May not benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
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 benull.aVisitor- The visitor to use. May not benull.
-
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@importand@namespacerules.- Parameters:
aTopLevelRule- The top-level rule to visit. May not benull.aVisitor- The visitor to use. May not benull.
-
visitCSS
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 benull.aVisitor- The callback to be invoked for each element found. May not benull.
-
visitCSSUrl
Visit all items that can contain URLs in CSS files. Therefore the special visitor classCSSVisitorForUrlis used.- Parameters:
aCSS- The CSS to visit. May not benull.aVisitor- The callback to invoke for each found occurrence. May not benull.- 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 classCSSVisitorForUrlis used.- Parameters:
aCSS- The CSS to visit. May not benull.aVisitor- The callback to invoke for each found occurrence. May not benull.
-