Ejemplo n.º 1
0
  public CssClassesVisitor(Rule rule, HtmlRuleContext context, List<Hint> hints)
      throws IOException {
    this.context = context;
    this.hints = hints;
    this.rule = rule;

    referredFiles = context.getCssDependenciesGraph().getAllReferedFiles();
    classes = context.getCssIndex().findAllClassDeclarations();
    classes2files = createReversedMap(classes);
  }
Ejemplo n.º 2
0
 @Override
 protected void run(HtmlRuleContext context, List<Hint> result) {
   try {
     HtmlParserResult parserResult = context.getHtmlParserResult();
     CssClassesVisitor visitor = new CssClassesVisitor(this, context, result);
     ElementUtils.visitChildren(parserResult.root(), visitor, ElementType.OPEN_TAG);
   } catch (IOException ioe) {
     Exceptions.printStackTrace(ioe);
   }
 }
Ejemplo n.º 3
0
 private static OffsetRange getAttributeValueOffsetRange(Attribute attr, HtmlRuleContext context) {
   boolean quoted = attr.isValueQuoted();
   int from = attr.valueOffset() + (quoted ? 1 : 0);
   int to = from + attr.unquotedValue().length();
   return EmbeddingUtil.convertToDocumentOffsets(from, to, context.getSnapshot());
 }