File: general.xml

package info (click to toggle)
iceweasel 2.0.0.19-0etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 298,784 kB
  • ctags: 317,912
  • sloc: cpp: 1,796,902; ansic: 987,677; xml: 109,036; makefile: 47,777; asm: 35,201; perl: 26,983; sh: 20,879; cs: 6,232; java: 5,513; python: 3,249; pascal: 459; lex: 306; php: 244; csh: 132; objc: 97; yacc: 79; ada: 49; awk: 14; sql: 4; sed: 4
file content (385 lines) | stat: -rw-r--r-- 14,983 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<?xml version="1.0"?>

<bindings id="generalBindings"
   xmlns="http://www.mozilla.org/xbl"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   xmlns:xbl="http://www.mozilla.org/xbl">

  <binding id="basecontrol">
    <implementation implements="nsIDOMXULControlElement">
      <!-- public implementation -->
      <property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
                                       else this.removeAttribute('disabled');
                                       return val;"
                                onget="return this.getAttribute('disabled') == 'true';"/>
      <property name="tabIndex" onget="return parseInt(this.getAttribute('tabindex'));"
                                onset="if (val) this.setAttribute('tabindex', val);
                                       else this.removeAttribute('tabindex'); return val;"/>
    </implementation>
  </binding>

  <binding id="basetext" extends="chrome://global/content/bindings/general.xml#basecontrol">
    <implementation>
      <!-- public implementation -->
      <property name="label"      onset="return this.setAttribute('label',val);"
                                  onget="return this.getAttribute('label');"/>
      <property name="crop"       onset="return this.setAttribute('crop',val);"
                                  onget="return this.getAttribute('crop');"/>
      <property name="image"      onset="return this.setAttribute('image',val);"
                                  onget="return this.getAttribute('image');"/>
      <property name="accessKey">
        <getter>
          <![CDATA[
            return this.labelElement ? this.labelElement.accessKey : this.getAttribute('accesskey');
          ]]>
        </getter>
        <setter>
          <![CDATA[
            // Always store on the control
            this.setAttribute('accesskey', val);
            // If there is a label, change the accesskey on the labelElement
            // if it's also set there
            if (this.labelElement) {
              this.labelElement.accessKey = val;
            }
            return val;
          ]]>
        </setter>
      </property>

      <field name="labelElement"/>
    </implementation>      
  </binding>

  <binding id="control-item" extends="chrome://global/content/bindings/general.xml#basetext">
    <implementation>
      <property name="value"      onset="return this.setAttribute('value', val);"
                                  onget="return this.getAttribute('value');"/>
    </implementation>
  </binding>

  <!--
    Inline Editable UI Element
    - This binding forms the basis of the inline edit treecell and the inline edit
    - buttons. 
    - TODO: investigate creating extensions to the wrapper widgets (tree, toolbar)
    -       to make them provide some object implementing an interface similar to
    -       tree's so we can build in some of the ILE behavior (such as going
    -       in and out of the mode, asking isEditable etc) so as to remove some of
    -       the burden from the implementor. 
    -
    - Note that this widget will be no longer used in the bookmarks window once 
    - tree is extended to have this functionality built in. 
    -->
  <binding id="inline-edit-base" extends="chrome://global/content/bindings/general.xml#basetext">
    <implementation>
      <field name="_mode">0</field>
      <method name="setMode">
        <parameter name="val"/>
        <body>
        <![CDATA[
          var ctr = document.getAnonymousElementByAttribute(this, "ileattr", "text-container");
          var txt = document.getAnonymousElementByAttribute(this, "ileattr", "text");
          this.setAttribute("mode", val);
          if (val == "edit") {
            var nodes = document.getAnonymousNodes(this);

            if (txt.getAttribute("hidden") != "true") {
              ctr.setAttribute("mode", "edit");
              var width = ctr.boxObject.width;
              txt.setAttribute("hidden", "true");
              const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
              var field = document.createElementNS(kXULNS, "textbox");
              field.className = "textbox-inline-edit";
              field.setAttribute("flex", "1");
              field.setAttribute("value", txt.getAttribute("value"));
              field.setAttribute("ileattr", "field");
              field.setAttribute("rootcontent", txt.getAttribute("rootcontent"));
              field.setAttribute("style", "width: " + width + "px");
              ctr.appendChild(field);
              field.addEventListener("keydown", this.fieldKeyDown, false);
              field.addEventListener("change", this.fieldChange, false);
              field.select();
            }
          }
          else {
            nodes = document.getAnonymousNodes(this);
            var fld = document.getAnonymousElementByAttribute(this, "ileattr", "field");
            if (fld && txt.getAttribute("hidden") == "true") {
              ctr.removeAttribute("mode");
              fld.blur();
              ctr.removeChild(fld);
              txt.removeAttribute("hidden");
            }
          }
        ]]>
        </body>
      </method>
      <field name="_observers">
      <![CDATA[
        ({
          reject: [], 
          accept: []
        })
      ]]>
      </field>
      <field name="valueIsRejected">false</field>
      <method name="addObserver">
        <parameter name="aObserver"/>
        <parameter name="aTopic"/>
        <parameter name="aParams"/>
        <body>
          this._observers[aTopic].push({ callback: aObserver, params: aParams });
        </body>
      </method>
      <method name="fieldKeyDown">
        <parameter name="aEvent"/>
        <body>
        <![CDATA[
          var rootLocalName = aEvent.target.getAttribute("rootcontent");
          if (rootLocalName) {
            // Root content is the bound element. 
            var rootContent = aEvent.target;
            while (rootContent && rootContent.localName != rootLocalName) 
              rootContent = rootContent.parentNode;
            
            if (rootContent) {
              var ctr = document.getAnonymousElementByAttribute(rootContent, "ileattr", "text-container");
              if (aEvent.keyCode == 13) {
                rootContent.valueIsRejected = false;
                rootContent.fieldChange(aEvent);
              }
              if (aEvent.keyCode == 27) {
                rootContent.valueIsRejected = true;
                var fld = document.getAnonymousElementByAttribute(rootContent, "ileattr", "field");
                for (i = 0; i < rootContent._observers["reject"].length; ++i) 
                  rootContent._observers["reject"][i].callback(rootContent._observers["reject"][i].params.concat(fld.value), "reject");
                if ("setMode" in rootContent) 
                  rootContent.setMode("normal");
              }
            }
          }
          aEvent.stopPropagation();
        ]]>
        </body>
      </method>
      <field name="valueIsAccepted">false</field>
      <method name="fieldChange">
        <parameter name="aEvent"/>
        <body>
        <![CDATA[
          var rootLocalName = this.getAttribute("rootcontent");
          if (rootLocalName) {
            // Root content is the bound element. 
            var rootContent = this;
            while (rootContent && rootContent.localName != rootLocalName) 
              rootContent = rootContent.parentNode;

            if (rootContent) {
              var ctr = document.getAnonymousElementByAttribute(rootContent, "ileattr", "text-container");
              if (!rootContent.valueIsRejected) {
                var fld = document.getAnonymousElementByAttribute(rootContent, "ileattr", "field");
                for (var i = 0; i < rootContent._observers["accept"].length; ++i)
                  rootContent._observers["accept"][i].callback(rootContent._observers["accept"][i].params.concat(fld.value), "accept");
                if ("setMode" in rootContent)
                  rootContent.setMode("normal");
              }
            }
          }
        ]]>
        </body>
      </method>
    </implementation>
  </binding>

  <!-- inline editable buttons -->
  <binding id="buttonleft-ile" extends="chrome://global/content/bindings/general.xml#inline-edit-base">
    <content>
      <xul:hbox class="button-internal-box" align="center" flex="1">
        <xul:image class="button-icon" xbl:inherits="src"/>
        <xul:hbox class="button-text-container" flex="1" ileattr="text-container">
          <xul:label class="button-text" xbl:inherits="value=label,accesskey,crop,dragover-top" ileattr="text" rootcontent="button" flex="1"/>
        </xul:hbox>
      </xul:hbox>
      <children includes="menupopup"/>
    </content>
  </binding>

  <binding id="iframe">
    <implementation implements="nsIAccessibleProvider">
      <property name="accessible">
        <getter>
          <![CDATA[
            var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
            return accService.createOuterDocAccessible(this);
          ]]>
        </getter>
      </property>
      <property name="docShell"
                readonly="true"
                onget="return this.boxObject.QueryInterface(Components.interfaces.nsIIFrameBoxObject).docShell"/>
      <property name="contentWindow"
                readonly="true"
                onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
      <property name="webNavigation"
                onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
                readonly="true"/>
      <property name="contentDocument" readonly="true"
                onget="return this.webNavigation.document;"/>
    </implementation>
  </binding>

  <binding id="statusbarpanel" display="xul:button">
    <content>
      <children>
        <xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop" crop="right" flex="1"/>
      </children>
    </content>

    <implementation>
      <property name="label"
                onget="return this.getAttribute('label');"
                onset="this.setAttribute('label',val); return val;"/>
      <property name="src"
                onget="return this.getAttribute('src');"
                onset="this.setAttribute('src',val); return val;"/>
    </implementation>
  </binding>

  <binding id="statusbarpanel-menu-iconic" display="xul:menu"
           extends="chrome://global/content/bindings/general.xml#statusbarpanel">
    <content>
      <xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
      <children/>
    </content>
  </binding>

  <binding id="statusbar">
    <content>
      <children/>
      <xul:statusbarpanel class="statusbar-resizerpanel">
        <xul:resizer dir="bottomright"/>
      </xul:statusbarpanel>
    </content>

    <implementation implements="nsIAccessibleProvider">
      <property name="accessible">
        <getter>
          <![CDATA[
            var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
            return accService.createXULStatusBarAccessible(this);
          ]]>
        </getter>
      </property>
    </implementation>
  </binding>
  
  <binding id="statusbarpanel-iconic" display="xul:button"
           extends="chrome://global/content/bindings/general.xml#statusbarpanel">
    <content>
      <xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
    </content>

    <implementation implements="nsIAccessibleProvider">
      <property name="accessible">
        <getter>
          <![CDATA[
            var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
            return accService.createXULButtonAccessible(this);
          ]]>
        </getter>
      </property>
    </implementation>
  </binding>

  <binding id="statusbarpanel-iconic-text" display="xul:button"
           extends="chrome://global/content/bindings/general.xml#statusbarpanel">
    <content>
      <xul:image class="statusbarpanel-icon" xbl:inherits="src"/>
      <xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop"/>
    </content>
  </binding>

  <binding id="image">
    <implementation implements="nsIDOMXULImageElement, nsIAccessibleProvider">
      <property name="src"
                onget="return this.getAttribute('src');"
                onset="this.setAttribute('src',val); return val;"/>
      <property name="accessible">
        <getter>
          <![CDATA[
            try {
              var accService = Components.classes["@mozilla.org/accessibilityService;1"]
                                         .getService(Components.interfaces.nsIAccessibilityService);
              return accService.createXULImageAccessible(this);
            }
            catch(ex) { /* no chrome privileges */ }

            return null;
          ]]>
        </getter>
      </property>
    </implementation>
  </binding>

  <binding id="deck">
    <implementation>
      <property name="selectedIndex"
                onget="return this.getAttribute('selectedIndex');">
        <setter>
        <![CDATA[
          if (this.selectedIndex == val)
            return val;
          this.setAttribute("selectedIndex", val);
          var event = document.createEvent('Events');
          event.initEvent('select', true, true);
          this.dispatchEvent(event);
          return val;
        ]]>
        </setter>
      </property>

      <property name="selectedPanel">
        <getter>
          <![CDATA[
            return this.childNodes[this.selectedIndex];
          ]]>
        </getter>

        <setter>
          <![CDATA[
            var selectedIndex = -1;
            for (var panel = val; panel != null; panel = panel.previousSibling)
              ++selectedIndex;
            this.selectedIndex = selectedIndex;
            return val;
          ]]>
        </setter>
      </property>
    </implementation>
  </binding>

  <binding id="dropmarker">
    <content>
      <xul:image class="dropmarker-icon"/>
    </content>

    <implementation implements="nsIAccessibleProvider">
      <property name="accessible">
        <getter>
          <![CDATA[
            try {
              var accService = Components.classes["@mozilla.org/accessibilityService;1"]
                                         .getService(Components.interfaces.nsIAccessibilityService);
              return accService.createXULDropmarkerAccessible(this);
            }
            catch(ex) { /* no chrome privileges */ }

            return null;
          ]]>
        </getter>
      </property>
    </implementation>
  </binding>

</bindings>