Examples of CSSParser


Examples of com.google.caja.parser.css.CssParser

        Parser parser = finder.makeJsParser(cp, mq);
        if (parser.getTokenQueue().isEmpty()) { return new Block(p); }
        return parser.parse();
      }
      case CSS: {
        CssParser parser = finder.makeCssParser(cp, mq);
        if (source.getNodeType() == Node.ELEMENT_NODE) {
          if (parser.getTokenQueue().isEmpty()) {
            return new CssTree.StyleSheet(
                p, Collections.<CssTree.CssStatement>emptyList());
          }
          return parser.parseStyleSheet();
        } else {
          if (parser.getTokenQueue().isEmpty()) {
            return new CssTree.DeclarationGroup(
                p, Collections.<CssTree.Declaration>emptyList());
          }
          return parser.parseDeclarationGroup();
        }
      }
      default: throw new SomethingWidgyHappenedError(type.toString());
    }
  }
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

            return null;
        }

        StyleValue value;
        try {
            CSSParser parser =
                    CSSParserFactory.getDefaultInstance().createStrictParser();
            value = parser.parseStyleValue(styleProperty, textValue);
        } catch (IllegalStateException ise) {
            value = STYLE_VALUE_FACTORY.getInvalid(textValue);
        }

        return value;
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

            return null;
        }

        StyleValue value;
        try {
            CSSParser parser = CSSParserFactory.getDefaultInstance().
                    createStrictParser();
            value = parser.parseStyleValue(styleProperty, textValue);
        } catch (IllegalStateException ise) {
            value = STYLE_VALUE_FACTORY.getInvalid(textValue);
        }

        if (value != null) {
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

        };
        return attributes;
    }

    private StylingEngine createStylingEngine(String css) {
        CSSParser parser =
                CSSParserFactory.getDefaultInstance().createStrictParser();
        StyleSheet styleSheet = parser.parseStyleSheet(new StringReader(css),
                null);

        StylingFactory factory = StylingFactory.getDefaultInstance();

        CompilerConfiguration configuration = factory.createCompilerConfiguration();
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

    private StylingEngine createStylingEngine(
            Reader reader,
            final FunctionResolver functionResolverMock) {

        CSSParserFactory factory = CSSParserFactory.getDefaultInstance();
        CSSParser parser = factory.createStrictParser();
        StyleSheet styleSheet = parser.parseStyleSheet(reader, null);

        StylingFactory stylingFactory = StylingFactory.getDefaultInstance();
        CompilerConfiguration configuration =
                stylingFactory.createCompilerConfiguration();
        configuration.setSource(StyleSheetSource.THEME);
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

     * @param property The property whose value is required.
     * @param css The css representation of the value.
     * @return The style value.
     */
    public static StyleValue getStyleValue(StyleProperty property, String css) {
        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
        return parser.parseStyleValue(property, css);
    }
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

     * @param property The property whose value is required.
     * @param css The css representation of the value.
     * @return The style value.
     */
    public static PropertyValue getPropertyValue(StyleProperty property, String css) {
        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
        return parser.parsePropertyValue(property, css);
    }
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

     *
     * @deprecated Use {@link #getCompleteStyles(String)}
     */
    public static Styles getStyles(String cssValues, boolean specified) {

        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();

        // Create a new styled element.
        Styles styles = new StylesImpl();
        if (cssValues != null) {

            String selectorBlock = null;
            String pseudoSelectorBlock = null;
            // Determine if there are multiple selector rules to be
            // parsed and what type they are (i.e. pseudo or standard)
            if (cssValues.indexOf('{') == -1) {
                // No pseudoselector rules were specified
                selectorBlock = cssValues;
            } else if ('{' == cssValues.charAt(0)) {
                // Both standard and pseudoselector rules were specified
                int index = cssValues.indexOf("}");
                selectorBlock = cssValues.substring(1, index);
                pseudoSelectorBlock = cssValues.substring(index + 1);
            } else {
                // No standard selector rules were specified
                pseudoSelectorBlock = cssValues;
            }

            // Put the standard selector rules onto the styled element
            if (selectorBlock != null) {
                // Parse the values into a properties object.
                StyleProperties properties = parser.parseDeclarations(
                        selectorBlock);

                // Translate that to a property values object.
                setComputedValuesFromProperties(styles, properties, specified);
            }
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser


        // Parse the expected selectors (to canonicalise them).
        List expectedSelectorList = null;
        try {
            CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
            expectedSelectorList = parser.parseSelectorGroup(
                            expectedSelectors);
        } catch (IllegalArgumentException e) {
            Assert.fail("Error occurred during parsing: " + expectedSelectors);
        }
View Full Code Here

Examples of com.volantis.mcs.css.parser.CSSParser

     */
    protected RuntimeDeviceTheme createRuntimeDeviceTheme() {

        String css = getCSS();

        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
        StyleSheet styleSheet = parser.parseStyleSheet(new StringReader(css), null);

        return RuntimeDeviceLayoutTestHelper.activate(styleSheet);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.