コード例 #1
0
 /// <summary>
 /// Performs recursive search in all <paramref name="element"/> ChildNodes elements
 /// Returns first match
 /// </summary>
 /// <param name="element"></param>
 /// <param name="predicate"></param>
 /// <returns></returns>
 public static T FindFirstChildInTree <T>(this GeckoNode element, Predicate <T> predicate)
     where T : GeckoNode
 {
     for (int i = 0; i < element.ChildNodes.Length; i++)
     {
         var node = element.ChildNodes[i];
         if (!(node is T))
         {
             continue;
         }
         var childElement = (T)node;
         if (predicate(childElement))
         {
             return(childElement);
         }
         if (childElement.HasChildNodes)
         {
             var ret = FindFirstChildInTree(childElement, predicate);
             if (ret != null)
             {
                 return(ret);
             }
         }
     }
     return(null);
 }
コード例 #2
0
        public GeckoNode ImportNode(GeckoNode node, bool deep)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            return(GeckoNode.Create(_domDocument.ImportNode(node.DomObject, deep, 1)));
        }
コード例 #3
0
        public GeckoNode ImportNode(GeckoNode node, bool deep)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            return(Gecko.Interop.ExtensionMethods.Wrap(_domDocument.ImportNode(node.DomObject, deep, 1), Create));
        }
 /// <summary>Creates a new instance of a <see cref="GeckoContextMenuEventArgs"/> object.</summary>
 public GeckoContextMenuEventArgs(Point location, ContextMenu contextMenu, string associatedLink, Uri backgroundImageSrc, Uri imageSrc, GeckoNode targetNode)
 {
     Location           = location;
     _contextMenu       = contextMenu;
     AssociatedLink     = associatedLink;
     BackgroundImageSrc = backgroundImageSrc;
     ImageSrc           = imageSrc;
     _targetNode        = targetNode;
 }
コード例 #5
0
        public GeckoNode ImportNode(GeckoNode node, bool deep)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            return(Doc.Value.ImportNode(node.DomObject, deep).Wrap(Window, Create));
        }
コード例 #6
0
 /// <summary>Creates a new instance of a <see cref="GeckoContextMenuEventArgs"/> object.</summary>
 public GeckoContextMenuEventArgs(Point location, ContextMenu contextMenu, string associatedLink, Uri backgroundImageSrc, Uri imageSrc, GeckoNode targetNode)
 {
     Location = location;
     _contextMenu = contextMenu;
     AssociatedLink = associatedLink;
     BackgroundImageSrc = backgroundImageSrc;
     ImageSrc = imageSrc;
     _targetNode = targetNode;
 }
コード例 #7
0
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            nsIDOMNode node;

            while ((node = xpathResult.IterateNext()) != null)
            {
                yield return(GeckoNode.Create(node));
            }
        }
コード例 #8
0
        public GeckoNode RemoveChild(GeckoNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            _DomObject.RemoveChild(node._DomObject);
            return(node);
        }
コード例 #9
0
        public GeckoNode RemoveChild(GeckoNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            _node.Value.RemoveChild(node._domNode.Instance);
            return(node);
        }
コード例 #10
0
        public GeckoNode AppendChild(GeckoNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            _domNode.Instance.AppendChild(node._domNode.Instance);
            return(node);
        }
コード例 #11
0
        public virtual GeckoHtmlElement this[uint index]
        {
            get
            {
                if (index >= Length)
                {
                    throw new ArgumentOutOfRangeException(nameof(index));
                }

                return((GeckoHtmlElement)GeckoNode.Create(_window, List.Item(index)));
            }
        }
コード例 #12
0
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            nsIDOMNode node;

#if NEED_WEBIDL
            while ((node = xpathResult.IterateNext()) != null)
            {
                yield return(GeckoNode.Create(node));
            }
#else
            return(null);
#endif
        }
コード例 #13
0
        public GeckoNode ReplaceChild(GeckoNode newChild, GeckoNode oldChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException("newChild");
            }
            if (oldChild == null)
            {
                throw new ArgumentNullException("oldChild");
            }

            _DomObject.ReplaceChild(newChild._DomObject, oldChild._DomObject);
            return(newChild);
        }
