private void validateCss()

in java/io/bazel/rules/closure/webfiles/WebfilesValidator.java [131:170]


  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
              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;
              }
            });
  }