List of usage examples for com.google.common.css.compiler.passes PassRunner PassRunner
public PassRunner(JobDescription job, ErrorManager errorManager)
From source file:io.bazel.rules.closure.webfiles.WebfilesValidator.java
private void validateCss(final Path path, final Webpath origin, String source) { CssTree stylesheet = cssParser.parse(path.toString(), source); new PassRunner(new JobDescriptionBuilder().getJobDescription(), new BasicErrorManager() { @Override//from w ww . j a v a 2s . co m public void print(String message) { WebfilesValidator.this.errors.put(CSS_VALIDATION_ERROR, String.format("%s: %s", path, message)); } }).runPasses(stylesheet); stylesheet.getVisitController().startVisit(new DefaultTreeVisitor() { private boolean inUrlFunction; @Override public boolean enterFunctionNode(CssFunctionNode function) { return (inUrlFunction = function.getFunction().getFunctionName().equals("url")); } @Override public void leaveFunctionNode(CssFunctionNode value) { inUrlFunction = false; } @Override public boolean enterArgumentNode(CssValueNode argument) { if (inUrlFunction) { String uri = nullToEmpty(argument.getValue()); if (!shouldIgnoreUri(uri)) { addRelationship(path, origin, Webpath.get(uri)); } } return false; } }); }