public void setCssText(String cssText) throws DOMException { if (_parentStyleSheet != null && _parentStyleSheet.isReadOnly()) { throw new DOMExceptionImpl( DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMExceptionImpl.READ_ONLY_STYLE_SHEET); } 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) { _ident = ((CSSPageRuleImpl) r)._ident; _pseudoPage = ((CSSPageRuleImpl) r)._pseudoPage; _style = ((CSSPageRuleImpl) r)._style; } else { throw new DOMExceptionImpl( DOMException.INVALID_MODIFICATION_ERR, DOMExceptionImpl.EXPECTING_PAGE_RULE); } } catch (CSSException e) { throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, e.getMessage()); } catch (IOException e) { throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, e.getMessage()); } }
/** * isUnused. * * @return a boolean. */ public boolean isUnused() { for (CSSRule rule : cssRules) { if (!rule.isUnused()) { return false; } } return true; }
/** * isRedundant. * * @return a boolean. */ public boolean isRedundant() { for (CSSRule rule : cssRules) { if (!rule.isRedundant()) { return false; } } return true; }