コード例 #14
0
        public GeckoNode InsertBefore(GeckoNode newChild, GeckoNode before)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException("newChild");
            }
            if (before == null)
            {
                throw new ArgumentNullException("before");
            }

            _DomObject.InsertBefore(newChild._DomObject, before._DomObject);
            return(newChild);
        }
コード例 #15
0
        public GeckoNode ReplaceChild(GeckoNode newChild, GeckoNode oldChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException(nameof(newChild));
            }
            if (oldChild == null)
            {
                throw new ArgumentNullException(nameof(oldChild));
            }

            _node.Value.ReplaceChild(newChild._domNode.Instance, oldChild._domNode.Instance);
            return(newChild);
        }
コード例 #16
0
        public GeckoNode InsertBefore(GeckoNode newChild, GeckoNode before)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException(nameof(newChild));
            }
            if (before == null)
            {
                throw new ArgumentNullException(nameof(before));
            }

            _node.Value.InsertBefore(newChild._domNode.Instance, before._domNode.Instance);
            return(newChild);
        }
コード例 #17
0
 public bool IsPointInRange(GeckoNode node, int offset)
 {
     return(DomNsRange.IsPointInRange(node.DomObject, offset));
 }
コード例 #18
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public void SelectNodeContents(GeckoNode node)
 {
     _range.Instance.SelectNodeContents((nsIDOMNode)node.DomObject);
 }
コード例 #19
0
		public void InsertNode(GeckoNode newNode)
		{
			DomRange.InsertNode((nsIDOMNode)newNode.DomObject);
		}
コード例 #20
0
		public void SurroundContents(GeckoNode newParent)
		{
			DomRange.SurroundContents((nsIDOMNode)newParent.DomObject);
		}
コード例 #21
0
        public GeckoNode ImportNode(GeckoNode node, bool deep)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            return GeckoNode.Create(_domDocument.ImportNode(node.DomObject, deep, 1));
        }
コード例 #22
0
        public GeckoNode ImportNode(GeckoNode node, bool deep)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            return ExtensionMethods.Wrap(_domDocument.ImportNode(node.DomObject, deep, 1),
                  Create);
            //return _domDocument.ImportNode(node.DomObject, deep, 1)
            //    .Wrap(Create);
        }
コード例 #23
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public void InsertNode(GeckoNode newNode)
 {
     _range.Instance.InsertNode(newNode.DomObject);
 }
コード例 #24
0
 public int CompareDocumentPosition(GeckoNode other)
 {
     return(_node.Value.CompareDocumentPosition(other.DomObject));
 }
コード例 #25
0
ファイル: GeckoNode.cs プロジェクト: RSchwoerer/Terminals
		public GeckoNode InsertBefore(GeckoNode newChild, GeckoNode before)
		{
			if (newChild == null)
				throw new ArgumentNullException("newChild");
			if (before == null)
				throw new ArgumentNullException("before");

			_domNode.Instance.InsertBefore(newChild._domNode.Instance, before._domNode.Instance);
			return newChild;
		}
コード例 #26
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public void SurroundContents(GeckoNode newParent)
 {
     _range.Instance.SurroundContents(newParent.DomObject);
 }
コード例 #27
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public void SetStartBefore(GeckoNode node)
 {
     _range.Instance.SetStartBefore(node.DomObject);
 }
コード例 #28
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public void SetStartAfter(GeckoNode node)
 {
     _range.Instance.SetStartAfter(node.DomObject);
 }
コード例 #29
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public void SetStart(GeckoNode node, int offset)
 {
     _range.Instance.SetStart(node.DomObject, offset);
 }
コード例 #30
0
		public void SetEnd(GeckoNode node, int offset)
		{
			DomRange.SetEnd((nsIDOMNode)node.DomObject, offset);
		}
