public static Rectangle WrapDomClientRect(nsIDOMClientRect domRect)
		{
			var r = new Rectangle(
				(int)domRect.GetLeftAttribute(),
				(int)domRect.GetTopAttribute(),
				(int)domRect.GetWidthAttribute(),
				(int)domRect.GetHeightAttribute());
			return r;
		}
        /// <summary>
        /// UI specific implementation extension method GetBoundingClientRect()
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static System.Windows.Int32Rect GetBoundingClientRectInt32(this GeckoElement element)
        {
            nsIDOMClientRect domRect = element.DOMElement.GetBoundingClientRect();

            if (domRect == null)
            {
                return(System.Windows.Int32Rect.Empty);
            }
            var r = new System.Windows.Int32Rect(
                ( int )domRect.GetLeftAttribute(),
                ( int )domRect.GetTopAttribute(),
                ( int )domRect.GetWidthAttribute(),
                ( int )domRect.GetHeightAttribute());

            return(r);
        }
Example #3
0
        /// <summary>
        /// UI specific implementation extension method GetBoundingClientRect()
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static System.Drawing.Rectangle GetBoundingClientRect(this GeckoElement element)
        {
            nsIDOMClientRect domRect = element.DOMElement.GetBoundingClientRect();

            if (domRect == null)
            {
                return(Rectangle.Empty);
            }
            var r = new Rectangle(
                ( int )domRect.GetLeftAttribute(),
                ( int )domRect.GetTopAttribute(),
                ( int )domRect.GetWidthAttribute(),
                ( int )domRect.GetHeightAttribute());

            Marshal.ReleaseComObject(domRect);
            return(r);
        }
Example #4
0
        public Rectangle GetItemRectangle(int index)
        {
            Rectangle itemRectangle = this.ClientRectangle;             // Default

            if (!((_browser == null) || (_browser.Document == null)))
            {
                string id      = index.ToString() + "-1";
                var    content = (GeckoLIElement)_browser.Document.GetElementById(id);
                if (content != null)
                {
                    nsIDOMClientRect domRect = content.DOMHtmlElement.GetBoundingClientRect();
                    itemRectangle = new Rectangle((int)domRect.GetLeftAttribute(), (int)domRect.GetTopAttribute(), (int)domRect.GetWidthAttribute(), (int)domRect.GetHeightAttribute());
                }
            }
            return(itemRectangle);
        }