Esempio n. 1
0
 public static IEnumerable <string> NodeNames(this DomNodeCollection source)
 {
     if (source == null)
     {
         return(Enumerable.Empty <string>());
     }
     return(source.Select(n => n == null ? "<null>" : n.NodeName));
 }
Esempio n. 2
0
        // Get the sum of the widths of the groups in this tab.
        // Used for scaling the Ribbon
        internal int GetNeededWidth()
        {
            int sum = 0;
            DomNodeCollection nodes = ElementInternal.ChildNodes;

            for (int i = 0; i < nodes.Length; i++)
            {
                sum += ((HtmlElement)nodes[i]).OffsetWidth;
            }
            return(sum);
        }
        internal static bool IsConsolidatable(DomNodeCollection childNodes, out HxlRenderWorkElement singleton)
        {
            singleton = null;
            if (childNodes.Count == 0)
            {
                return(false);
            }

            foreach (var node in childNodes)
            {
                if (node.NodeType == DomNodeType.Text)
                {
                    continue;
                }

                if (node is HxlTextElement)
                {
                    continue;
                }

                HxlRenderWorkElement render = node as HxlRenderWorkElement;
                if (render != null)
                {
                    if (render.ChildNodes.Count == 0)
                    {
                        continue;
                    }

                    if (singleton == null)
                    {
                        singleton = render;
                        continue;
                    }

                    return(false);
                }

                return(false);
            }

            return(true);
        }
Esempio n. 4
0
    /// <summary>
    /// 获取所有子节点
    /// </summary>
    public IEnumerable<IHtmlNode> Nodes()
    {
      if ( _nodeCollection == null )
        _nodeCollection = new DomNodeCollection( this );

      return _nodeCollection.HtmlNodes;
    }
Esempio n. 5
0
 /// <summary>
 /// 创建一个 DomFragment 实例
 /// </summary>
 /// <param name="manager">文档碎片管理器</param>
 public DomFragment( DomFragmentManager manager )
 {
     _manager = manager;
       _nodeCollection = new DomNodeCollection( this );
 }
Esempio n. 6
0
 protected DomContainer()
 {
     // TODO Replace with linked list (performance)
     this.domChildNodes = new DomNodeCollection(this, new List<DomNode>());
 }