Ejemplo n.º 1
0
        private void GetCssXmlValue()
        {
            if (_source == SvgLengthSource.Css)
            {
                ICssStyleDeclaration    csd      = _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);
            }
        }
        private ICssValue getParentStyle(string propertyName)
        {
            CssXmlDocument doc        = _element.OwnerDocument as CssXmlDocument;
            XmlElement     parentNode = _element.ParentNode as XmlElement;

            if (doc != null && parentNode != null)
            {
                ICssStyleDeclaration parentCsd = doc.GetComputedStyle(parentNode, string.Empty);
                if (parentCsd == null)
                {
                    return(null);
                }
                return(parentCsd.GetPropertyCssValue(propertyName));
            }
            return(null);
        }
Ejemplo n.º 3
0
        public virtual ICssValue GetComputedCssValue(string propertyName, string pseudoElt)
        {
            ICssStyleDeclaration csd = GetComputedStyle(pseudoElt);

            return(csd.GetPropertyCssValue(propertyName));
        }