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
Afficher le fichier Open project: codebutler/savagesvg Class Usage Examples

Protected Properties

Свойство Type Description
colorValue RgbColor
floatValue double

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

Méthode Description
Create ( Match match, bool readOnly ) : CssPrimitiveValue
CssPrimitiveValue ( Match match, bool readOnly ) : System

Constructor called by CssValue.GetCssValue()

Method Details

CssPrimitiveValue() protected méthode

Only for internal use
protected CssPrimitiveValue ( ) : System
Résultat System

CssPrimitiveValue() protected méthode

protected CssPrimitiveValue ( string cssText, bool readOnly ) : System
cssText string
readOnly bool
Résultat System

GetAbsoluteValue() public méthode

public GetAbsoluteValue ( string propertyName, XmlElement elm ) : CssValue
propertyName string
elm System.Xml.XmlElement
Résultat CssValue

GetCounterValue() public méthode

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
Résultat SharpVectors.Dom.Css.ICounter

GetFloatValue() public méthode

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).
Résultat double

GetRectValue() public méthode

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
Résultat SharpVectors.Dom.Css.IRect

GetRgbColorValue() public méthode

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
Résultat SharpVectors.Dom.Css.IRgbColor

GetStringValue() public méthode

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
Résultat string

SetFloatValue() public méthode

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.
Résultat void

SetStringValue() public méthode

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
Résultat void

_setCssText() protected méthode

protected _setCssText ( string cssText ) : void
cssText string
Résultat void

_setFloatValue() protected méthode

protected _setFloatValue ( double floatValue ) : void
floatValue double
Résultat void

_setFloatValue() protected méthode

protected _setFloatValue ( string floatValue ) : void
floatValue string
Résultat void

_setType() protected méthode

protected _setType ( CssPrimitiveType type ) : void
type CssPrimitiveType
Résultat void

Property Details

colorValue protected_oe property

protected RgbColor colorValue
Résultat RgbColor

floatValue protected_oe property

protected double floatValue
Résultat double