Package com.google.caja.plugin

Examples of com.google.caja.plugin.CssRewriter


        CssValidator v = new CssValidator(cssSchema, htmlSchema, mq)
            .withInvalidNodeMessageLevel(MessageLevel.WARNING);
        v.validateCss(AncestorChain.instance(decls));
        // The rewriter will remove any unsafe constructs.
        // and put URLs in the proper filename namespace
        new CssRewriter(meta.getUriPolicy(), cssSchema, htmlSchema, mq)
            .withInvalidNodeMessageLevel(MessageLevel.WARNING)
            .rewrite(AncestorChain.instance(decls));
        new CssDynamicExpressionRewriter(meta).rewriteCss(decls);
        ArrayConstructor jsValue = CssDynamicExpressionRewriter.cssToJs(decls);
View Full Code Here


  public boolean apply(Jobs jobs) {
    // TODO(mikesamuel): build up a list of classes and ids for use in
    // generating "no such symbol" warnings from the GXPs/HTML.
    CssValidator v = new CssValidator(
        cssSchema, htmlSchema, jobs.getMessageQueue());
    CssRewriter rw = new CssRewriter(
        jobs.getPluginMeta().getUriPolicy(), cssSchema, htmlSchema,
        jobs.getMessageQueue());

    for (MessageLevel level : new MessageLevel[] {
           // First try to remove unsafe constructs with warnings.
           MessageLevel.WARNING,
           // If there are still problems, error out.
           MessageLevel.ERROR
         }) {
      v.withInvalidNodeMessageLevel(level);
      rw.withInvalidNodeMessageLevel(level);
      for (JobEnvelope env : jobs.getJobsByType(ContentType.CSS)) {
        if (env.fromCache) { continue; }
        validate(v, rw, AncestorChain.instance((CssTree) env.job.getRoot()));
      }
    }
View Full Code Here

        CssValidator v = new CssValidator(cssSchema, htmlSchema, mq)
            .withInvalidNodeMessageLevel(MessageLevel.WARNING);
        v.validateCss(AncestorChain.instance(decls));
        // The rewriter will remove any unsafe constructs.
        // and put URLs in the proper filename namespace
        new CssRewriter(meta.getUriPolicy(), cssSchema, mq)
            .withInvalidNodeMessageLevel(MessageLevel.WARNING)
            .rewrite(AncestorChain.instance(decls));
        new CssDynamicExpressionRewriter(meta).rewriteCss(decls);
        ArrayConstructor jsValue = CssDynamicExpressionRewriter.cssToJs(decls);
View Full Code Here

  public boolean apply(Jobs jobs) {
    // TODO(mikesamuel): build up a list of classes and ids for use in
    // generating "no such symbol" warnings from the GXPs/HTML.
    CssValidator v = new CssValidator(
        cssSchema, htmlSchema, jobs.getMessageQueue());
    CssRewriter rw = new CssRewriter(
        jobs.getPluginMeta().getUriPolicy(), cssSchema,
        jobs.getMessageQueue());

    for (MessageLevel level : new MessageLevel[] {
           // First try to remove unsafe constructs with warnings.
           MessageLevel.WARNING,
           // If there are still problems, error out.
           MessageLevel.ERROR
         }) {
      v.withInvalidNodeMessageLevel(level);
      rw.withInvalidNodeMessageLevel(level);
      for (JobEnvelope env : jobs.getJobsByType(ContentType.CSS)) {
        if (env.fromCache) { continue; }
        validate(v, rw, AncestorChain.instance((CssTree) env.job.getRoot()));
      }
    }
View Full Code Here

        && HTML_NS.equals(n.getNamespaceURI())) {
      FilePosition pos = Nodes.getFilePositionFor(n);
      if (n.getFirstChild() != null) {
        String text = n.getFirstChild().getNodeValue();
        CssTree.StyleSheet css = css(fromString(text, pos));
        CssRewriter rw = new CssRewriter(
            null, CssSchema.getDefaultCss21Schema(mq), mq);
        rw.rewrite(AncestorChain.instance(css));
        CssDynamicExpressionRewriter rrw =
            new CssDynamicExpressionRewriter(meta);
        rrw.rewriteCss(css);
        assertMessagesLessSevereThan(MessageLevel.ERROR);
        styles.add(new ValidatedStylesheet(
View Full Code Here

TOP

Related Classes of com.google.caja.plugin.CssRewriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.