Back out rev 2a35bcdd7c1e (bug 716793) to fix orange tests

This commit is contained in:
Boris Zbarsky 2012-01-10 02:00:17 -05:00
parent 2f61f3ff7a
commit 9d2b67a38b
2 changed files with 5 additions and 17 deletions

View File

@ -5255,8 +5255,7 @@ void PresShell::SynthesizeMouseMove(bool aFromScroll)
nsRefPtr<nsSynthMouseMoveEvent> ev =
new nsSynthMouseMoveEvent(this, aFromScroll);
if (!GetPresContext()->RefreshDriver()->AddRefreshObserver(ev,
Flush_Display)) {
if (NS_FAILED(NS_DispatchToCurrentThread(ev))) {
NS_WARNING("failed to dispatch nsSynthMouseMoveEvent");
return;
}

View File

@ -852,28 +852,17 @@ private:
// over our window or there is no last observed mouse location for some
// reason.
nsPoint mMouseLocation;
class nsSynthMouseMoveEvent : public nsARefreshObserver {
class nsSynthMouseMoveEvent : public nsRunnable {
public:
nsSynthMouseMoveEvent(PresShell* aPresShell, bool aFromScroll)
: mPresShell(aPresShell), mFromScroll(aFromScroll) {
NS_ASSERTION(mPresShell, "null parameter");
}
~nsSynthMouseMoveEvent() {
Revoke();
}
NS_INLINE_DECL_REFCOUNTING(nsSynthMouseMoveEvent)
void Revoke() {
if (mPresShell) {
mPresShell->GetPresContext()->RefreshDriver()->
RemoveRefreshObserver(this, Flush_Display);
mPresShell = nsnull;
}
}
virtual void WillRefresh(mozilla::TimeStamp aTime) {
void Revoke() { mPresShell = nsnull; }
NS_IMETHOD Run() {
if (mPresShell)
mPresShell->ProcessSynthMouseMoveEvent(mFromScroll);
return NS_OK;
}
private:
PresShell* mPresShell;