/// <summary>
        /// UI specific implementation extension method GetBoundingClientRect()
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static System.Drawing.Rectangle GetBoundingClientRect(this GeckoElement element)
        {
            var domElement = new WebIDL.Element(element.Window, (nsISupports)element.DOMElement);
            var br         = domElement.GetBoundingClientRect();

            if (br == null)
            {
                return(Rectangle.Empty);
            }
            var rect = new WebIDL.DOMRectReadOnly(element.Window, br);

            return(new Rectangle((int)rect.Left, (int)rect.Top, (int)rect.Width, (int)rect.Height));
        }
Esempio n. 2
0
        internal static GeckoHtmlElement CreateDomHtmlElementWrapper(mozIDOMWindowProxy window, /* /* nsIDOMHTMLElement*/ nsISupports instance)
        {
            var            lowerTagName = new WebIDL.Element((mozIDOMWindowProxy)window, instance).TagName.ToLowerInvariant();
            GeckoClassDesc desc;

            if (_dictionary.TryGetValue(lowerTagName, out desc))
            {
                object HTMLElement = Xpcom.QueryInterface(instance, desc.InterfaceType.GUID);
                if (HTMLElement != null)
                {
                    GeckoHtmlElement e = desc.CreationMethod(window, HTMLElement);
                    return(e);
                }
            }
            return(null);
        }