mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 716793. Dispatch synthetic mousemove off the refresh driver, not as fast as we can. r=roc
We use Flush_Display here because mousemoves flush out layout, so we want to do the synthetic one after we've done our normal layout flushing
This commit is contained in:
parent
12b5bf3030
commit
4dd8e4b2c1
@ -5255,7 +5255,8 @@ void PresShell::SynthesizeMouseMove(bool aFromScroll)
|
||||
nsRefPtr<nsSynthMouseMoveEvent> ev =
|
||||
new nsSynthMouseMoveEvent(this, aFromScroll);
|
||||
|
||||
if (NS_FAILED(NS_DispatchToCurrentThread(ev))) {
|
||||
if (!GetPresContext()->RefreshDriver()->AddRefreshObserver(ev,
|
||||
Flush_Display)) {
|
||||
NS_WARNING("failed to dispatch nsSynthMouseMoveEvent");
|
||||
return;
|
||||
}
|
||||
|
@ -852,17 +852,28 @@ private:
|
||||
// over our window or there is no last observed mouse location for some
|
||||
// reason.
|
||||
nsPoint mMouseLocation;
|
||||
class nsSynthMouseMoveEvent : public nsRunnable {
|
||||
class nsSynthMouseMoveEvent : public nsARefreshObserver {
|
||||
public:
|
||||
nsSynthMouseMoveEvent(PresShell* aPresShell, bool aFromScroll)
|
||||
: mPresShell(aPresShell), mFromScroll(aFromScroll) {
|
||||
NS_ASSERTION(mPresShell, "null parameter");
|
||||
}
|
||||
void Revoke() { mPresShell = nsnull; }
|
||||
NS_IMETHOD Run() {
|
||||
~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) {
|
||||
if (mPresShell)
|
||||
mPresShell->ProcessSynthMouseMoveEvent(mFromScroll);
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
PresShell* mPresShell;
|
||||
|
Loading…
Reference in New Issue
Block a user