Inheritance: CssPrimitiveLengthValue
Exemple #1
0
 public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal, string defaultValue)
     : this(ownerElement, propertyName, SvgLengthSource.String, direction, defaultValue)
 {
     if(baseVal == null || baseVal.Length == 0)
     {
         baseVal = defaultValue;
     }
     baseVal = SvgNumber.ScientificToDec(baseVal);
     cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
 }
Exemple #2
0
        public SvgLength(string propertyName, string baseVal, string defaultValue, SvgElement ownerElement, SvgLengthDirection direction)
        {
            this.ownerElement = ownerElement;
            this.direction = direction;

            if (baseVal == null || baseVal.Length == 0)
            {
                baseVal = defaultValue;
            }

            baseVal = SvgNumber.ScientificToDec(baseVal);

            this.cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
        }
Exemple #3
0
        private void getCssXmlValue()
        {
            if(source == SvgLengthSource.Css)
            {
                ICssStyleDeclaration csd = this.ownerElement.GetComputedStyle(String.Empty);
                CssPrimitiveLengthValue cssValue = csd.GetPropertyCssValue(propertyName) as CssPrimitiveLengthValue;

                if(cssValue != null)
                {
                    cssLength = new CssAbsPrimitiveLengthValue(cssValue, propertyName, ownerElement);
                }
                else
                {
                    throw new DomException(DomExceptionType.SyntaxErr, "Not a length value");
                }
            }
            else
            {
                string baseVal = ownerElement.GetAttribute(propertyName);

                if(baseVal == null || baseVal.Length == 0)
                {
                    baseVal = defaultValue;
                }
                baseVal = SvgNumber.ScientificToDec(baseVal);
                cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
            }
        }
Exemple #4
0
        public SvgLength(string propertyName, SvgStyleableElement ownerElement, SvgLengthDirection direction, string defaultValue)
        {
            this.ownerElement = ownerElement;
            this.direction = direction;

            string baseVal = ownerElement.GetPropertyValue(propertyName);
            if (baseVal == null || baseVal == "")
            {
                baseVal = defaultValue;
            }

            baseVal = SvgNumber.ScientificToDec(baseVal);

            this.cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
        }