Bug 740883 - Coalesce VIEWPORT events across NATIVE_POKE and DRAW events on insertion. r=Cwiiis

This commit is contained in:
Kartikaya Gupta
2012-04-10 09:28:43 -05:00
parent 2e1ecb7814
commit 061e8b11cc

View File

@@ -517,6 +517,11 @@ void
nsAppShell::PostEvent(AndroidGeckoEvent *ae)
{
{
// set this to true when inserting events that we can coalesce
// viewport events across. this is effectively maintaining a whitelist
// of events that are unaffected by viewport changes.
bool allowCoalescingNextViewport = false;
MutexAutoLock lock(mQueueLock);
EVLOG("nsAppShell::PostEvent %p %d", ae, ae->Type());
switch (ae->Type()) {
@@ -586,6 +591,9 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
} else {
mQueuedDrawEvent = ae;
}
allowCoalescingNextViewport = true;
mEventQueue.AppendElement(ae);
break;
@@ -600,6 +608,7 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
// temporarily turn off draw-coalescing, so that we process a draw
// event as soon as possible after a viewport change
mAllowCoalescingNextDraw = false;
allowCoalescingNextViewport = true;
mEventQueue.AppendElement(ae);
break;
@@ -620,10 +629,20 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
mEventQueue.AppendElement(ae);
break;
case AndroidGeckoEvent::NATIVE_POKE:
allowCoalescingNextViewport = true;
// fall through
default:
mEventQueue.AppendElement(ae);
break;
}
// if the event wasn't on our whitelist then reset mQueuedViewportEvent
// so that we don't coalesce future viewport events into the last viewport
// event we added
if (!allowCoalescingNextViewport)
mQueuedViewportEvent = nsnull;
}
NotifyNativeEvent();
}