Jeff Muizelaar 2012-04-20 00:50:07 -04:00
Родитель 8b561bf5ad
Коммит e89aabbd0d
2 изменённых файлов: 16 добавлений и 30 удалений

Просмотреть файл

@ -397,6 +397,22 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
break; break;
} }
case AndroidGeckoEvent::VIEWPORT:
case AndroidGeckoEvent::BROADCAST: {
if (curEvent->Characters().Length() == 0)
break;
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
const NS_ConvertUTF16toUTF8 topic(curEvent->Characters());
const nsPromiseFlatString& data = PromiseFlatString(curEvent->CharactersExtra());
obsServ->NotifyObservers(nsnull, topic.get(), data.get());
break;
}
case AndroidGeckoEvent::LOAD_URI: { case AndroidGeckoEvent::LOAD_URI: {
nsCOMPtr<nsICommandLineRunner> cmdline nsCOMPtr<nsICommandLineRunner> cmdline
(do_CreateInstance("@mozilla.org/toolkit/command-line;1")); (do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
@ -648,7 +664,6 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
if (!allowCoalescingNextViewport) if (!allowCoalescingNextViewport)
mQueuedViewportEvent = nsnull; mQueuedViewportEvent = nsnull;
} }
NotifyNativeEvent(); NotifyNativeEvent();
} }

Просмотреть файл

@ -82,7 +82,6 @@ using mozilla::unused;
#include "imgIEncoder.h" #include "imgIEncoder.h"
#include "nsStringGlue.h" #include "nsStringGlue.h"
#include "nsAutoPtr.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::widget; using namespace mozilla::widget;
@ -894,34 +893,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
win->mFocus->OnKeyEvent(ae); win->mFocus->OnKeyEvent(ae);
break; break;
case AndroidGeckoEvent::VIEWPORT:
case AndroidGeckoEvent::BROADCAST: {
if (ae->Characters().Length() == 0)
break;
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
const NS_ConvertUTF16toUTF8 topic(ae->Characters());
const nsPromiseFlatString& data = PromiseFlatString(ae->CharactersExtra());
obsServ->NotifyObservers(nsnull, topic.get(), data.get());
if (ae->Type() == AndroidGeckoEvent::VIEWPORT) {
// We know that we've caused a complete invalidation
// and don't want to wait for the refresh driver
// to kick off a draw so we start one now.
// There are other smaller invalidations for touch hilighting that
// happen earlier so we don't necessarily want to have the
// refresh driver naively start a paint when we get the first
// invalidation.
nsIntRect rect(0, 0, win->mBounds.width, win->mBounds.height);
nsAutoPtr<AndroidGeckoEvent> event(new AndroidGeckoEvent(AndroidGeckoEvent::DRAW, rect));
win->OnDraw(event);
}
break;
}
case AndroidGeckoEvent::DRAW: case AndroidGeckoEvent::DRAW:
layers::renderTraceEventStart("Global draw start", "414141"); layers::renderTraceEventStart("Global draw start", "414141");
win->OnDraw(ae); win->OnDraw(ae);