Bug 575870 - Enable the firefox button on xp themed, classic, and aero basic. r=dao...
[mozilla-central.git] / layout / generic / frame-verify.js
blob78596aee5c3c45ba14e55f10378fa34a1dbc9832
1 /**
2  * graph-frameclasses.js: a dehydra script to collect information about
3  * the class hierarchy of frame types.
4  */
6 function inheritsFrom(t, baseName)
8   let name = t.name;
9   if (name == baseName)
10     return true;
11   
12   for each (let base in t.bases)
13     if (inheritsFrom(base.type, baseName))
14       return true;
15     
16   return false;
17 }  
19 let output = [];
21 function process_type(t)
23   if ((t.kind == "class" || t.kind == "struct")) {
24     if (!t.isIncomplete && inheritsFrom(t, 'nsIFrame')) {
25       if (inheritsFrom(t, 'nsISupports'))
26         warning("nsIFrame derivative %s inherits from nsISupports but is not refcounted.".format(t.name), t.loc);
27       
28       let nonFrameBases = [];
29       
30       output.push('CLASS-DEF: %s'.format(t.name));
32       for each (let base in t.bases) {
33         if (inheritsFrom(base.type, 'nsIFrame')) {
34           output.push('%s -> %s;'.format(base.type.name, t.name));
35         }
36         else if (base.type.name != 'nsQueryFrame') {
37           nonFrameBases.push(base.type.name);
38         }
39       }
40       
41       output.push('%s [label="%s%s"];'.format(t.name, t.name,
42                                               ["\\n(%s)".format(b) for each (b in nonFrameBases)].join('')));
43     }
44   }
47 let frameIIDRE = /::kFrameIID$/;
48 let queryFrameRE = /^do_QueryFrame::operator/;
50 /* A list of class names T that have do_QueryFrame<T> used */
51 let needIDs = [];
53 /* A map of class names that have a kFrameIID declared */
54 let haveIDs = {};
56 // We match up needIDs with haveIDs at the end because static variables are
57 // not present in the .members array of a type
59 function process_tree_decl(d)
61   d = dehydra_convert(d);
62   
63   if (d.name && frameIIDRE(d.name)) {
64     haveIDs[d.memberOf.name] = 1;
65   }
68 function process_cp_pre_genericize(d)
70   d = dehydra_convert(d);
71   if (queryFrameRE(d.name) && d.template === undefined) {
72     let templtype = d.type.type.type;
73     while (templtype.typedef !== undefined)
74       templtype = templtype.typedef;
75       
76     needIDs.push([templtype.name, d.loc]);
77   }
80 function input_end()
82   for each (let [name, loc] in needIDs) {
83     if (!haveIDs.hasOwnProperty(name)) {
84       error("nsQueryFrame<%s> found, but %s::kFrameIID is not declared".format(name, name), loc);
85     }
86   }
88   if (output.length > 0) {
89     write_file(sys.aux_base_name + '.framedata', output.join('\n'));
90   }