internal static GeckoNode OldCreateWrapper(nsIDOMNode domObject)
        {
            if (domObject == null)
            {
                return(null);
            }
            nsIDOMHTMLElement element = Xpcom.QueryInterface <nsIDOMHTMLElement>(domObject);

            if (element != null)
            {
                return(GeckoElement.Create(element));
            }

            nsIDOMAttr attr = Xpcom.QueryInterface <nsIDOMAttr>(domObject);

            if (attr != null)
            {
                return(GeckoAttribute.CreateAttributeWrapper(attr));
            }

            nsIDOMComment comment = domObject as nsIDOMComment;

            if (comment != null)
            {
                return(GeckoComment.CreateCommentWrapper(comment));
            }

            return(new GeckoNode(domObject));
        }
Example #2
0
        /// <summary>
        /// Creates wrapper for nsIDOMNode object
        /// </summary>
        /// <param name="domObject"></param>
        /// <returns></returns>
        internal static GeckoNode CreateDomNodeWrapper(mozIDOMWindowProxy window, nsIDOMNode domObject)
        {
            // if null -> return null
            if (domObject == null)
            {
                return(null);
            }
            var nodeType = (NodeType) new WebIDL.Node((mozIDOMWindowProxy)window, (nsISupports)domObject).NodeType;

            // by nodeType we can find proper wrapper faster, than perform QueryInterface
            switch (nodeType)
            {
            case NodeType.Element:
                /* /* nsIDOMHTMLElement*/ nsIDOMElement htmlElement = Xpcom.QueryInterface </* /* nsIDOMHTMLElement*/ nsIDOMElement>(domObject);
                if (htmlElement != null)
                {
                    return(GeckoHtmlElement.Create(window, htmlElement));
                }
                nsIDOMElement element = Xpcom.QueryInterface <nsIDOMElement>(domObject);
                if (element != null)
                {
                    return(GeckoElement.CreateDomElementWrapper(window, element));
                }
                break;

            case NodeType.Attribute:
#if PORTFF60
                nsIDOMAttr attr = Xpcom.QueryInterface <nsIDOMAttr>(domObject);
                if (attr != null)
                {
                    return(GeckoAttribute.CreateAttributeWrapper(attr));
                }
#endif
                break;

            case NodeType.Comment:
                nsIDOMComment comment = Xpcom.QueryInterface <nsIDOMComment>(domObject);
                if (comment != null)
                {
                    return(GeckoComment.CreateCommentWrapper(window, comment));
                }
                break;

            case NodeType.DocumentFragment:
                nsIDOMDocumentFragment fragment = Xpcom.QueryInterface <nsIDOMDocumentFragment>(domObject);
                if (fragment != null)
                {
                    return(DOM.DocumentFragment.CreateDocumentFragmentWrapper(window, fragment));
                }
                break;
            }
            // if we don't handle this type - just create GeckoNode
            return(new GeckoNode(window, domObject));
        }