コード例 #31
0
        public GeckoNode ReplaceChild(GeckoNode newChild, GeckoNode oldChild)
        {
            if (newChild == null)
                throw new ArgumentNullException("newChild");
            if (oldChild == null)
                throw new ArgumentNullException("oldChild");

            _DomObject.ReplaceChild(newChild._DomObject, oldChild._DomObject);
            return newChild;
        }
コード例 #32
0
 /// <summary>
 ///Scrolls to a given DOM content node.
 ///	</summary>
 public void ScrollToNode(GeckoNode node)
 {
     m_markupDocumentViewer.ScrollToNode(node.DomObject);
 }
コード例 #33
0
 public GeckoNode CloneNode(bool deep)
 {
     return(GeckoNode.Create(_domNode.Instance.CloneNode(deep, 1)));
 }
コード例 #34
0
 /// <summary>
 /// Collapses the selection to a single point, at the specified offset in the given DOM node. When the selection is collapsed, and the content is focused and editable, the caret will blink there.
 /// </summary>
 /// <param name="parentNode"></param>
 /// <param name="offset"></param>
 public void Collapse(GeckoNode parentNode, int offset)
 {
     Selection.Collapse((nsIDOMNode)parentNode.DomObject, offset);
 }
コード例 #35
0
 /// <summary>
 ///Scrolls to a given DOM content node.
 ///	</summary>
 public void ScrollToNode(GeckoNode node)
 {
     _docViewer.Instance.ScrollToNode(node.DomObject);
 }
コード例 #36
0
		public void SelectNodeContents(GeckoNode node)
		{
			DomRange.SelectNodeContents((nsIDOMNode)node.DomObject);
		}
コード例 #37
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;
 }
コード例 #38
0
 public void SetEndAfter(GeckoNode node)
 {
     DomRange.SetEndAfter((nsIDOMNode)node.DomObject);
 }
コード例 #39
0
 public GeckoNode ExtractContents()
 {
     return(GeckoNode.Create(DomRange.ExtractContents()));
 }
コード例 #40
0
 public void InsertNode(GeckoNode newNode)
 {
     DomRange.InsertNode((nsIDOMNode)newNode.DomObject);
 }
コード例 #41
0
ファイル: GeckoNode.cs プロジェクト: RSchwoerer/Terminals
		public GeckoNode RemoveChild(GeckoNode node)
		{
			if (node == null)
				throw new ArgumentNullException("node");

			_domNode.Instance.RemoveChild(node._domNode.Instance);
			return node;
		}
コード例 #42
0
ファイル: GeckoRange.cs プロジェクト: K-Library-NET/dotNET
 public bool IsPointInRange(GeckoNode node, int offset)
 {
     return DomRange.IsPointInRange(node.DomObject, offset);
 }
コード例 #43
0
		public void SetEndBefore(GeckoNode node)
		{
			DomRange.SetEndBefore((nsIDOMNode)node.DomObject);
		}
コード例 #44
0
ファイル: GeckoNode.cs プロジェクト: RSchwoerer/Terminals
		public GeckoNode ReplaceChild(GeckoNode newChild, GeckoNode oldChild)
		{
			if (newChild == null)
				throw new ArgumentNullException("newChild");
			if (oldChild == null)
				throw new ArgumentNullException("oldChild");

			_domNode.Instance.ReplaceChild(newChild._domNode.Instance, oldChild._domNode.Instance);
			return newChild;
		}
コード例 #45
0
 /// <summary>
 /// Returns whether the specified node is part of the selection.
 /// </summary>
 /// <param name="node"></param>
 /// <param name="partlyContained">True if the function should return true when some part of the node is contained with the selection; when false, the function only returns true when the entire node is contained within the selection.</param>
 /// <returns></returns>
 public bool ContainsNode(GeckoNode node, bool partlyContained)
 {
     return(Selection.ContainsNode((nsIDOMNode)node.DomObject, partlyContained));
 }
コード例 #46
0
 public void SetEnd(GeckoNode node, int offset)
 {
     DomRange.SetEnd((nsIDOMNode)node.DomObject, offset);
 }
