зеркало из https://github.com/mozilla/gecko-dev.git
Bug 769857 - Add a small delay before the tap highlight [r=wesj]
--HG-- extra : rebase_source : e58c938afd1cb66b9bf108a2a70547c0b21382fe
This commit is contained in:
Родитель
48cd407401
Коммит
d8ef23851b
|
@ -3236,6 +3236,8 @@ Tab.prototype = {
|
|||
])
|
||||
};
|
||||
|
||||
const kTapHighlightDelay = 50; // milliseconds
|
||||
|
||||
var BrowserEventHandler = {
|
||||
init: function init() {
|
||||
Services.obs.addObserver(this, "Gesture:SingleTap", false);
|
||||
|
@ -3467,12 +3469,22 @@ var BrowserEventHandler = {
|
|||
|
||||
_highlightElement: null,
|
||||
|
||||
_highlightTimeout: null,
|
||||
|
||||
_doTapHighlight: function _doTapHighlight(aElement) {
|
||||
DOMUtils.setContentState(aElement, kStateActive);
|
||||
this._highlightElement = aElement;
|
||||
this._cancelTapHighlight();
|
||||
this._highlightTimeout = setTimeout(function(self) {
|
||||
DOMUtils.setContentState(aElement, kStateActive);
|
||||
self._highlightElement = aElement;
|
||||
}, kTapHighlightDelay, this);
|
||||
},
|
||||
|
||||
_cancelTapHighlight: function _cancelTapHighlight() {
|
||||
if (this._highlightTimeout) {
|
||||
clearTimeout(this._highlightTimeout);
|
||||
this._highlightTimeout = null;
|
||||
}
|
||||
|
||||
if (!this._highlightElement)
|
||||
return;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче