Fix for bug 157123 -- fix laggy scrolling on Mac by backing off the timer interval from 10ms to 25ms. Also changed the timer to be a repeating timer, and removed some unused #defines. r=bness/pinkerton, sr=scc, a=scc

This commit is contained in:
sfraser%netscape.com 2002-08-02 22:15:27 +00:00
Родитель 8e001f3cf3
Коммит daeaa68f01
3 изменённых файлов: 8 добавлений и 14 удалений

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

@ -46,7 +46,7 @@
#if defined(XP_MAC) || defined(XP_MACOSX)
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 10
#define REPEAT_DELAY 25
#else
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 50
@ -55,6 +55,7 @@
nsRepeatService* nsRepeatService::gInstance = nsnull;
nsRepeatService::nsRepeatService()
: mFirstCall(PR_FALSE)
{
NS_INIT_REFCNT();
}
@ -91,14 +92,14 @@ void nsRepeatService::Start(nsITimerCallback* aCallback)
mRepeatTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
if (NS_OK == rv) {
mRepeatTimer->Init(this, INITAL_REPEAT_DELAY);
mRepeatTimer->Init(this, INITAL_REPEAT_DELAY, PR_TRUE, NS_TYPE_REPEATING_SLACK);
mFirstCall = PR_TRUE;
}
}
void nsRepeatService::Stop()
{
//printf("Stopping repeat timer\n");
if (mRepeatTimer) {
mRepeatTimer->Cancel();
mRepeatTimer = nsnull;
@ -108,19 +109,14 @@ void nsRepeatService::Stop()
NS_IMETHODIMP_(void) nsRepeatService::Notify(nsITimer *timer)
{
// if the repeat delay is the initial one reset it.
if (mRepeatTimer) {
mRepeatTimer->Cancel();
}
// do callback
if (mCallback)
mCallback->Notify(timer);
// start timer again.
if (mRepeatTimer) {
mRepeatTimer = do_CreateInstance("@mozilla.org/timer;1");
mRepeatTimer->Init(this, REPEAT_DELAY);
if (mFirstCall) {
mRepeatTimer->SetDelay(REPEAT_DELAY);
mFirstCall = PR_FALSE;
}
}

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

@ -68,6 +68,7 @@ protected:
private:
nsCOMPtr<nsITimerCallback> mCallback;
nsCOMPtr<nsITimer> mRepeatTimer;
PRBool mFirstCall;
static nsRepeatService* gInstance;
}; // class nsRepeatService

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

@ -52,9 +52,6 @@ class nsISupportsArray;
class nsITimer;
class nsSliderFrame;
#define INITAL_REPEAT_DELAY 500
#define REPEAT_DELAY 50
nsresult NS_NewSliderFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;