mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 00:25:27 +00:00
91 lines
3.2 KiB
XML
91 lines
3.2 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<bindings id="progressmeterBindings"
|
|
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="progressmeter">
|
|
<resources>
|
|
<stylesheet src="chrome://global/skin/progressmeter.css"/>
|
|
</resources>
|
|
|
|
<content>
|
|
<xul:spacer class="progress-bar" xbl:inherits="mode"/>
|
|
<xul:spacer class="progress-remainder" xbl:inherits="mode"/>
|
|
</content>
|
|
|
|
<implementation implements="nsIAccessibleProvider">
|
|
<property name="label" onset="if (this.label != val) this.setAttribute('label',val); return val;"
|
|
onget="return this.getAttribute('label');"/>
|
|
|
|
<property name="mode" onset="if (this.mode != val) this.setAttribute('mode', val); return val;"
|
|
onget="return this.getAttribute('mode');"/>
|
|
|
|
<property name="value" onget="return this.getAttribute('value');">
|
|
<setter><![CDATA[
|
|
var p = Math.round(val);
|
|
var c = this.value;
|
|
if (p != c) {
|
|
var delta = p - c;
|
|
if (delta < 0)
|
|
delta = -delta;
|
|
if (delta > 3 || p == 0 || p == 100) {
|
|
this.setAttribute("value", p);
|
|
// Fire DOM event so that accessible value change events occur
|
|
var event = document.createEvent('Events');
|
|
event.initEvent('ValueChange', true, true);
|
|
this.dispatchEvent(event);
|
|
}
|
|
}
|
|
|
|
return p;
|
|
]]></setter>
|
|
</property>
|
|
|
|
<property name="accessible">
|
|
<getter>
|
|
<![CDATA[
|
|
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
|
return accService.createXULProgressMeterAccessible(this);
|
|
]]>
|
|
</getter>
|
|
</property>
|
|
</implementation>
|
|
</binding>
|
|
|
|
<binding id="progressmeter-undetermined"
|
|
extends="chrome://global/content/bindings/progressmeter.xml#progressmeter">
|
|
<content>
|
|
<xul:stack class="progress-remainder" flex="1" anonid="stack" style="overflow: -moz-hidden-unscrollable;">
|
|
<xul:spacer class="progress-bar" anonid="spacer" top="0" style="margin-right: -1000px;"/>
|
|
</xul:stack>
|
|
</content>
|
|
|
|
<implementation>
|
|
<method name="init">
|
|
<body><![CDATA[
|
|
var stack = document.getAnonymousElementByAttribute(this, "anonid", "stack");
|
|
var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
|
|
var position = -1;
|
|
var interval = setInterval(function nextStep() {
|
|
try {
|
|
spacer.height = stack.boxObject.height;
|
|
spacer.width = stack.boxObject.width >> 2;
|
|
spacer.left = spacer.width * position;
|
|
position += 30 / (stack.boxObject.width + 600);
|
|
if (position >= 4)
|
|
position = -1;
|
|
} catch (e) {
|
|
clearInterval(interval);
|
|
}
|
|
}, 10);
|
|
]]></body>
|
|
</method>
|
|
|
|
<constructor>this.init();</constructor>
|
|
</implementation>
|
|
</binding>
|
|
|
|
</bindings>
|