Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/css/CSSRule.java
86410 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* This file is available under and governed by the GNU General Public26* License version 2 only, as published by the Free Software Foundation.27* However, the following notice accompanied the original version of this28* file and, per its terms, should not be removed:29*30* Copyright (c) 2000 World Wide Web Consortium,31* (Massachusetts Institute of Technology, Institut National de32* Recherche en Informatique et en Automatique, Keio University). All33* Rights Reserved. This program is distributed under the W3C's Software34* Intellectual Property License. This program is distributed in the35* hope that it will be useful, but WITHOUT ANY WARRANTY; without even36* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR37* PURPOSE.38* See W3C License http://www.w3.org/Consortium/Legal/ for more details.39*/4041package org.w3c.dom.css;4243import org.w3c.dom.DOMException;4445/**46* The <code>CSSRule</code> interface is the abstract base interface for any47* type of CSS statement. This includes both rule sets and at-rules. An48* implementation is expected to preserve all rules specified in a CSS style49* sheet, even if the rule is not recognized by the parser. Unrecognized50* rules are represented using the <code>CSSUnknownRule</code> interface.51* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.52* @since DOM Level 253*/54public interface CSSRule {55// RuleType56/**57* The rule is a <code>CSSUnknownRule</code>.58*/59public static final short UNKNOWN_RULE = 0;60/**61* The rule is a <code>CSSStyleRule</code>.62*/63public static final short STYLE_RULE = 1;64/**65* The rule is a <code>CSSCharsetRule</code>.66*/67public static final short CHARSET_RULE = 2;68/**69* The rule is a <code>CSSImportRule</code>.70*/71public static final short IMPORT_RULE = 3;72/**73* The rule is a <code>CSSMediaRule</code>.74*/75public static final short MEDIA_RULE = 4;76/**77* The rule is a <code>CSSFontFaceRule</code>.78*/79public static final short FONT_FACE_RULE = 5;80/**81* The rule is a <code>CSSPageRule</code>.82*/83public static final short PAGE_RULE = 6;8485/**86* The type of the rule, as defined above. The expectation is that87* binding-specific casting methods can be used to cast down from an88* instance of the <code>CSSRule</code> interface to the specific89* derived interface implied by the <code>type</code>.90*/91public short getType();9293/**94* The parsable textual representation of the rule. This reflects the95* current state of the rule and not its initial value.96*/97public String getCssText();98/**99* The parsable textual representation of the rule. This reflects the100* current state of the rule and not its initial value.101* @exception DOMException102* SYNTAX_ERR: Raised if the specified CSS string value has a syntax103* error and is unparsable.104* <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string105* value represents a different type of rule than the current one.106* <br>HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at107* this point in the style sheet.108* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.109*/110public void setCssText(String cssText)111throws DOMException;112113/**114* The style sheet that contains this rule.115*/116public CSSStyleSheet getParentStyleSheet();117118/**119* If this rule is contained inside another rule (e.g. a style rule120* inside an @media block), this is the containing rule. If this rule is121* not nested inside any other rules, this returns <code>null</code>.122*/123public CSSRule getParentRule();124125}126127128