Example #3
0
        /// <summary>
        /// Creates wrapper for nsIDOMNode object
        /// </summary>
        /// <param name="domObject"></param>
        /// <returns></returns>
        internal static GeckoNode CreateDomNodeWrapper(nsIDOMNode domObject)
        {
            // if null -> return null
            if (domObject == null)
            {
                return(null);
            }
            var nodeType = (NodeType)domObject.GetNodeTypeAttribute();

            // by nodeType we can find proper wrapper faster, than perform QueryInterface
            switch (nodeType)
            {
            case NodeType.Element:
                nsIDOMHTMLElement htmlElement = Xpcom.QueryInterface <nsIDOMHTMLElement>(domObject);
                if (htmlElement != null)
                {
                    return(GeckoHtmlElement.Create(htmlElement));
                }
                nsIDOMElement element = Xpcom.QueryInterface <nsIDOMElement>(domObject);
                if (element != null)
                {
                    return(GeckoElement.CreateDomElementWrapper(element));
                }
                break;

            case NodeType.Attribute:
                nsIDOMAttr attr = Xpcom.QueryInterface <nsIDOMAttr>(domObject);
                if (attr != null)
                {
                    return(GeckoAttribute.CreateAttributeWrapper(attr));
                }
                break;

            case NodeType.Comment:
                nsIDOMComment comment = Xpcom.QueryInterface <nsIDOMComment>(domObject);
                if (comment != null)
                {
                    return(GeckoComment.CreateCommentWrapper(comment));
                }
                break;

            case NodeType.DocumentFragment:
                nsIDOMDocumentFragment fragment = Xpcom.QueryInterface <nsIDOMDocumentFragment>(domObject);
                if (fragment != null)
                {
                    return(DOM.DocumentFragment.CreateDocumentFragmentWrapper(fragment));
                }
                break;
            }
            // if we don't handle this type - just create GeckoNode
            return(new GeckoNode(domObject));
        }
        internal static GeckoNode CreateNodeWrapper(nsIDOMNode domObject)
        {
            // if null -> return null
            if (domObject == null)
            {
                return(null);
            }
            var nodeType = ( NodeType )domObject.GetNodeTypeAttribute();

            // by nodeType we can find proper wrapper faster, than perform QueryInterface
            switch (nodeType)
            {
            case NodeType.Element:
                nsIDOMHTMLElement element = Xpcom.QueryInterface <nsIDOMHTMLElement>(domObject);
                if (element != null)
                {
                    return(GeckoElement.Create(element));
                }
                break;

            case NodeType.Attribute:
                nsIDOMAttr attr = Xpcom.QueryInterface <nsIDOMAttr>(domObject);
                if (attr != null)
                {
                    return(GeckoAttribute.CreateAttributeWrapper(attr));
                }
                break;

            case NodeType.Comment:
                nsIDOMComment comment = Xpcom.QueryInterface <nsIDOMComment>(domObject);
                if (comment != null)
                {
                    return(GeckoComment.CreateCommentWrapper(comment));
                }
                break;

            case NodeType.DocumentFragment:
                nsIDOMDocumentFragment fragment = Xpcom.QueryInterface <nsIDOMDocumentFragment>(domObject);
                if (fragment != null)
                {
                    return(DOM.DocumentFragment.CreateDocumentFragmentWrapper(fragment));
                }
                break;
            }
            // if fast method is unsuccessful try old method :)
            return(OldCreateWrapper(domObject));
        }
Example #5
0
 internal static GeckoComment CreateCommentWrapper(mozIDOMWindowProxy window, nsIDOMComment comment)
 {
     return((comment == null) ? null : new GeckoComment(window, comment));
 }
Example #6
0
 internal GeckoComment(mozIDOMWindowProxy window, nsIDOMComment comment)
     : base(window, comment)
 {
     DomComment = comment;
 }
        public static nsIDOMComment GetProxy(Mono.WebBrowser.IWebBrowser control, nsIDOMComment obj)
        {
            object o = Base.GetProxyForObject(control, typeof(nsIDOMComment).GUID, obj);

            return(o as nsIDOMComment);
        }
Example #8
0
		private DomComment(nsIDOMComment domComment)
			: base(domComment)
		{
			Debug.Assert(domComment != null);
			m_DomComment = domComment;
		}
Example #9
0
		internal static DomComment Create(nsIDOMComment domComment)
		{
			return domComment != null ? new DomComment(domComment) : null;
		}
Example #10
0
 internal static GeckoComment CreateCommentWrapper(nsIDOMComment comment)
 {
     return (comment == null) ? null : new GeckoComment(comment);
 }
Example #11
0
 internal GeckoComment(nsIDOMComment comment)
     : base(comment)
 {
     DomComment = comment;
 }
Example #12
0
 internal static GeckoComment Create(nsIDOMComment comment)
 {
     return((comment == null) ? null : new GeckoComment(comment));
 }
Example #13
0
 internal GeckoComment(nsIDOMComment comment)
     : base(comment)
 {
     DomComment = comment;
 }
Example #14
0
		public static nsIDOMComment GetProxy (Mono.WebBrowser.IWebBrowser control, nsIDOMComment obj)
		{
			object o = Base.GetProxyForObject (control, typeof(nsIDOMComment).GUID, obj);
			return o as nsIDOMComment;
		}