Inheritance: ICssRule
 /// <summary>
 /// Constructor for CssStyleSheet
 /// </summary>
 /// <param name="ownerNode">The node that owns this stylesheet. E.g. used for getting the BaseUri</param>
 /// <param name="href">The URL of the stylesheet</param>
 /// <param name="title">The title of the stylesheet</param>
 /// <param name="media">List of medias for the stylesheet</param>
 /// <param name="ownerRule">The rule (e.g. ImportRule) that referenced this stylesheet</param>
 /// <param name="origin">The type of stylesheet</param>
 public CssStyleSheet(XmlNode ownerNode, string href, string title, string media, 
     CssRule ownerRule, CssStyleSheetType origin)
     : base(ownerNode, href, "text/css", title, media)
 {
     Origin = origin;
     this.ownerRule = ownerRule;
 }
        public CssStyleDeclaration(string css, CssRule parentRule, bool readOnly, CssStyleSheetType origin)
        {
            _origin = origin;
            _readOnly = readOnly;
            _parentRule = parentRule;

            parseString(css);
        }
Example #3
0
 protected CssRule(object parent, bool readOnly, string[] replacedStrings, CssStyleSheetType origin)
 {
     if(parent is CssRule)
     {
         _ParentRule = (CssRule)parent;
     }
     else if(parent is CssStyleSheet)
     {
         _ParentStyleSheet = (CssStyleSheet)parent;
     }
     else
     {
         throw new Exception("The CssRule constructor can only take a CssRule or CssStyleSheet as it's second argument " + parent.GetType());
     }
     Origin = origin;
     ReplacedStrings = replacedStrings;
     ReadOnly = readOnly;
 }
Example #4
0
 internal ulong InsertRule(CssRule rule)
 {
     return InsertRule(rule, Length);
 }
Example #5
0
        internal ulong InsertRule(CssRule rule, ulong index)
        {
            /* TODO:
             * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index e.g. if an @import rule is inserted after a standard rule set or other at-rule.
             * SYNTAX_ERR: Raised if the specified rule has a syntax error and is unparsable
            */

            if(ReadOnly) throw new DomException(DomExceptionType.NoModificationAllowedErr);

            if(index > Length || index<0) throw new DomException(DomExceptionType.IndexSizeErr);

            if(index == Length)
            {
                cssRules.Add(rule);
            }
            else
            {
                cssRules.Insert((int) index, rule);
            }

            return index;
        }