Пример #1
0
 /// <summary>
 /// Parse the given stylesheet source to CSS blocks dictionary.<br/>
 /// The CSS blocks are organized into two level buckets of media type and class name.<br/>
 /// Root media type are found under 'all' bucket.<br/>
 /// The parsed css blocks are added to the given css data, merged if class name already exists.
 /// </summary>
 /// <param name="cssData">the CSS data to fill with parsed CSS objects</param>
 /// <param name="cssTextSource">raw css stylesheet to parse</param>
 public static void ParseStyleSheet(WebDom.CssActiveSheet cssData, string cssTextSource)
 {
     if (!String.IsNullOrEmpty(cssTextSource))
     {
         var parser = new WebDom.Parser.CssParser();
         parser.ParseCssStyleSheet(cssTextSource.ToCharArray());
         //-----------------------------------
         WebDom.CssDocument cssDoc = parser.OutputCssDocument;
         WebDom.CssActiveSheet cssActiveDoc = new WebDom.CssActiveSheet();
         cssActiveDoc.LoadCssDoc(cssDoc);
         if (cssData != null)
         {
             //merge ?
             cssData.Combine(cssActiveDoc);
         }
         else
         {
             //cssData.ActiveDoc = cssActiveDoc;
         }
     }
 }