Example #1
0
        /// <summary>Adds an alias for the given CSS property to the given target.
        /// A numeric target, e.g. 1, means that inner index of this property, which is a set.</summary>
        protected void Alias(string name, ValueAxis axis, params int[] target)
        {
            CssPropertyAlias alias = new CssPropertyAlias(this, target);

            alias.Axis = axis;
            AddAlias(name, alias);
        }
Example #2
0
        private void AddAlias(string name, CssPropertyAlias alias)
        {
            alias.RelativeTo = RelativeTo;

            alias.Name = name;
            CssProperties.All[name] = alias;

            // Add to property set:
            int index = alias.Index[0];

            if (index == -1)
            {
                // Logical - don't add.
                return;
            }

            if (AliasedProperties == null)
            {
                AliasedProperties = new List <CssProperty>();
            }

            if (AliasedProperties.Count == index)
            {
                // Just add it - most of the time it'll fall in here.
                AliasedProperties.Add(alias);
                return;
            }

            // Grow the aliased properties set if it's not currently big enough:
            for (int x = AliasedProperties.Count; x <= index; x++)
            {
                AliasedProperties.Add(null);
            }

            AliasedProperties[index] = alias;
        }