public static Rectangle WrapDomClientRect(nsIDOMClientRect domRect)
		{
			var r = new Rectangle(
				(int)domRect.GetLeftAttribute(),
				(int)domRect.GetTopAttribute(),
				(int)domRect.GetWidthAttribute(),
				(int)domRect.GetHeightAttribute());
			return r;
		}
Beispiel #2
0
        /// <summary>
        /// Returns an array containing all bounding rectangles within the element.
        /// </summary>
        /// <returns></returns>
        public RectangleF [] GetClientRects()
        {
            nsIDOMNSElement      ns    = (nsIDOMNSElement)DomElement;
            nsIDOMClientRectList rects = ns.GetClientRects();

            RectangleF [] result = new RectangleF[rects.GetLength()];
            for (int i = 0; i < result.Length; i++)
            {
                nsIDOMClientRect rect = rects.Item(i);
                result[i] = RectangleF.FromLTRB(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
            }
            return(result);
        }
        /// <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);
        }
Beispiel #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);
        }
Beispiel #5
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);
        }