C# Class SharpVectors.Dom.Css.CssPrimitiveValue

The CSSPrimitiveValue interface represents a single CSS value.

This interface may be used to determine the value of a specific style property currently set in a block or to set a specific style property explicitly within the block. An instance of this interface might be obtained from the getPropertyCSSValue method of the CSSStyleDeclaration interface. A CSSPrimitiveValue object only occurs in a context of a CSS property.

Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. (For example, a pixel value cannot be converted to a centimeter value.) Percentage values can't be converted since they are relative to the parent value (or another property value). There is one exception for color percentage values: since a color percentage value is relative to the range 0-255, a color percentage value can be converted to a number; (see also the RGBColor interface).

Inheritance: CssValue, ICssPrimitiveValue
显示文件 Open project: codebutler/savagesvg Class Usage Examples

Protected Properties

Property Type Description
colorValue RgbColor
floatValue double

Public Methods

Method Description
GetAbsoluteValue ( string propertyName, XmlElement elm ) : CssValue
GetCounterValue ( ) : SharpVectors.Dom.Css.ICounter

This method is used to get the Counter value. If this CSS value doesn't contain a counter value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Counter interface

GetFloatValue ( CssPrimitiveType unitType ) : double

This method is used to get a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised

GetRectValue ( ) : SharpVectors.Dom.Css.IRect

This method is used to get the Rect value. If this CSS value doesn't contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface.

GetRgbColorValue ( ) : SharpVectors.Dom.Css.IRgbColor

This method is used to get the RGB color. If this CSS value doesn't contain a RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface.

GetStringValue ( ) : string

This method is used to get the string value. If the CSS value doesn't contain a string value, a DOMException is raised. Note: Some properties (like 'font-family' or 'voice-family') convert a whitespace separated list of idents to a string.

SetFloatValue ( CssPrimitiveType unitType, double floatValue ) : void

A method to set the float value with a specified unit. If the property attached with this value can not accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised.

SetStringValue ( CssPrimitiveType stringType, string stringValue ) : void

A method to set the string value with the specified unit. If the property attached to this value can't accept the specified unit or the string value, the value will be unchanged and a DOMException will be raised.

Protected Methods

Method Description
CssPrimitiveValue ( ) : System

Only for internal use

CssPrimitiveValue ( string cssText, bool readOnly ) : System
_setCssText ( string cssText ) : void
_setFloatValue ( double floatValue ) : void
_setFloatValue ( string floatValue ) : void
_setType ( CssPrimitiveType type ) : void

Private Methods

Method Description
Create ( Match match, bool readOnly ) : CssPrimitiveValue
CssPrimitiveValue ( Match match, bool readOnly ) : System

Constructor called by CssValue.GetCssValue()

Method Details

CssPrimitiveValue() protected method

Only for internal use
protected CssPrimitiveValue ( ) : System
return System

CssPrimitiveValue() protected method

protected CssPrimitiveValue ( string cssText, bool readOnly ) : System
cssText string
readOnly bool
return System

GetAbsoluteValue() public method

public GetAbsoluteValue ( string propertyName, XmlElement elm ) : CssValue
propertyName string
elm System.Xml.XmlElement
return CssValue

GetCounterValue() public method

This method is used to get the Counter value. If this CSS value doesn't contain a counter value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Counter interface
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Counter value (e.g. this is not CSS_COUNTER).
public GetCounterValue ( ) : SharpVectors.Dom.Css.ICounter
return SharpVectors.Dom.Css.ICounter

GetFloatValue() public method

This method is used to get a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float value.
public GetFloatValue ( CssPrimitiveType unitType ) : double
unitType CssPrimitiveType A unit code to get the float value. The unit code can only be a float unit type (i.e. CSS_NUMBER, CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS, CSS_S, CSS_HZ, CSS_KHZ, CSS_DIMENSION).
return double

GetRectValue() public method

This method is used to get the Rect value. If this CSS value doesn't contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface.
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a rect value.
public GetRectValue ( ) : SharpVectors.Dom.Css.IRect
return SharpVectors.Dom.Css.IRect

GetRgbColorValue() public method

This method is used to get the RGB color. If this CSS value doesn't contain a RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface.
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a rgb value.
public GetRgbColorValue ( ) : SharpVectors.Dom.Css.IRgbColor
return SharpVectors.Dom.Css.IRgbColor

GetStringValue() public method

This method is used to get the string value. If the CSS value doesn't contain a string value, a DOMException is raised. Note: Some properties (like 'font-family' or 'voice-family') convert a whitespace separated list of idents to a string.
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string value.
public GetStringValue ( ) : string
return string

SetFloatValue() public method

A method to set the float value with a specified unit. If the property attached with this value can not accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised.
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float value. NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
public SetFloatValue ( CssPrimitiveType unitType, double floatValue ) : void
unitType CssPrimitiveType A unit code as defined above. The unit code can only be a float unit type (i.e. CSS_NUMBER, CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS, CSS_S, CSS_HZ, CSS_KHZ, CSS_DIMENSION).
floatValue double The new float value.
return void

SetStringValue() public method

A method to set the string value with the specified unit. If the property attached to this value can't accept the specified unit or the string value, the value will be unchanged and a DOMException will be raised.
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string value. NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
public SetStringValue ( CssPrimitiveType stringType, string stringValue ) : void
stringType CssPrimitiveType A string code as defined above. The string code can only be a string unit type (i.e. CSS_STRING, CSS_URI, CSS_IDENT, and CSS_ATTR).
stringValue string The new string value
return void

_setCssText() protected method

protected _setCssText ( string cssText ) : void
cssText string
return void

_setFloatValue() protected method

protected _setFloatValue ( double floatValue ) : void
floatValue double
return void

_setFloatValue() protected method

protected _setFloatValue ( string floatValue ) : void
floatValue string
return void

_setType() protected method

protected _setType ( CssPrimitiveType type ) : void
type CssPrimitiveType
return void

Property Details

colorValue protected_oe property

protected RgbColor colorValue
return RgbColor

floatValue protected_oe property

protected double floatValue
return double