Esempio n. 1
0
 /// <summary>
 /// Creates an HTML style element.
 /// </summary>
 internal HTMLStyleElement()
 {
     _name = Tag;
     _sheet = new CSSStyleSheet();
     _sheet.OwnerNode = this;
     _children.ElementsChanged += OnChildrenChanged;
 }
Esempio n. 2
0
 public static void StyleFromSource(CSSStyleSheet sheet, String source)
 {
     if (sheet.Options.IsStyling)
     {
         var parser = new CssParser(sheet, source);
         parser.Parse();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Creates a new builder with the specified source.
        /// </summary>
        /// <param name="source">The code manager.</param>
        /// <param name="sheet">The document to fill.</param>
        /// <param name="options">Options to use for the document generation.</param>
        DocumentBuilder(SourceManager source, CSSStyleSheet sheet, DocumentOptions options)
        {
            sheet.Options = options;
            parser = new CssParser(sheet, source);
			parser.ErrorOccurred += ParseErrorOccurred;

			if (options.OnError != null)
				parser.ErrorOccurred += options.OnError;
        }
Esempio n. 4
0
        public static void StyleFromUrl(CSSStyleSheet sheet, String url)
        {
            //TODO we need the IoC container to resolve stream getters etc.
            return;

            var stream = Stream(url);
            var parser = new CssParser(sheet, stream);
            parser.Parse();
        }
Esempio n. 5
0
 public static async Task StyleFromUrl(CSSStyleSheet sheet, String url, CancellationToken cancel)
 {
     if (sheet.Options.IsStyling && Configuration.UseDefaultHttpRequester)
     {
         var stream = await GetFromUrl(url, cancel);
         var parser = new CssParser(sheet, stream);
         parser.Parse();
     }
 }
Esempio n. 6
0
 public static async Task StyleFromUrl(CSSStyleSheet sheet, String url, CancellationToken cancel)
 {
     if (sheet.Options.IsStyling)
     {
         var stream = await GetFromUrl(url, cancel);
         var parser = new CssParser(sheet, stream);
         parser.Parse();
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Creates a new CSS parser instance parser with the specified stylesheet
        /// based on the given source manager.
        /// </summary>
        /// <param name="stylesheet">The stylesheet to be constructed.</param>
        /// <param name="source">The source to use.</param>
        internal CssParser(CSSStyleSheet stylesheet, SourceManager source)
        {
            ignore = true;
            buffer = new StringBuilder();
            tokenizer = new CssTokenizer(source);

            tokenizer.ErrorOccurred += (s, ev) =>
            {
                if (ErrorOccurred != null)
                    ErrorOccurred(this, ev);
            };

            started = false;
            sheet = stylesheet;
            open = new Stack<CSSRule>();
        }
Esempio n. 8
0
 /// <summary>
 /// Creates a new CSS parser instance with the specified stylesheet
 /// based on the given stream.
 /// </summary>
 /// <param name="stylesheet">The stylesheet to be constructed.</param>
 /// <param name="stream">The stream to use as source.</param>
 public CssParser(CSSStyleSheet stylesheet, Stream stream)
     : this(stylesheet, new SourceManager(stream))
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Creates a new CSS parser instance with the specified stylesheet
 /// based on the given source.
 /// </summary>
 /// <param name="stylesheet">The stylesheet to be constructed.</param>
 /// <param name="source">The source code as a string.</param>
 public CssParser(CSSStyleSheet stylesheet, String source)
     : this(stylesheet, new SourceManager(source))
 {
 }
Esempio n. 10
0
 /// <summary>
 /// Creates a new HTML link element.
 /// </summary>
 internal HTMLLinkElement()
 {
     _name = Tag;
     _sheet = new CSSStyleSheet();
     _sheet.OwnerNode = this;
 }
Esempio n. 11
0
 /// <summary>
 /// Creates a new builder with the specified source.
 /// </summary>
 /// <param name="source">The code manager.</param>
 /// <param name="sheet">The document to fill.</param>
 DocumentBuilder(SourceManager source, CSSStyleSheet sheet)
 {
     parser = new CssParser(sheet, source);
     parser.ErrorOccurred += ParseErrorOccurred;
 }