コード例 #47
0
 /// <summary>
 /// Extends the selection by moving the selection end to the specified node and offset, preserving the selection begin position. The new selection end result will always be from the anchorNode to the new focusNode, regardless of direction.
 /// </summary>
 /// <param name="parentNode">The node where the selection will be extended to.</param>
 /// <param name="offset">Where in node to place the offset in the new selection end.</param>
 public void Extend(GeckoNode parentNode, int offset)
 {
     Selection.Extend((nsIDOMNode)parentNode.DomObject, offset);
 }
コード例 #48
0
		public void SetEndAfter(GeckoNode node)
		{
			DomRange.SetEndAfter((nsIDOMNode)node.DomObject);
		}
コード例 #49
0
 /// <summary>
 /// Adds all children of the specified node to the selection.
 /// </summary>
 /// <param name="parentNode"></param>
 public void SelectAllChildren(GeckoNode parentNode)
 {
     Selection.SelectAllChildren((nsIDOMNode)parentNode.DomObject);
 }
コード例 #50
0
		/// <summary>
		/// Collapses the selection to a single point, at the specified offset in the given DOM node. When the selection is collapsed, and the content is focused and editable, the caret will blink there.
		/// </summary>
		/// <param name="parentNode"></param>
		/// <param name="offset"></param>
		public void Collapse(GeckoNode parentNode, int offset)
		{
			_selection.Instance.Collapse(parentNode.DomObject, offset);
		}
コード例 #51
0
 public void SetEndBefore(GeckoNode node)
 {
     DomRange.SetEndBefore((nsIDOMNode)node.DomObject);
 }
コード例 #52
0
		/// <summary>
		/// Extends the selection by moving the selection end to the specified node and offset, preserving the selection begin position. The new selection end result will always be from the anchorNode to the new focusNode, regardless of direction.
		/// </summary>
		/// <param name="parentNode">The node where the selection will be extended to.</param>
		/// <param name="offset">Where in node to place the offset in the new selection end.</param>
		public void Extend(GeckoNode parentNode, int offset)
		{
			_selection.Instance.Extend(parentNode.DomObject, offset);
		}
コード例 #53
0
 public void SelectNodeContents(GeckoNode node)
 {
     DomRange.SelectNodeContents((nsIDOMNode)node.DomObject);
 }
コード例 #54
0
		/// <summary>
		/// Returns whether the specified node is part of the selection.
		/// </summary>
		/// <param name="node"></param>
		/// <param name="partlyContained">True if the function should return true when some part of the node is contained with the selection; when false, the function only returns true when the entire node is contained within the selection.</param>
		/// <returns></returns>
		public bool ContainsNode(GeckoNode node, bool partlyContained)
		{
			return _selection.Instance.ContainsNode(node.DomObject, partlyContained);
		}
コード例 #55
0
 public GeckoNode CloneContents()
 {
     return(GeckoNode.Create(DomRange.CloneContents()));
 }
コード例 #56
0
		/// <summary>
		/// Adds all children of the specified node to the selection.
		/// </summary>
		/// <param name="parentNode"></param>
		public void SelectAllChildren(GeckoNode parentNode)
		{
			_selection.Instance.SelectAllChildren(parentNode.DomObject);
		}
コード例 #57
0
 public void SurroundContents(GeckoNode newParent)
 {
     DomRange.SurroundContents((nsIDOMNode)newParent.DomObject);
 }
コード例 #58
0
        public GeckoNode InsertBefore(GeckoNode newChild, GeckoNode before)
        {
            if (newChild == null)
                throw new ArgumentNullException("newChild");
            if (before == null)
                throw new ArgumentNullException("before");

            _DomObject.InsertBefore(newChild._DomObject, before._DomObject);
            return newChild;
        }
コード例 #59
0
        public GeckoNode RemoveChild(GeckoNode node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            _DomObject.RemoveChild(node._DomObject);
            return node;
        }
コード例 #60
0
		/// <summary>
		/// Adds all children of the specified node to the selection.
		/// </summary>
		/// <param name="parentNode"></param>
		public void SelectAllChildren(GeckoNode parentNode)
		{
			Selection.SelectAllChildren((nsIDOMNode)parentNode.DomObject);
		}