void ScrollbarActivity::ActivityStopped() { NS_ASSERTION(IsActivityOngoing(), "activity stopped while none was going on"); NS_ASSERTION(mIsActive, "need to be active during activity"); NS_ASSERTION(!mIsFading, "must not be fading during ongoing activity"); mNestedActivityCounter--; if (!IsActivityOngoing()) { StartFadeBeginTimer(); NS_ASSERTION(mIsActive, "need to be active right after activity"); NS_ASSERTION(!mIsFading, "must not be fading right after activity"); } }
void ScrollbarActivity::ActivityStopped() { if (!IsActivityOngoing()) { // This can happen if there was a frame reconstruction while the activity // was ongoing. In this case we just do nothing. We should probably handle // this case better. return; } NS_ASSERTION(mIsActive, "need to be active during activity"); NS_ASSERTION(!mIsFading, "must not be fading during ongoing activity"); mNestedActivityCounter--; if (!IsActivityOngoing()) { StartFadeBeginTimer(); NS_ASSERTION(mIsActive, "need to be active right after activity"); NS_ASSERTION(!mIsFading, "must not be fading right after activity"); } }
void ScrollbarActivity::WillRefresh(TimeStamp aTime) { NS_ASSERTION(mIsActive, "should only fade while scrollbars are visible"); NS_ASSERTION(!IsActivityOngoing(), "why weren't we unregistered from the refresh driver when scrollbar activity started?"); NS_ASSERTION(mIsFading, "should only animate fading during fade"); if (!UpdateOpacity(aTime)) { return; } if (!IsStillFading(aTime)) { EndFade(); } }
void ScrollbarActivity::BeginFade() { NS_ASSERTION(mIsActive, "can't begin fade when we're already inactive"); NS_ASSERTION(!IsActivityOngoing(), "why wasn't the fade begin timer cancelled when scrollbar activity started?"); NS_ASSERTION(!mIsFading, "shouldn't be fading just yet"); CancelFadeBeginTimer(); mFadeBeginTime = TimeStamp::Now(); if (!SetIsFading(true)) { return; } RegisterWithRefreshDriver(); NS_ASSERTION(mIsActive, "only fade while scrollbars are visible"); NS_ASSERTION(mIsFading, "should be fading now"); }
void ScrollbarActivity::EndFade() { NS_ASSERTION(mIsActive, "still need to be active at this point"); NS_ASSERTION(!IsActivityOngoing(), "why wasn't the fade end timer cancelled when scrollbar activity started?"); if (!SetIsFading(false)) { return; } SetIsActive(false); UnregisterFromRefreshDriver(); StopListeningForScrollbarEvents(); if (!mDisplayOnMouseMove) { StopListeningForScrollAreaEvents(); } NS_ASSERTION(!mIsActive, "should have gone inactive after fade end"); NS_ASSERTION(!mIsFading, "shouldn't be fading anymore"); }