Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/css/CSSStyleDeclaration.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>CSSStyleDeclaration</code> interface represents a single CSS47* declaration block. This interface may be used to determine the style48* properties currently set in a block or to set style properties explicitly49* within the block.50* <p> While an implementation may not recognize all CSS properties within a51* CSS declaration block, it is expected to provide access to all specified52* properties in the style sheet through the <code>CSSStyleDeclaration</code>53* interface. Furthermore, implementations that support a specific level of54* CSS should correctly handle CSS shorthand properties for that level. For55* a further discussion of shorthand properties, see the56* <code>CSS2Properties</code> interface.57* <p> This interface is also used to provide a read-only access to the58* computed values of an element. See also the <code>ViewCSS</code>59* interface. The CSS Object Model doesn't provide an access to the60* specified or actual values of the CSS cascade.61* <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>.62* @since DOM Level 263*/64public interface CSSStyleDeclaration {65/**66* The parsable textual representation of the declaration block67* (excluding the surrounding curly braces). Setting this attribute will68* result in the parsing of the new value and resetting of all the69* properties in the declaration block including the removal or addition70* of properties.71*/72public String getCssText();73/**74* The parsable textual representation of the declaration block75* (excluding the surrounding curly braces). Setting this attribute will76* result in the parsing of the new value and resetting of all the77* properties in the declaration block including the removal or addition78* of properties.79* @exception DOMException80* SYNTAX_ERR: Raised if the specified CSS string value has a syntax81* error and is unparsable.82* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is83* readonly or a property is readonly.84*/85public void setCssText(String cssText)86throws DOMException;8788/**89* Used to retrieve the value of a CSS property if it has been explicitly90* set within this declaration block.91* @param propertyName The name of the CSS property. See the CSS92* property index.93* @return Returns the value of the property if it has been explicitly94* set for this declaration block. Returns the empty string if the95* property has not been set.96*/97public String getPropertyValue(String propertyName);9899/**100* Used to retrieve the object representation of the value of a CSS101* property if it has been explicitly set within this declaration block.102* This method returns <code>null</code> if the property is a shorthand103* property. Shorthand property values can only be accessed and modified104* as strings, using the <code>getPropertyValue</code> and105* <code>setProperty</code> methods.106* @param propertyName The name of the CSS property. See the CSS107* property index.108* @return Returns the value of the property if it has been explicitly109* set for this declaration block. Returns <code>null</code> if the110* property has not been set.111*/112public CSSValue getPropertyCSSValue(String propertyName);113114/**115* Used to remove a CSS property if it has been explicitly set within116* this declaration block.117* @param propertyName The name of the CSS property. See the CSS118* property index.119* @return Returns the value of the property if it has been explicitly120* set for this declaration block. Returns the empty string if the121* property has not been set or the property name does not correspond122* to a known CSS property.123* @exception DOMException124* NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly125* or the property is readonly.126*/127public String removeProperty(String propertyName)128throws DOMException;129130/**131* Used to retrieve the priority of a CSS property (e.g. the132* <code>"important"</code> qualifier) if the priority has been133* explicitly set in this declaration block.134* @param propertyName The name of the CSS property. See the CSS135* property index.136* @return A string representing the priority (e.g.137* <code>"important"</code>) if the property has been explicitly set138* in this declaration block and has a priority specified. The empty139* string otherwise.140*/141public String getPropertyPriority(String propertyName);142143/**144* Used to set a property value and priority within this declaration145* block. <code>setProperty</code> permits to modify a property or add a146* new one in the declaration block. Any call to this method may modify147* the order of properties in the <code>item</code> method.148* @param propertyName The name of the CSS property. See the CSS149* property index.150* @param value The new value of the property.151* @param priority The new priority of the property (e.g.152* <code>"important"</code>) or the empty string if none.153* @exception DOMException154* SYNTAX_ERR: Raised if the specified value has a syntax error and is155* unparsable.156* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is157* readonly or the property is readonly.158*/159public void setProperty(String propertyName,160String value,161String priority)162throws DOMException;163164/**165* The number of properties that have been explicitly set in this166* declaration block. The range of valid indices is 0 to length-1167* inclusive.168*/169public int getLength();170171/**172* Used to retrieve the properties that have been explicitly set in this173* declaration block. The order of the properties retrieved using this174* method does not have to be the order in which they were set. This175* method can be used to iterate over all properties in this declaration176* block.177* @param index Index of the property name to retrieve.178* @return The name of the property at this ordinal position. The empty179* string if no property exists at this position.180*/181public String item(int index);182183/**184* The CSS rule that contains this declaration block or <code>null</code>185* if this <code>CSSStyleDeclaration</code> is not attached to a186* <code>CSSRule</code>.187*/188public CSSRule getParentRule();189190}191192193