示例#1
0
 public override void apply_stylesheet(css stylesheet)
 {
     if (get_attr("href") != null)
     {
         _pseudo_classes.Add("link");
     }
     base.apply_stylesheet(stylesheet);
 }
示例#2
0
    public int getMinimalCssRuleCount(string[] xthml)
    {
        string s = "";

        foreach (string sss in xthml)
        {
            s += sss;
        }
        char[]   c  = new char[] { '<', '>' };
        string[] ss = s.Split(c, StringSplitOptions.RemoveEmptyEntries);
        //foreach(string sss in ss) Console.WriteLine(sss);
        dic    = new Dictionary <string, int>();
        tagdic = new Dictionary <string, int>();
        int i;

        for (i = 0; i < color.Length; i++)
        {
            dic[color[i]] = i;
        }
        for (i = 0; i < tag.Length; i++)
        {
            tagdic[tag[i]] = i;
        }
        css first = new css(7, 7);
        css now   = first;

        for (i = 0; i < ss.Length; i++)
        {
            string next = ss[i];
            if (next[0] == '/')
            {
                now = now.mother;
            }
            else
            {
                int color, tag;
                //<b id='x' style='color:red'
                char[]   newset = new char[] { ' ', ':', '\'' };
                string[] s1     = ss[i].Split(newset, StringSplitOptions.RemoveEmptyEntries);
                tag   = tagdic[s1[0]];
                color = dic[s1[s1.Length - 1]];
                css child = new css(color, tag);
                now.add(child);
                now = child;
            }
        }
        return(first.getnum());
    }
示例#3
0
 public int getMinimalCssRuleCount(string[] xthml)
 {
     string s = "";
     foreach (string sss in xthml) s += sss;
     char[] c = new char[] { '<', '>' };
     string[] ss = s.Split(c, StringSplitOptions.RemoveEmptyEntries);
     //foreach(string sss in ss) Console.WriteLine(sss);
     dic = new Dictionary<string, int>();
     tagdic = new Dictionary<string, int>();
     int i;
     for (i = 0; i < color.Length; i++) dic[color[i]] = i;
     for (i = 0; i < tag.Length; i++) tagdic[tag[i]] = i;
     css first = new css(7, 7);
     css now = first;
     for (i = 0; i < ss.Length; i++)
     {
         string next = ss[i];
         if (next[0] == '/')
         {
             now = now.mother;
         }
         else
         {
             int color, tag;
             //<b id='x' style='color:red'
             char[] newset = new char[] { ' ', ':', '\'' };
             string[] s1 = ss[i].Split(newset, StringSplitOptions.RemoveEmptyEntries);
             tag = tagdic[s1[0]];
             color = dic[s1[s1.Length - 1]];
             css child = new css(color, tag);
             now.add(child);
             now = child;
         }
     }
     return first.getnum();
 }
示例#4
0
 public void add(css child)
 {
     child.mother = this;
     li.Add(child);
 }
示例#5
0
 public void add(css child)
 {
     child.mother = this;
     li.Add(child);
 }