// niklas@protocol7.com // 100 using System; namespace SharpVectors.Dom.Css { /// /// Internal class that stores a style in a declaration block /// internal sealed class CssStyleBlock { #region Constructors internal CssStyleBlock(string name, string val, string priority, CssStyleSheetType origin) { Name = name.Trim(); Value = val.Trim(); Priority = priority.Trim(); Origin = origin; } internal CssStyleBlock(string name, string val, string priority, int specificity, CssStyleSheetType origin) : this(name, val, priority, origin) { Specificity = specificity; } internal CssStyleBlock(CssStyleBlock style, int specificity, CssStyleSheetType origin) : this(style.Name, style.Value, style.Priority, origin) { Specificity = specificity; } #endregion #region Public properties internal string CssText { get { string ret = Name + ":" + Value; if(Priority != null && Priority.Length > 0) { ret += " !" + Priority; } return ret; } } /// /// The type of the owner stylesheet /// internal CssStyleSheetType Origin; /// /// The property name /// internal string Name; /// /// The value of the style /// internal string Value; /// /// The prioroty of the style, e.g. "important" /// internal string Priority; /// /// The calculated specificity of the owner selector /// internal int Specificity = -1; public CssValue CssValue; #endregion } }