Package org.w3c.dom.css

Examples of org.w3c.dom.css.CSSStyleSheet


     * @return The parsed {@code CSSStyleSheet} or an initialized but empty
     *         {@code CSSStyleSheetImpl} if the parsing was unsuccessful.
     */
    private static CSSStyleSheet getStyleSheet(final File cssFile) {

        CSSStyleSheet sheet = null;
        final InputSource source = new InputSource(cssFile.toURI().toString());
        try {
            sheet = new CSSOMParser().parseStyleSheet(source, null, null);
        } catch (final IOException e) {
            LOG.error("IOException while reading {}", cssFile, e);
View Full Code Here


  }
 
  AttributeRuleList getRuleList(InputStream stream) throws IOException {
    InputSource source = new InputSource(new InputStreamReader(stream));
        CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
        CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null);
        CSSRuleList ruleList = stylesheet.getCssRules();
       
        return new AttributeRuleList(ruleList);
  }
View Full Code Here

    /**
     * Returns the user-agent stylesheet.
     */
    public CSSStyleSheet getUserAgentStyleSheet() {
        CSSStyleSheet result = null;

        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            String uri = url.toString();
            result = createCSSStyleSheet("User Agent Style Sheet", "all");
View Full Code Here

        }
    }
    break;
      case CSSRule.IMPORT_RULE:
    CSSImportRule ir = (CSSImportRule)rule;
    CSSStyleSheet   is = ir.getStyleSheet();
    if (is != null) {
        addMatchingRules(is.getCssRules(), e, pe, rl);
    }
    break;
      case CSSRule.MEDIA_RULE:
    CSSMediaRule mr = (CSSMediaRule)rule;
    if (mediaMatch(mr.getMedia())) {
View Full Code Here

     *
     * @param source the source from which to retrieve the CSS to be parsed
     * @return the stylesheet parsed from the specified input source
     */
    private CSSStyleSheet parseCSS(final InputSource source) {
        CSSStyleSheet ss;
        try {
            final ErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler();
            final CSSOMParser parser = new CSSOMParser(new SACParserCSS21());
            parser.setErrorHandler(errorHandler);
            ss = parser.parseStyleSheet(source, null, null);
View Full Code Here

     */
    public Stylesheet jsxGet_styleSheet() {
        if (importedStylesheet_ == null) {
            final Stylesheet owningSheet = this.jsxGet_parentStyleSheet();
            final HTMLElement ownerNode = owningSheet.jsxGet_ownerNode();
            final CSSStyleSheet importedStylesheet = getImportRule().getStyleSheet();
            importedStylesheet_ = new Stylesheet(ownerNode, importedStylesheet, owningSheet.getUri());
        }
        return importedStylesheet_;
    }
View Full Code Here

        final HtmlStyle style = (HtmlStyle) getDomNodeOrDie();
        final String css = style.getTextContent();

        final Cache cache = getWindow().getWebWindow().getWebClient().getCache();
        final CSSStyleSheet cached = cache.getCachedStyleSheet(css);
        final String uri = getDomNodeOrDie().getPage().getWebResponse().getRequestSettings()
        .getUrl().toExternalForm();
        if (cached != null) {
            sheet_ = new Stylesheet(this, cached, uri);
        }
View Full Code Here

        Reader r = new InputStreamReader(new URL(this.cssUrl).openStream());
         
          CSSOMParser parser = new CSSOMParser();
            InputSource is = new InputSource(r);

            CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
            CSSRuleList rules = stylesheet.getCssRules();

            for (int i = 0; i < rules.getLength(); i++) {
                CSSRule rule = rules.item(i);
                list.add(rule);
            }
View Full Code Here

    /**
     * Returns the user-agent stylesheet.
     */
    public CSSStyleSheet getUserAgentStyleSheet() {
        CSSStyleSheet result = null;

        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            String uri = url.toString();
            result = createCSSStyleSheet("User Agent Style Sheet", "all");
View Full Code Here

        }
    }
    break;
      case CSSRule.IMPORT_RULE:
    CSSImportRule ir = (CSSImportRule)rule;
    CSSStyleSheet   is = ir.getStyleSheet();
    if (is != null) {
        addMatchingRules(is.getCssRules(), e, pe, rl);
    }
    break;
      case CSSRule.MEDIA_RULE:
    CSSMediaRule mr = (CSSMediaRule)rule;
    if (mediaMatch(mr.getMedia())) {
View Full Code Here

TOP

Related Classes of org.w3c.dom.css.CSSStyleSheet

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.