Examples of CSSRule


Examples of org.w3c.dom.css.CSSRule

        }

        try {
            InputSource is = new InputSource(new StringReader(cssText));
            CSSOMParser parser = new CSSOMParser();
            CSSRule r = parser.parseRule(is);

            // The rule must be a page rule
            if (r.getType() == CSSRule.PAGE_RULE) {
                this.ident = ((CSSPageRuleImpl)r).ident;
                this.pseudoPage = ((CSSPageRuleImpl)r).pseudoPage;
                this.style = ((CSSPageRuleImpl)r).style;
            } else {
                throw new DOMExceptionImpl(
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

        }

        try {
            InputSource is = new InputSource(new StringReader(cssText));
            CSSOMParser parser = new CSSOMParser();
            CSSRule r = parser.parseRule(is);

            // The rule must be a charset rule
            if (r.getType() == CSSRule.CHARSET_RULE) {
                this.encoding = ((CSSCharsetRuleImpl)r).encoding;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
                    DOMExceptionImpl.EXPECTING_CHARSET_RULE);
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

        }

        try {
            InputSource is = new InputSource(new StringReader(cssText));
            CSSOMParser parser = new CSSOMParser();
            CSSRule r = parser.parseRule(is);

            // The rule must be a style rule
            if (r.getType() == CSSRule.STYLE_RULE) {
                this.selectors = ((CSSStyleRuleImpl)r).selectors;
                this.style = ((CSSStyleRuleImpl)r).style;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

        }

        try {
            InputSource is = new InputSource(new StringReader(cssText));
            CSSOMParser parser = new CSSOMParser();
            CSSRule r = parser.parseRule(is);

            // The rule must be an import rule
            if (r.getType() == CSSRule.IMPORT_RULE) {
                this.href = ((CSSImportRuleImpl)r).href;
                this.media = ((CSSImportRuleImpl)r).media;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

        try {
            InputSource is = new InputSource(new StringReader(rule));
            CSSOMParser parser = new CSSOMParser();
            parser.setParentStyleSheet(this);
            CSSRule r = parser.parseRule(is);

            if (getCssRules().getLength() > 0) {

                // We need to check that this type of rule can legally go into
                // the requested position.
                int msg = -1;
                if (r.getType() == CSSRule.CHARSET_RULE) {

                    // Index must be 0, and there can be only one charset rule
                    if (index != 0) {
                        msg = DOMExceptionImpl.CHARSET_NOT_FIRST;
                    } else if (getCssRules().item(0).getType()
                            == CSSRule.CHARSET_RULE) {
                        msg = DOMExceptionImpl.CHARSET_NOT_UNIQUE;
                    }
                } else if (r.getType() == CSSRule.IMPORT_RULE) {

                    // Import rules must preceed all other rules (except
                    // charset rules)
                    if (index <= getCssRules().getLength()) {
                        for (int i = 0; i < index; i++) {
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

    public void importImports(boolean recursive)
        throws DOMException
    {
        for (int i = 0; i < this.getCssRules().getLength(); i++)
        {
            CSSRule cssRule = this.getCssRules().item(i);
            if (cssRule.getType() == CSSRule.IMPORT_RULE)
            {
                CSSImportRule cssImportRule = (CSSImportRule) cssRule;
                try
                {
                    java.net.URI importURI = new java.net.URI(this.getBaseUri())
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

        }

        try {
            InputSource is = new InputSource(new StringReader(cssText));
            CSSOMParser parser = new CSSOMParser();
            CSSRule r = parser.parseRule(is);

            // The rule must be a font face rule
            if (r.getType() == CSSRule.FONT_FACE_RULE) {
                this.style = ((CSSFontFaceRuleImpl)r).style;
            } else {
                throw new DOMExceptionImpl(
                    DOMException.INVALID_MODIFICATION_ERR,
                    DOMExceptionImpl.EXPECTING_FONT_FACE_RULE);
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

        final CSSRuleList rules = getWrappedSheet().getCssRules();
        if (rules == null) {
            return;
        }
        for (int i = 0; i < rules.getLength(); i++) {
            final CSSRule rule = rules.item(i);
            if (rule.getType() == CSSRule.STYLE_RULE) {
                final CSSStyleRuleImpl styleRule = (CSSStyleRuleImpl) rule;
                final SelectorList selectors = styleRule.getSelectors();
                for (int j = 0; j < selectors.getLength(); j++) {
                    final Selector selector = selectors.item(j);
                    final boolean selected = selects(selector, e);
                    if (selected) {
                        final org.w3c.dom.css.CSSStyleDeclaration dec = styleRule.getStyle();
                        style.applyStyleFromSelector(dec, selector);
                    }
                }
            }
            else if (rule.getType() == CSSRule.IMPORT_RULE) {
                final CSSImportRuleImpl importRule = (CSSImportRuleImpl) rule;
                Stylesheet sheet = imports_.get(importRule);
                if (sheet == null) {
                    // TODO: surely wrong: in which case is it null and why?
                    final String uri = (uri_ != null) ? uri_
View Full Code Here

Examples of org.w3c.dom.css.CSSRule

            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

Examples of org.w3c.dom.css.CSSRule

            Element e,
            String pe,
            CSSOMRuleList rl) {
  int llen = l.getLength();
  for (int i = 0; i < llen; i++) {
      CSSRule rule = l.item(i);
      switch (rule.getType()) {
      case CSSRule.STYLE_RULE:
    CSSOMStyleRule sr = (CSSOMStyleRule)rule;
    SelectorList sl = sr.getSelectors();
    int slen = sl.getLength();
    for (int j = 0; j < slen; j++) {
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.