Ejemplo n.º 1
0
        private void FillMediaList(MediaList list, CssTokenType end, ref CssToken token)
        {
            _nodes.Push(list);

            if (token.Type != end)
            {
                while (token.Type != CssTokenType.EndOfFile)
                {
                    var medium = CreateMedium(ref token);

                    if (medium != null)
                    {
                        list.AppendChild(medium);
                    }

                    if (token.Type != CssTokenType.Comma)
                    {
                        break;
                    }

                    token = NextToken();
                    CollectTrivia(ref token);
                }

                if (token.Type != end || list.Length == 0)
                {
                    list.Clear();
                    list.AppendChild(new CssMedium
                    {
                        IsInverse = true,
                        Type = Keywords.All
                    });
                }
            }

            _nodes.Pop();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Before any medium has been found for the @media or @import rule.
        /// </summary>
        void FillMediaList(MediaList list, CssTokenType end, ref CssToken token)
        {
            if (token.Type == end)
                return;

            while (token.Type != CssTokenType.Eof)
            {
                var medium = CreateMedium(ref token);

                if (medium != null)
                    list.Add(medium);

                if (token.Type != CssTokenType.Comma)
                    break;

                token = _tokenizer.Get();
            }

            if (token.Type == end && list.Length > 0)
                return;

            list.Clear();
            list.Add(new CssMedium
            {
                IsInverse = true,
                Type = Keywords.All
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Before any medium has been found for the @media or @import rule.
        /// </summary>
        protected void FillMediaList(MediaList list, ref CssToken token)
        {
            if (token.Type != CssTokenType.CurlyBracketOpen)
            {
                while (token.Type != CssTokenType.Eof)
                {
                    var medium = CreateMedium(ref token);

                    if (medium != null)
                        list.Add(medium);

                    if (token.Type != CssTokenType.Comma)
                        break;

                    token = _tokenizer.Get();
                }

                if (token.Type != CssTokenType.CurlyBracketOpen)
                {
                    do
                    {
                        if (token.Type == CssTokenType.Eof || token.Type == CssTokenType.Semicolon)
                            break;

                        token = _tokenizer.Get();
                    }
                    while (token.Type != CssTokenType.CurlyBracketOpen);

                    list.Clear();
                }

                if (list.Length == 0)
                {
                    list.Add(new CssMedium
                    {
                        IsInverse = true,
                        Type = Keywords.All
                    });
                }
            }
        }