示例#1
0
        public override void HandleAttributeChange(XmlAttribute attribute)
        {
            if (attribute.NamespaceURI.Length == 0)
            {
                switch (attribute.LocalName)
                {
                    case "x":
                        _x = null;
                        return;
                    case "y":
                        _y = null;
                        return;
                    case "width":
                        _width = null;
                        return;
                    case "height":
                        _height = null;
                        return;
                }
            }
            else if (attribute.NamespaceURI == SvgDocument.XLinkNamespace)
            {
                switch (attribute.LocalName)
                {
                    case "href":
                        _instanceRoot = null;
                        break;
                }
            }

            base.HandleAttributeChange(attribute);
        }
示例#2
0
 public SvgElementInstance(XmlNode refNode, SvgUseElement useElement, SvgElementInstance parent)
 {
     correspondingUseElement = (ISvgUseElement)useElement;
     parentNode = (SvgElementInstance)parent;
     correspondingElement = (ISvgElement)refNode;
     eventTarget = new EventTarget(this);
 }
示例#3
0
 public SvgElementInstance(XmlNode refNode, SvgUseElement useElement, SvgElementInstance parent)
 {
     _correspondingUseElement = useElement;
     _parentNode           = parent;
     _correspondingElement = refNode as ISvgElement;
     _eventTarget          = new EventTarget(this);
 }
 public SvgElementInstance(XmlNode refNode, SvgUseElement useElement, SvgElementInstance parent)
 {
     correspondingUseElement = (ISvgUseElement)useElement;
     parentNode           = (SvgElementInstance)parent;
     correspondingElement = (ISvgElement)refNode;
     eventTarget          = new EventTarget(this);
 }
示例#5
0
 internal void SetPreviousSibling(ISvgElementInstance instance)
 {
     previousSibling = instance;
 }
示例#6
0
 internal void SetNextSibling(ISvgElementInstance instance)
 {
     nextSibling = instance;
 }
示例#7
0
 public JsSvgElementInstance(ISvgElementInstance baseObject, ISvgScriptEngine engine)
     : base(baseObject, engine)
 {
 }
示例#8
0
 internal void SetNextSibling(ISvgElementInstance instance)
 {
     _nextSibling = instance;
 }
示例#9
0
 internal void SetPreviousSibling(ISvgElementInstance instance)
 {
     _previousSibling = instance;
 }
示例#10
0
        public override void HandleAttributeChange(XmlAttribute attribute)
        {
            if (attribute.NamespaceURI.Length == 0)
            {
                switch (attribute.LocalName)
                {
                    case "x":
                        x = null;
                        return;
                    case "y":
                        y = null;
                        return;
                    case "width":
                        width = null;
                        return;
                    case "height":
                        height = null;
                        return;
                }
            }
            else if (attribute.NamespaceURI == SvgDocument.XLinkNamespace)
            {
                switch (attribute.LocalName)
                {
                    case "href":
                        instanceRoot = null;
                        break;
                }
            }

            base.HandleAttributeChange(attribute);
        }
示例#11
0
        public bool DispatchEvent(
            IEvent @event)
        {
            if (@event.Type == null || @event.Type == "")
            {
                throw new EventException(EventExceptionCode.UnspecifiedEventTypeErr);
            }
            try
            {
                // The actual target may be an SvgElement or an SvgElementInstance from
                // a conceptual tree <see href="http://www.w3.org/TR/SVG/struct.html#UseElement"/>
                XmlNode             currNode     = null;
                ISvgElementInstance currInstance = null;

                if (this.eventTarget is ISvgElementInstance)
                {
                    currInstance = (ISvgElementInstance)this.eventTarget;
                }
                else
                {
                    currNode = (XmlNode)this.eventTarget;
                }

                // We can't use an XPath ancestor axe because we must account for
                // conceptual nodes
                ancestors.Clear();

                // Buid the ancestors from the conceptual tree
                if (currInstance != null)
                {
                    while (currInstance.ParentNode != null)
                    {
                        currInstance = currInstance.ParentNode;
                        ancestors.Add(currInstance);
                    }
                    currNode = (XmlNode)currInstance.CorrespondingUseElement;
                    ancestors.Add(currNode);
                }

                // Build actual ancestors
                while (currNode != null && currNode.ParentNode != null)
                {
                    currNode = currNode.ParentNode;
                    ancestors.Add(currNode);
                }


                Event realEvent = (Event)@event;
                realEvent.eventTarget = this.eventTarget;

                if (!realEvent.stopped)
                {
                    realEvent.eventPhase = EventPhase.CapturingPhase;

                    for (int i = ancestors.Count - 1; i >= 0; i--)
                    {
                        if (realEvent.stopped)
                        {
                            break;
                        }

                        IEventTarget ancestor = ancestors[i] as IEventTarget;

                        if (ancestor != null)
                        {
                            realEvent.currentTarget = ancestor;

                            if (ancestor is IEventTargetSupport)
                            {
                                ((IEventTargetSupport)ancestor).FireEvent(realEvent);
                            }
                        }
                    }
                }

                if (!realEvent.stopped)
                {
                    realEvent.eventPhase    = EventPhase.AtTarget;
                    realEvent.currentTarget = this.eventTarget;
                    this.eventTarget.FireEvent(realEvent);
                }

                if (!realEvent.stopped)
                {
                    realEvent.eventPhase = EventPhase.BubblingPhase;

                    for (int i = 0; i < ancestors.Count; i++)
                    {
                        if (realEvent.stopped)
                        {
                            break;
                        }

                        IEventTarget ancestor = ancestors[i] as IEventTarget;

                        if (ancestor != null)
                        {
                            realEvent.currentTarget = ancestor;
                            ((IEventTargetSupport)ancestor).FireEvent(realEvent);
                        }
                    }
                }

                return(realEvent.stopped);
            }
            catch (InvalidCastException)
            {
                throw new DomException(DomExceptionType.WrongDocumentErr);
            }
        }