Bug 863702 - [B2G] :active state is sometime not rendered if you tap quickly. r=fabrice

This commit is contained in:
Vivien Nicolas 2013-10-17 09:18:13 +02:00
parent 9bf1bff8b4
commit d433e8a1e8
2 changed files with 28 additions and 0 deletions

View File

@ -78,6 +78,13 @@ const ContentPanning = {
return;
}
let start = Date.now();
let thread = Services.tm.currentThread;
while (this._delayEvents && (Date.now() - start) < this._activeDurationMs) {
thread.processNextEvent(true);
}
this._delayEvents = false;
switch (evt.type) {
case 'mousedown':
case 'touchstart':
@ -229,6 +236,16 @@ const ContentPanning = {
// We prevent end events to avoid sending a focus event. See bug 889717.
evt.preventDefault();
}
} else if (this.target && click && !this.panning) {
this.notify(this._activationTimer);
this._delayEvents = true;
let start = Date.now();
let thread = Services.tm.currentThread;
while (this._delayEvents && (Date.now() - start) < this._activeDurationMs) {
thread.processNextEvent(true);
}
this._delayEvents = false;
}
this._finishPanning();
@ -467,6 +484,12 @@ const ContentPanning = {
return this._activationDelayMs = delay;
},
get _activeDurationMs() {
let duration = Services.prefs.getIntPref('ui.touch_activation.duration_ms');
delete this._activeDurationMs;
return this._activeDurationMs = duration;
},
_resetActive: function cp_resetActive() {
let elt = this.target || this.pointerDownTarget;
let root = elt.ownerDocument || elt.document;

View File

@ -4428,6 +4428,11 @@ pref("mms.debugging.enabled", false);
// the target element?
pref("ui.touch_activation.delay_ms", 100);
// If the user has clicked an element, how long do we keep the
// :active state before it is cleared by the mouse sequences
// fired after a touchstart/touchend.
pref("ui.touch_activation.duration_ms", 100);
// nsMemoryInfoDumper can watch a fifo in the temp directory and take various
// actions when the fifo is written to. Disable this in general.
pref("memory_info_dumper.watch_fifo", false);