Bug 764188 - Expose a global frame tree generation number. r=dbaron
This generation number will be incremented every time that the frame tree for a presshell changes. Callers need to deal with the case where this value overflows. We use this to avoid a bunch of Android screenshotting.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "nsIDOMClientRect.h"
|
||||
#include "nsIDOMWakeLockListener.h"
|
||||
#include "nsIPowerManagerService.h"
|
||||
#include "nsFrameManager.h"
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/unused.h"
|
||||
@@ -117,6 +118,15 @@ class AfterPaintListener : public nsIDOMEventListener {
|
||||
}
|
||||
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent) {
|
||||
PRUint32 generation = nsFrameManager::GetGlobalGenerationNumber();
|
||||
if (mLastGeneration == generation) {
|
||||
// the frame tree has not changed since our last AfterPaint
|
||||
// so we can drop this event.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mLastGeneration = generation;
|
||||
|
||||
nsCOMPtr<nsIDOMNotifyPaintEvent> paintEvent = do_QueryInterface(aEvent);
|
||||
if (!paintEvent)
|
||||
return NS_OK;
|
||||
@@ -139,6 +149,7 @@ class AfterPaintListener : public nsIDOMEventListener {
|
||||
}
|
||||
|
||||
private:
|
||||
PRUint32 mLastGeneration;
|
||||
nsCOMPtr<nsIDOMEventTarget> mEventTarget;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user