///////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// ������
        /// </summary>
        public CHtmlStyle(CHtmlStyle obj)
            : base(obj)
        {
            System.Diagnostics.Debug.Assert(obj != null);

            obj.AssertValid();
            m_style = obj.m_style;

            int count = obj.m_attributes.Count;
            m_attributes.Capacity = count;
            for(int index = 0; index < count; ++index)
                m_attributes.Add((CHtmlAttribute)obj.m_attributes[index].Clone());
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// »ý¼ºÀÚ
        /// </summary>
        public CHtmlStyle(CHtmlStyle obj)
            : base(obj)
        {
            System.Diagnostics.Debug.Assert(obj != null);

            obj.AssertValid();
            m_style = obj.m_style;

            int count = obj.m_attributes.Count;

            m_attributes.Capacity = count;
            for (int index = 0; index < count; ++index)
            {
                m_attributes.Add((CHtmlAttribute)obj.m_attributes[index].Clone());
            }
        }
        /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// 
        /// </summary>
        /// <param name="visitor"></param>
        /// <param name="nodeIDCount"></param>
        /// <returns></returns>
        private void ResolveStyle(ref int visitor, ref int nodeIDCount)
        {
            System.Diagnostics.Debug.Assert(m_tokens[visitor].Type == Token.TokenType.TagName && m_tokens[visitor].Content.Equals("style"));

            CHtmlStyle style = new CHtmlStyle();
            ++visitor;
            ResolveAttribute(ref visitor, style.Attributes);

            System.Diagnostics.Debug.Assert(m_tokens[visitor].Type == Token.TokenType.TagEnd || m_tokens[visitor].Type == Token.TokenType.TagCloseEnd);
            if(m_tokens[visitor].Type == Token.TokenType.TagEnd)
            {
                ++visitor;
                System.Diagnostics.Debug.Assert(m_tokens[visitor].Type == Token.TokenType.NoEscapingText);
                style.Style = m_tokens[visitor].Content;

                ++visitor;
                System.Diagnostics.Debug.Assert(m_tokens[visitor].Type == Token.TokenType.TagCloseBegin);
                ++visitor;
                System.Diagnostics.Debug.Assert(m_tokens[visitor].Type == Token.TokenType.TagName && m_tokens[visitor].Content.Equals("style"));
                ++visitor;
                System.Diagnostics.Debug.Assert(m_tokens[visitor].Type == Token.TokenType.TagEnd);

                ++visitor;
            }

            ++nodeIDCount;
            style.NodeID = nodeIDCount;
            if(StyleCreatedEvent != null) StyleCreatedEvent(style);

            m_currentLevel.Add(style);
        }