Exemplo n.º 1
0
 /// <summary>
 /// Creates an HTML style element.
 /// </summary>
 internal HTMLStyleElement()
 {
     _name = Tag;
     _sheet = new CSSStyleSheet();
     _sheet.OwnerNode = this;
     _children.ElementsChanged += OnChildrenChanged;
 }
Exemplo n.º 2
0
 public static void StyleFromSource(CSSStyleSheet sheet, String source)
 {
     if (sheet.Options.IsStyling)
     {
         var parser = new CssParser(sheet, source);
         parser.Parse();
     }
 }
Exemplo 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;
        }
Exemplo 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();
        }
Exemplo 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();
     }
 }
Exemplo 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();
     }
 }
Exemplo 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>();
        }
Exemplo 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))
 {
 }
Exemplo 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))
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a new HTML link element.
 /// </summary>
 internal HTMLLinkElement()
 {
     _name = Tag;
     _sheet = new CSSStyleSheet();
     _sheet.OwnerNode = this;
 }
Exemplo 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;
 }