mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 282183 Port of toolkit's settable selection delay p=gautheri@noos.fr r+sr=me
This commit is contained in:
parent
6ad966abe0
commit
48b32cf88a
@ -40,7 +40,6 @@
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var els = this.getElementsByAttribute("selected", "true");
|
||||
this.selectedItems = [];
|
||||
for (var i = 0; i < els.length; ++i)
|
||||
this.selectedItems.push(els[i]);
|
||||
]]>
|
||||
@ -73,6 +72,10 @@
|
||||
onset="if (val) this.setAttribute('disableKeyNavigation', 'true');
|
||||
else this.removeAttribute('disableKeyNavigation'); return val;"/>
|
||||
|
||||
<property name="_selectDelay"
|
||||
onset="this.setAttribute('_selectDelay', val);"
|
||||
onget="return this.getAttribute('_selectDelay') || 50;"/>
|
||||
|
||||
<method name="timedSelect">
|
||||
<parameter name="item"/>
|
||||
<parameter name="timeout"/>
|
||||
@ -138,6 +141,7 @@
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<field name="selectedItems">[]</field>
|
||||
<property name="selectedItem">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.selectedItems[0] : null;
|
||||
@ -514,7 +518,7 @@
|
||||
var n = this.getPreviousItem(this.selectedItems[this.selectedItems.length-1], 1);
|
||||
if (n) {
|
||||
this.ensureIndexIsVisible(this.getIndexOfItem(n));
|
||||
this.timedSelect(n, 500);
|
||||
this.timedSelect(n, this._selectDelay);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
@ -532,7 +536,7 @@
|
||||
|
||||
if (n) {
|
||||
this.ensureIndexIsVisible(this.getIndexOfItem(n));
|
||||
this.timedSelect(n, 500);
|
||||
this.timedSelect(n, this._selectDelay);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
@ -598,7 +602,7 @@
|
||||
}
|
||||
this.scrollToIndex(newIndex);
|
||||
}
|
||||
this.timedSelect(n, 500);
|
||||
this.timedSelect(n, this._selectDelay);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_page_down" phase="target">
|
||||
@ -623,7 +627,7 @@
|
||||
}
|
||||
this.scrollToIndex(newIndex);
|
||||
}
|
||||
this.timedSelect(n, 500);
|
||||
this.timedSelect(n, this._selectDelay);
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_home" phase="target">
|
||||
@ -701,7 +705,7 @@
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
this.ensureIndexIsVisible(k);
|
||||
this.timedSelect(item, 500);
|
||||
this.timedSelect(item, this._selectDelay);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user