Ejemplo n.º 1
0
        /// <summary>
        /// Appends media labels from the given source to the medialist.
        /// </summary>
        /// <param name="source">The token iterator.</param>
        /// <param name="media">The medialist to append to.</param>
        /// <param name="endToken">The optional token type to finish appending to the list.</param>
        void AppendMediaList(IEnumerator<CssToken> source, MediaList media, CssTokenType endToken = CssTokenType.Semicolon)
        {
            do
            {
                if (source.Current.Type == CssTokenType.Whitespace)
                    continue;
                else if (source.Current.Type == endToken)
                    break;

                do
                {
                    if (source.Current.Type == CssTokenType.Comma || source.Current.Type == endToken)
                        break;
                    else if (source.Current.Type == CssTokenType.Whitespace)
                        buffer.Append(' ');
                    else
                        buffer.Append(source.Current.ToValue());
                }
                while (source.MoveNext());

                media.AppendMedium(buffer.ToString());
                buffer.Clear();

                if (source.Current.Type == endToken)
                    break;
            }
            while (source.MoveNext());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new CSS @media rule.
 /// </summary>
 internal CSSMediaRule()
 {
     _media = new MediaList();
     _type = CssRuleType.Media;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Imports the media from the given list.
 /// Clears the existing media.
 /// </summary>
 /// <param name="list">The list to import.</param>
 internal void Import(MediaList list)
 {
     _media.Clear();
     _media.AddRange(list._media);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new style sheet.
 /// </summary>
 internal StyleSheet()
 {
     _media = new MediaList();
 }
 /// <summary>
 /// Creates a new CSS import rule
 /// </summary>
 internal CSSImportRule()
 {
     _media = new MediaList();
     _type = CssRule.Import;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new CSS @media rule with the given media list.
 /// </summary>
 /// <param name="media">The media list.</param>
 internal CSSMediaRule(MediaList media)
 {
     _media = media;
     _type = CssRuleType.Media;
 }