private void OnMouseClick(object sender, DomMouseEventArgs e)
        {
            if (!m_blocksDisplayBrowser.Window.Selection.IsCollapsed)
            {
                return;
            }

            GeckoElement geckoElement;

            if (GeckoUtilities.ParseDomEventTargetAsGeckoElement(e.Target, out geckoElement))
            {
                var geckoDivElement = geckoElement as GeckoDivElement;

                while (geckoDivElement != null && !geckoDivElement.ClassName.Contains("block scripture"))
                {
                    geckoDivElement = geckoDivElement.Parent as GeckoDivElement;
                }
                if (geckoDivElement == null)
                {
                    return;
                }

                int       blockIndexInBook;
                GeckoNode blockIndexInBookAttr = geckoDivElement.Attributes["data-block-index-in-book"];
                if (blockIndexInBookAttr == null || !Int32.TryParse(blockIndexInBookAttr.NodeValue, out blockIndexInBook))
                {
                    return;
                }
                m_viewModel.CurrentBlockIndexInBook = blockIndexInBook;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取长xpath
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public string GetXpath(GeckoNode node)
        {
            if (node == null)
            {
                return("");
            }
            if (node.NodeType == NodeType.Attribute)
            {
                return(String.Format("{0}/@{1}", GetXpath(((GeckoAttribute)node).OwnerDocument), node.LocalName));
            }
            if (node.ParentNode == null)
            {
                return("");
            }
            int       indexInParent = 1;
            GeckoNode siblingNode   = node.PreviousSibling;

            while (siblingNode != null)
            {
                if (siblingNode.LocalName == node.LocalName)
                {
                    indexInParent++;
                }
                siblingNode = siblingNode.PreviousSibling;
            }
            return(String.Format("{0}/{1}[{2}]", GetXpath(node.ParentNode), node.LocalName, indexInParent));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Given a particular node (typically one the user right-clicked), determine whether it is clearly part of
        /// a particular page (inside a PageContainerClass div).
        /// If so, return the corresponding Page object. If not, return null.
        /// </summary>
        /// <param name="clickNode"></param>
        /// <returns></returns>
        internal IPage GetPageContaining(GeckoNode clickNode)
        {
            bool gotPageElt = false;

            for (var elt = clickNode as GeckoElement ?? clickNode.ParentElement; elt != null; elt = elt.ParentElement)
            {
                var classAttr = elt.Attributes["class"];
                if (classAttr != null)
                {
                    var className = " " + classAttr.NodeValue + " ";
                    if (className.Contains(" " + PageContainerClass + " "))
                    {
                        // Click is inside a page element: can succeed. But it's not this one.
                        gotPageElt = true;
                        continue;
                    }
                    if (className.Contains(" " + ClassForGridItem + " "))
                    {
                        if (!gotPageElt)
                        {
                            return(null);                            // clicked somewhere in a grid, but not actually on the page: intended page may be ambiguous.
                        }
                        var   id = elt.Attributes["id"].NodeValue;
                        IPage page;
                        _pageMap.TryGetValue(id, out page);
                        return(page);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取短 xpath
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public string GetSmallXpath(GeckoNode node)
        {
            if (node == null)
            {
                return("");
            }
            if (node.NodeType == NodeType.Attribute)
            {
                return(String.Format("{0}/@{1}", GetSmallXpath(((GeckoAttribute)node).OwnerDocument), node.LocalName));
            }
            if (node.ParentNode == null)
            {
                return("");
            }
            string elementId = ((GeckoHtmlElement)node).Id;

            if (!String.IsNullOrEmpty(elementId))
            {
                return(String.Format("//*[@id=\"{0}\"]", elementId));
            }
            int       indexInParent = 1;
            GeckoNode siblingNode   = node.PreviousSibling;

            while (siblingNode != null)
            {
                if (siblingNode.LocalName == node.LocalName)
                {
                    indexInParent++;
                }
                siblingNode = siblingNode.PreviousSibling;
            }
            return(String.Format("{0}/{1}[{2}]", GetSmallXpath(node.ParentNode), node.LocalName, indexInParent));
        }
Exemplo n.º 5
0
        public void SelectFirstTest_MultiResult()
        {
            var parser           = new DomParser();
            GeckoDomDocument doc = parser.ParseFromString("<html><body><span id='myspan'>hello world</span><span id='myspan'>hello world</span><span id='myspan'>hello world</span></body></html>");

            GeckoNode span = doc.SelectFirst(@".//*[@id='myspan']");

            Assert.AreEqual("hello world", span.TextContent);
        }
Exemplo n.º 6
0
        public void SelectSingleTest_MultiResult()
        {
            var parser           = new DomParser();
            GeckoDomDocument doc = parser.ParseFromString("<html><body><span id='myspan'>hello world</span><span id='myspan'>hello world</span><span id='myspan'>hello world</span></body></html>");

            GeckoNode span = null;

            Assert.Throws <GeckoDomException>(delegate
            {
                span = doc.SelectSingle(@".//*[@id='myspan']");
            });
        }
        protected void HandleDomClick(object sender, GeckoDomEventArgs e)
        {
            if (sender == null || e == null || e.Target == null)
            {
                return;
            }

            GeckoElement parentTable = GetParentTable(e.Target);

            if (parentTable == null)
            {
                return;
            }

            GeckoNode onClick = parentTable.Attributes["onclick"];

            // The next two lines are needed to fix FWNX-725, but if they're not commented out, the
            // program silently disappears shortly after the TryAWordDlg dialog is closed *if this
            // method is ever invoked by clicking on the HTML control anywhere*.  Somehow, either
            // e.Target.Attributes["onclick"] or onClick.TextContent must set some state in the browser
            // that causes this horrendous behavior.
            //if (onClick == null)
            //	onClick = e.Target.Attributes["onclick"];
            if (onClick == null)
            {
                return;
            }

            var js = onClick.TextContent;

            if (js.Contains("JumpToToolBasedOnHvo"))
            {
                JumpToToolBasedOnHvo(Int32.Parse(GetParameterFromJavaScriptFunctionCall(js)));
            }
            if (js.Contains("ShowWordGrammarDetail") || js.Contains("ButtonShowWGDetails"))
            {
                ShowWordGrammarDetail(GetParameterFromJavaScriptFunctionCall(js));
            }
            if (js.Contains("TryWordGrammarAgain"))
            {
                TryWordGrammarAgain(GetParameterFromJavaScriptFunctionCall(js));
            }
            if (js.Contains("GoToPreviousWordGrammarPage"))
            {
                GoToPreviousWordGrammarPage();
            }
        }
        protected void HandleHtmlControlBrowserDomMouseMove(object sender, GeckoDomMouseEventArgs e)
        {
            if (sender == null || e == null || e.Target == null)
            {
                return;
            }

            GeckoElement parentTable = GetParentTable(e.Target);

            if (parentTable == null)
            {
                return;
            }

            GeckoNode onMouseMove = parentTable.Attributes["onmousemove"];

            if (onMouseMove == null)
            {
                return;
            }

            MouseMove();
        }
Exemplo n.º 9
0
 /// <summary>
 /// Dispatches aEvent via the nsIPresShell object of the window's document.
 /// The event is dispatched to aTarget, which should be an object
 /// which implements nsIContent interface (#element, #text, etc).
 ///
 /// Cannot be accessed from unprivileged context (not
 /// content-accessible) Will throw a DOM security error if called
 /// without UniversalXPConnect privileges.
 ///
 /// @note Event handlers won't get aEvent as parameter, but a similar event.
 /// Also, aEvent should not be reused.
 /// </summary>
 public bool DispatchDOMEventViaPresShell(GeckoNode aTarget, GeckoNode aEvent, bool aTrusted)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
        private void gecko_Navigated(object sender, GeckoNavigatedEventArgs e)
        {
            GeckoElement gaia_loginbox = gecko.Document.GetElementById("gaia_loginbox");

            if (gaia_loginbox == null)
            {
                GeckoElement header = gecko.Document.GetElementById("header");
                if (header != null)
                {
                    header.SetAttribute("style", "display:none;");
                }

                GeckoElement oneGoogleWrapper = gecko.Document.GetElementById("oneGoogleWrapper");
                if (oneGoogleWrapper != null)
                {
                    oneGoogleWrapper.SetAttribute("style", "display:none;");
                }

                GeckoElement coloredBar = gecko.Document.GetElementById("coloredBar");
                if (coloredBar != null)
                {
                    coloredBar.SetAttribute("style", "display:none;");
                }

                GeckoElement headerBar = gecko.Document.GetElementById("headerBar");
                if (headerBar != null)
                {
                    headerBar.SetAttribute("style", "padding-top:0px;");
                    GeckoElement gUser = gecko.Document.GetElementById("guser");

                    GeckoElement username = (GeckoElement)gUser.FirstChild.ChildNodes[2];
                    username.SetAttribute("style", "display:none;");

                    foreach (GeckoNode el in gUser.FirstChild.ChildNodes)
                    {
                        if ((el.HasAttributes) && (el.Attributes["id"] != null))
                        {
                            {
                                GeckoElement element = (GeckoElement)el;
                                if (element.Id != "gb_71")
                                {
                                    element.SetAttribute("style", "display:none;");
                                }
                            }
                        }
                        if (el.TextContent.Contains("|"))
                        {
                            el.TextContent = "";
                        }
                    }

                    GeckoElement breadcrumbs = gecko.Document.GetElementById("breadcrumbs");
                    breadcrumbs.SetAttribute("style", "margin-left:176px;");

                    GeckoElement parentEl = breadcrumbs.Parent;
                    parentEl.InsertBefore((GeckoNode)gUser, (GeckoNode)breadcrumbs);

                    GeckoNode navtab = (GeckoNode)headerBar.LastChild.FirstChild;
                    if (navtab != null)
                    {
                        GeckoElement navtabEl = (GeckoElement)navtab;
                        navtabEl.SetAttribute("style", "width:171px;margin-top:25px;");
                    }
                }

                GeckoElement nav = gecko.Document.GetElementById("nav");
                if (nav != null)
                {
                    nav.SetAttribute("style", "width:151px;");
                }
            }
        }
 /// <summary>
 /// Dispatches aEvent via the nsIPresShell object of the window's document.
 /// The event is dispatched to aTarget, which should be an object
 /// which implements nsIContent interface (#element, #text, etc).
 ///
 /// Cannot be accessed from unprivileged context (not
 /// content-accessible) Will throw a DOM security error if called
 /// without UniversalXPConnect privileges.
 ///
 /// @note Event handlers won't get aEvent as parameter, but a similar event.
 /// Also, aEvent should not be reused.
 /// </summary>		
 public bool DispatchDOMEventViaPresShell(GeckoNode aTarget, GeckoNode aEvent, bool aTrusted)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 12
0
        public void UpdateThumbnailAsync(IPage page)
        {
            if (page.Book.Storage.NormalBaseForRelativepaths != _baseForRelativePaths)
            {
                // book has been renamed! can't go on with old document that pretends to be in the wrong place.
                // Regenerate completely.
                UpdateItems(_pages);
                return;
            }
            if (TroubleShooterDialog.MakeEmptyPageThumbnails)
            {
                return;                 // no new content needed.
            }
            var targetClass      = "bloom-page";
            var gridElt          = GetGridElementForPage(page);
            var pageContainerElt = GetFirstChildWithClass(gridElt, PageContainerClass) as GeckoElement;

            if (pageContainerElt == null)
            {
                Debug.Fail("Can't update page...missing pageContainer element");
                return;                 // for end user we just won't update the thumbnail.
            }
            var pageElt = GetFirstChildWithClass(pageContainerElt, targetClass);

            if (pageElt == null)
            {
                Debug.Fail("Can't update page...missing page element");
                return;                 // for end user we just won't update the thumbnail.
            }
            // Remove listeners so that garbage collection resulting from the Dispose has a better
            // chance to work (without entanglements between javascript and mozilla's DOM memory).
            RemoveThumbnailListeners();
            var divNodeForThisPage = page.GetDivNodeForThisPage();

            //clone so we can modify it for thumbnailing without messing up the version we will save
            divNodeForThisPage = divNodeForThisPage.CloneNode(true) as XmlElement;
            MarkImageNodesForThumbnail(divNodeForThisPage);
            GeckoNode geckoNode = null;

            for (int i = 0; i < 3; i++)
            {
                // As described in BL-4690, apparently some random event occasionally causes a failure
                // deep inside Gecko when we go to do this.
                // We don't need to bother the user if we just have a problem updating the thumbnail in
                // the page list.
                // So, we log it, and try again a couple of times in case it is a transient problem.
                // If it keeps happening, just leave the old thumbnail in place.
                try
                {
                    geckoNode = MakeGeckoNodeFromXmlNode(_browser.WebBrowser.Document, divNodeForThisPage);
                    break;
                }
                catch (InvalidComObjectException e)
                {
                    Logger.WriteError("BL-4690 InvalidComObjectException try " + i, e);
                }
            }
            if (geckoNode != null)
            {
                pageContainerElt.ReplaceChild(geckoNode, pageElt);
                pageElt.Dispose();
            }
            AddThumbnailListeners();
        }
Exemplo n.º 13
0
        private void initializeElements()
        {
            usernameElement = (GeckoElement)browser.Document.GetElementsByClassName("username")[0];
            creditElement   = (GeckoElement)browser.Document.GetElementsByClassName("credits")[0];

            GeckoElement textboxParent = (GeckoElement)browser.Document.GetElementsByClassName("bet_system")[0];

            foreach (GeckoNode child in textboxParent.ChildNodes)
            {
                if (child.NodeName.ToLower() == "input")
                {
                    textboxElement = (GeckoInputElement)child;
                }
            }

            GeckoNode redDiv = browser.Document.GetElementsByClassName("table")[0];

            foreach (GeckoNode child in redDiv.ChildNodes)
            {
                if (NodeType.Element == child.NodeType)
                {
                    GeckoElement convert = (GeckoElement)child;
                    if (convert.GetAttribute("data-color") == "red")
                    {
                        redButton = (GeckoHtmlElement)child;
                        Console.WriteLine("Got Red");
                    }
                }
            }

            GeckoNode blackDiv = browser.Document.GetElementsByClassName("table")[2];

            foreach (GeckoNode child in blackDiv.ChildNodes)
            {
                if (NodeType.Element == child.NodeType)
                {
                    GeckoElement convert = (GeckoElement)child;
                    if (convert.GetAttribute("data-color") == "black")
                    {
                        blackButton = (GeckoHtmlElement)child;
                        Console.WriteLine("Got Black");
                    }
                }
            }

            GeckoNode resultListParent = browser.Document.GetElementsByClassName("winner_history")[0];

            foreach (GeckoNode child in resultListParent.ChildNodes)
            {
                if (NodeType.Element == child.NodeType)
                {
                    GeckoElement convert = (GeckoElement)child;
                    if (convert.GetAttribute("class") == "holder")
                    {
                        resultList = (GeckoElement)child;
                    }
                }
            }

            GeckoNode statusTextParent = browser.Document.GetElementsByClassName("roll_timer")[0];

            foreach (GeckoNode child in statusTextParent.ChildNodes)
            {
                if (NodeType.Element == child.NodeType)
                {
                    GeckoElement convert = (GeckoElement)child;
                    if (convert.GetAttribute("class") == "bg")
                    {
                        statusText = (GeckoElement)child;
                    }
                }
            }

            betRedStatusText   = (GeckoElement)browser.Document.GetElementsByClassName("your")[0];
            betBlackStatusText = (GeckoElement)browser.Document.GetElementsByClassName("your")[2];
        }
        private void FindElements(GeckoWebBrowser browser, string tagName, Point clickPosition)
        {
            //double x, y;
            //GeckoHtmlElement offsetParentElement;
            GeckoHtmlElement parentElement;
            GeckoNode        childNode    = null;
            GeckoHtmlElement childElement = null;

            foreach (var element in browser.Document.GetElementsByTagName(tagName))
            {
                if ((element.ComputedStyle.GetPropertyValue("display").Equals("none")) || (element.ComputedStyle.GetPropertyValue("visibility").Equals("hidden")))
                {
                    continue;
                }
                parentElement = element;
                while (parentElement != null)
                {
                    if (parentElement.TagName.Equals("A"))
                    {
                        int x = 0, y = 0, width = 0, height = 0, extraHeight = 0;
                        if (tagName.Equals("A"))
                        {
                            if (parentElement.ClientRects.Length == 1)
                            {
                                x      = parentElement.ClientRects[0].X + parentElement.ClientRects[0].Width / 2;
                                y      = parentElement.ClientRects[0].Y + parentElement.ClientRects[0].Height / 2;
                                width  = parentElement.ClientRects[0].Width;
                                height = parentElement.ClientRects[0].Height;
                                if (parentElement.HasChildNodes)
                                {
                                    try
                                    {
                                        childNode = parentElement.ChildNodes[0];
                                        while (true)
                                        {
                                            if (childNode.NodeType == NodeType.Element)
                                            {
                                                childElement = (GeckoHtmlElement)childNode;
                                                if (childElement.ClientRects[0].Height > parentElement.ClientRects[0].Height && childElement.ClientRects[0].Height > extraHeight)
                                                {
                                                    extraHeight = childElement.ClientRects[0].Height - parentElement.ClientRects[0].Height;
                                                }
                                                if (childElement.HasChildNodes)
                                                {
                                                    childNode = childElement.ChildNodes[0];
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            else
                                            {
                                                break;
                                            }
                                        }
                                    } catch (Exception e) { }
                                    if (extraHeight != 0)
                                    {
                                        y      -= extraHeight / 2;
                                        height += extraHeight;
                                    }
                                }
                                if (x >= 0 && x < browser.Width && y >= 0 && y < browser.Height)
                                {
                                    visibleLinks.Add(new PageElement(tagName, element.TextContent, element, x - (width / 2), y - (height / 2), width, height, Math.Sqrt(Math.Pow((x - clickPosition.X), 2) + Math.Pow((y - clickPosition.Y), 2))));
                                }
                            }
                            else if (parentElement.ClientRects.Length > 1)
                            {
                                x = parentElement.ClientRects[0].X;
                                foreach (Rectangle rect in parentElement.ClientRects)
                                {
                                    if (rect.X < x)
                                    {
                                        x = rect.X;
                                    }
                                }
                                y = parentElement.ClientRects[0].Y;
                                int tempWidth = 0;
                                foreach (Rectangle rect in parentElement.ClientRects)
                                {
                                    if (rect.X + rect.Width > tempWidth)
                                    {
                                        tempWidth = rect.X + rect.Width;
                                        width     = tempWidth - x;
                                    }
                                }
                                height = -parentElement.ClientRects[0].Y + parentElement.ClientRects[parentElement.ClientRects.Length - 1].Y + parentElement.ClientRects[parentElement.ClientRects.Length - 1].Height;
                                x     += width / 2;
                                y     += height / 2;
                                if (parentElement.HasChildNodes)
                                {
                                    try
                                    {
                                        childNode = parentElement.ChildNodes[0];
                                        while (true)
                                        {
                                            if (childNode.NodeType == NodeType.Element)
                                            {
                                                childElement = (GeckoHtmlElement)childNode;
                                                if (childElement.ClientRects[0].Height > parentElement.ClientRects[0].Height && childElement.ClientRects[0].Height > extraHeight)
                                                {
                                                    extraHeight = childElement.ClientRects[0].Height - parentElement.ClientRects[0].Height;
                                                }
                                                if (childElement.HasChildNodes)
                                                {
                                                    childNode = childElement.ChildNodes[0];
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            else
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    catch (Exception e) { }
                                    if (extraHeight != 0)
                                    {
                                        y      -= extraHeight / 2;
                                        height += extraHeight;
                                    }
                                }
                                if (x >= 0 && x < browser.Width && y >= 0 && y < browser.Height)
                                {
                                    visibleLinks.Add(new PageElement(tagName, element.TextContent, element, x - (width / 2), y - (height / 2), width, height, Math.Sqrt(Math.Pow((x - clickPosition.X), 2) + Math.Pow((y - clickPosition.Y), 2))));
                                }
                            }
                        }
                        else if (tagName.Equals("IMG"))
                        {
                            if (element.ClientRects.Length >= 1)
                            {
                                x      = element.ClientRects[0].X + element.ClientWidth / 2;
                                y      = element.ClientRects[0].Y + element.ClientHeight / 2;
                                width  = element.ClientWidth;
                                height = element.ClientHeight;
                                if (x >= 0 && x < browser.Width && y >= 0 && y < browser.Height)
                                {
                                    elements.Add(new PageElement(tagName, parentElement.GetAttribute("HREF"), parentElement, x - (width / 2), y - (height / 2), width, height, Math.Sqrt(Math.Pow((x - clickPosition.X), 2) + Math.Pow((y - clickPosition.Y), 2))));
                                }
                            }
                        }
                        //x = element.OffsetLeft + (element.OffsetWidth / 2.0) - browser.Document.GetElementsByTagName("HTML")[0].ScrollLeft + Convert.ToDouble(browser.Document.GetElementsByTagName("BODY")[0].ComputedStyle.GetPropertyValue("margin-left").Replace("px",""));
                        //if (parentElement.ClientRects.Length > 1 && !tagName.Equals("IMG"))
                        //{
                        //    if (parentElement.ClientRects[0].X > parentElement.ClientRects[1].X)
                        //    {
                        //        x += parentElement.ClientRects[1].X - parentElement.ClientRects[0].X;
                        //    }
                        //}
                        //y = element.OffsetTop + (element.OffsetHeight / 2.0) - browser.Document.GetElementsByTagName("HTML")[0].ScrollTop + Convert.ToDouble(browser.Document.GetElementsByTagName("BODY")[0].ComputedStyle.GetPropertyValue("margin-top").Replace("px",""));
                        //offsetParentElement = element.OffsetParent;
                        //x -= parentElement.ScrollLeft;
                        //y -= parentElement.ScrollTop;
                        //GeckoHtmlElement scrollElement = parentElement;
                        //while (scrollElement != null)
                        //{
                        //    scrollElement = scrollElement.Parent;
                        //    if (!scrollElement.TagName.Equals("BODY") && !scrollElement.TagName.Equals("HTML") && scrollElement != null)
                        //    {
                        //        x -= scrollElement.ScrollLeft;
                        //        y -= scrollElement.ScrollTop;
                        //    }
                        //    else break;
                        //}
                        //while (offsetParentElement != null)
                        //{
                        //    if (offsetParentElement.ComputedStyle.GetPropertyValue("position").Equals("fixed"))
                        //    {
                        //        x = x + browser.Document.GetElementsByTagName("HTML")[0].ScrollLeft - Convert.ToDouble(browser.Document.GetElementsByTagName("BODY")[0].ComputedStyle.GetPropertyValue("margin-left").Replace("px", "")) + Convert.ToDouble(offsetParentElement.ComputedStyle.GetPropertyValue("left").Replace("px", ""));
                        //        y = y + browser.Document.GetElementsByTagName("HTML")[0].ScrollTop - Convert.ToDouble(browser.Document.GetElementsByTagName("BODY")[0].ComputedStyle.GetPropertyValue("margin-top").Replace("px", "")) + Convert.ToDouble(offsetParentElement.ComputedStyle.GetPropertyValue("top").Replace("px", ""));
                        //        break;
                        //    }
                        //    x += offsetParentElement.OffsetLeft;
                        //    y += offsetParentElement.OffsetTop;
                        //    offsetParentElement = offsetParentElement.OffsetParent;
                        //}
                        //if (x >= 0.0 && x < browser.Width && y >= 0.0 && y < browser.Height)
                        //{
                        //    if (tagName.Equals("A"))
                        //    {
                        //        visibleLinks.Add(new PageElement(tagName, element.TextContent, element, x - (element.OffsetWidth / 2.0), y - (element.OffsetHeight / 2.0), element.OffsetWidth+1, element.OffsetHeight+1, Math.Sqrt(Math.Pow((x - clickPosition.X), 2) + Math.Pow((y - clickPosition.Y), 2))));
                        //    }
                        //    else
                        //    {
                        //        elements.Add(new PageElement(tagName, parentElement.GetAttribute("HREF"), parentElement, x - (element.OffsetWidth / 2.0), y - (element.OffsetHeight / 2.0), element.OffsetWidth, element.OffsetHeight, Math.Sqrt(Math.Pow((x - clickPosition.X), 2) + Math.Pow((y - clickPosition.Y), 2))));
                        //    }
                        //}
                        break;
                    }
                    parentElement = parentElement.Parent;
                }
            }
        }