protected override Rect GetBoundingRectangleCore()
        {
            CefSharp.Structs.Rect location = GetLocation();
            Point point = CefPointToScreen(location.X, location.Y);
            Size  size  = new Size(location.Width, location.Height);

            return(new Rect(point, size));
        }
        protected virtual CefSharp.Structs.Rect GetLocation()
        {
            var offsetNode = accessibilityTree.GetNode(offsetContainerId);

            if (offsetNode == null)
            {
                return(location);
            }

            // Add offset from parent location
            int x = location.X;
            int y = location.Y;

            CefSharp.Structs.Rect offsetNodeRect = offsetNode.GetLocation();
            x += offsetNodeRect.X - offsetNode.scroll.X;
            y += offsetNodeRect.Y - offsetNode.scroll.Y;

            return(new CefSharp.Structs.Rect(x, y, location.Width, location.Height));
        }
        public void Update(IDictionary <string, IValue> node)
        {
            if (node == null || !node.ContainsKey("id"))
            {
                return;
            }

            Id = node["id"].GetInt();

            if (node.ContainsKey("role"))
            {
                Role = node["role"].GetString();
            }

            if (node.ContainsKey("child_ids"))
            {
                IEnumerable <int> newChildIdsList = node["child_ids"].GetList().Select(x => x.GetInt());
                if (!childIds.SetEquals(newChildIdsList))
                {
                    childIds = new HashSet <int>(newChildIdsList);
                    OnChildrenChanged();
                }
            }

            if (node.ContainsKey("location"))
            {
                IDictionary <string, IValue> locationDictionary = node["location"].GetDictionary();
                if (locationDictionary != null)
                {
                    int x      = (int)(locationDictionary["x"].GetDouble());
                    int y      = (int)(locationDictionary["y"].GetDouble());
                    int width  = (int)(locationDictionary["width"].GetDouble());
                    int height = (int)(locationDictionary["height"].GetDouble());
                    location = new CefSharp.Structs.Rect(x, y, width, height);
                }
            }

            if (node.ContainsKey("offset_container_id"))
            {
                offsetContainerId = node["offset_container_id"].GetInt();
            }

            if (node.ContainsKey("attributes"))
            {
                IDictionary <string, IValue> attributes = node["attributes"].GetDictionary();
                if (attributes != null)
                {
                    if (attributes.ContainsKey("name"))
                    {
                        Name = attributes["name"].GetString();
                    }
                    if (attributes.ContainsKey("value"))
                    {
                        Value = attributes["value"].GetString();
                    }
                    if (attributes.ContainsKey("description"))
                    {
                        Description = attributes["description"].GetString();
                    }
                    if (attributes.ContainsKey("scrollX") && attributes.ContainsKey("scrollY"))
                    {
                        int scrollX = attributes["scrollX"].GetInt();
                        int scrollY = attributes["scrollY"].GetInt();
                        scroll = new CefSharp.Structs.Point(scrollX, scrollY);
                    }
                }
            }
        }