public override CssRule Create(CssToken current)
        {
            var token = _tokenizer.Get();
            var rule = new CssFontFaceRule(_parser);

            if (token.Type != CssTokenType.CurlyBracketOpen)
                return SkipDeclarations(token);

            FillFontFaceDeclarations(rule);
            return rule;
        }
        void FillFontFaceDeclarations(CssFontFaceRule rule)
        {
            var token = _tokenizer.Get();

            while (token.IsNot(CssTokenType.Eof, CssTokenType.CurlyBracketClose))
            {
                var property = CreateDeclarationWith(CreateProperty, ref token);

                if (property != null && property.HasValue)
                    rule.SetProperty(property);
            }
        }
Example #3
0
        public CssRule CreateFontFace(CssToken current)
        {
            var token = _tokenizer.Get();
            var rule = new CssFontFaceRule(_parser);

            if (token.Type != CssTokenType.CurlyBracketOpen)
                return SkipDeclarations(token);

            FillDeclarations(rule, Factory.Properties.CreateFont);
            return rule;
        }
Example #4
0
        public CssRule CreateFontFace(CssToken current)
        {
            var rule = new CssFontFaceRule(_parser);
            var start = current.Position;
            var token = NextToken();
            _nodes.Push(rule);
            CollectTrivia(ref token);

            if (token.Type == CssTokenType.CurlyBracketOpen)
            {
                var end = FillDeclarations(rule, Factory.Properties.CreateFont);
                rule.SourceCode = CreateView(start, end);
                _nodes.Pop();
                return rule;
            }

            _nodes.Pop();
            return SkipDeclarations(token);
        }