diff --git a/dom/events/WheelHandlingHelper.cpp b/dom/events/WheelHandlingHelper.cpp index 32b314128158..83e2d71ada72 100644 --- a/dom/events/WheelHandlingHelper.cpp +++ b/dom/events/WheelHandlingHelper.cpp @@ -100,7 +100,7 @@ nsMouseWheelTransaction::BeginTransaction(nsIFrame* aTargetFrame, NS_ASSERTION(!sTargetFrame, "previous transaction is not finished!"); MOZ_ASSERT(aEvent->message == NS_WHEEL_WHEEL, "Transaction must be started with a wheel event"); - nsScrollbarsForWheel::OwnWheelTransaction(false); + ScrollbarsForWheel::OwnWheelTransaction(false); sTargetFrame = aTargetFrame; sScrollSeriesCounter = 0; if (!UpdateTransaction(aEvent)) { @@ -140,8 +140,8 @@ nsMouseWheelTransaction::UpdateTransaction(WidgetWheelEvent* aEvent) void nsMouseWheelTransaction::MayEndTransaction() { - if (!sOwnScrollbars && nsScrollbarsForWheel::IsActive()) { - nsScrollbarsForWheel::OwnWheelTransaction(true); + if (!sOwnScrollbars && ScrollbarsForWheel::IsActive()) { + ScrollbarsForWheel::OwnWheelTransaction(true); } else { EndTransaction(); } @@ -156,8 +156,8 @@ nsMouseWheelTransaction::EndTransaction() sScrollSeriesCounter = 0; if (sOwnScrollbars) { sOwnScrollbars = false; - nsScrollbarsForWheel::OwnWheelTransaction(false); - nsScrollbarsForWheel::Inactivate(); + ScrollbarsForWheel::OwnWheelTransaction(false); + ScrollbarsForWheel::Inactivate(); } } @@ -395,26 +395,28 @@ nsMouseWheelTransaction::OverrideSystemScrollSpeed(WidgetWheelEvent* aEvent) return NS_FAILED(rv) ? DeltaValues(aEvent) : overriddenDeltaValues; } +namespace mozilla { + /******************************************************************/ -/* nsScrollbarsForWheel */ +/* mozilla::ScrollbarsForWheel */ /******************************************************************/ -const DeltaValues nsScrollbarsForWheel::directions[kNumberOfTargets] = { +const DeltaValues ScrollbarsForWheel::directions[kNumberOfTargets] = { DeltaValues(-1, 0), DeltaValues(+1, 0), DeltaValues(0, -1), DeltaValues(0, +1) }; -nsWeakFrame nsScrollbarsForWheel::sActiveOwner = nullptr; -nsWeakFrame nsScrollbarsForWheel::sActivatedScrollTargets[kNumberOfTargets] = { +nsWeakFrame ScrollbarsForWheel::sActiveOwner = nullptr; +nsWeakFrame ScrollbarsForWheel::sActivatedScrollTargets[kNumberOfTargets] = { nullptr, nullptr, nullptr, nullptr }; -bool nsScrollbarsForWheel::sHadWheelStart = false; -bool nsScrollbarsForWheel::sOwnWheelTransaction = false; +bool ScrollbarsForWheel::sHadWheelStart = false; +bool ScrollbarsForWheel::sOwnWheelTransaction = false; void -nsScrollbarsForWheel::PrepareToScrollText(nsEventStateManager* aESM, - nsIFrame* aTargetFrame, - WidgetWheelEvent* aEvent) +ScrollbarsForWheel::PrepareToScrollText(nsEventStateManager* aESM, + nsIFrame* aTargetFrame, + WidgetWheelEvent* aEvent) { if (aEvent->message == NS_WHEEL_START) { nsMouseWheelTransaction::OwnScrollbars(false); @@ -428,7 +430,7 @@ nsScrollbarsForWheel::PrepareToScrollText(nsEventStateManager* aESM, } void -nsScrollbarsForWheel::SetActiveScrollTarget(nsIScrollableFrame* aScrollTarget) +ScrollbarsForWheel::SetActiveScrollTarget(nsIScrollableFrame* aScrollTarget) { if (!sHadWheelStart) { return; @@ -443,7 +445,7 @@ nsScrollbarsForWheel::SetActiveScrollTarget(nsIScrollableFrame* aScrollTarget) } void -nsScrollbarsForWheel::MayInactivate() +ScrollbarsForWheel::MayInactivate() { if (!sOwnWheelTransaction && nsMouseWheelTransaction::GetTargetFrame()) { nsMouseWheelTransaction::OwnScrollbars(true); @@ -453,7 +455,7 @@ nsScrollbarsForWheel::MayInactivate() } void -nsScrollbarsForWheel::Inactivate() +ScrollbarsForWheel::Inactivate() { nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sActiveOwner); if (scrollbarOwner) { @@ -469,7 +471,7 @@ nsScrollbarsForWheel::Inactivate() } bool -nsScrollbarsForWheel::IsActive() +ScrollbarsForWheel::IsActive() { if (sActiveOwner) { return true; @@ -483,16 +485,16 @@ nsScrollbarsForWheel::IsActive() } void -nsScrollbarsForWheel::OwnWheelTransaction(bool aOwn) +ScrollbarsForWheel::OwnWheelTransaction(bool aOwn) { sOwnWheelTransaction = aOwn; } void -nsScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets( - nsEventStateManager* aESM, - nsIFrame* aTargetFrame, - WidgetWheelEvent* aEvent) +ScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets( + nsEventStateManager* aESM, + nsIFrame* aTargetFrame, + WidgetWheelEvent* aEvent) { for (size_t i = 0; i < kNumberOfTargets; i++) { const DeltaValues *dir = &directions[i]; @@ -511,7 +513,7 @@ nsScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets( } void -nsScrollbarsForWheel::DeactivateAllTemporarilyActivatedScrollTargets() +ScrollbarsForWheel::DeactivateAllTemporarilyActivatedScrollTargets() { for (size_t i = 0; i < kNumberOfTargets; i++) { nsWeakFrame* scrollTarget = &sActivatedScrollTargets[i]; @@ -524,3 +526,5 @@ nsScrollbarsForWheel::DeactivateAllTemporarilyActivatedScrollTargets() } } } + +} // namespace mozilla diff --git a/dom/events/WheelHandlingHelper.h b/dom/events/WheelHandlingHelper.h index 84fa591c474a..e639e18fc2fd 100644 --- a/dom/events/WheelHandlingHelper.h +++ b/dom/events/WheelHandlingHelper.h @@ -55,14 +55,12 @@ private: double aDirection); }; -} // namespace mozilla - -class nsScrollbarsForWheel +class ScrollbarsForWheel { public: static void PrepareToScrollText(nsEventStateManager* aESM, nsIFrame* aTargetFrame, - mozilla::WidgetWheelEvent* aEvent); + WidgetWheelEvent* aEvent); static void SetActiveScrollTarget(nsIScrollableFrame* aScrollTarget); // Hide all scrollbars (both mActiveOwner's and mActivatedScrollTargets') static void MayInactivate(); @@ -72,7 +70,7 @@ public: protected: static const size_t kNumberOfTargets = 4; - static const mozilla::DeltaValues directions[kNumberOfTargets]; + static const DeltaValues directions[kNumberOfTargets]; static nsWeakFrame sActiveOwner; static nsWeakFrame sActivatedScrollTargets[kNumberOfTargets]; static bool sHadWheelStart; @@ -86,10 +84,12 @@ protected: static void TemporarilyActivateAllPossibleScrollTargets( nsEventStateManager* aESM, nsIFrame* aTargetFrame, - mozilla::WidgetWheelEvent* aEvent); + WidgetWheelEvent* aEvent); static void DeactivateAllTemporarilyActivatedScrollTargets(); }; +} // namespace mozilla + class nsMouseWheelTransaction { public: diff --git a/dom/events/nsEventStateManager.cpp b/dom/events/nsEventStateManager.cpp index e9c34871a7a6..ddbc35b470cf 100644 --- a/dom/events/nsEventStateManager.cpp +++ b/dom/events/nsEventStateManager.cpp @@ -2843,7 +2843,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, case NS_WHEEL_STOP: { MOZ_ASSERT(aEvent->mFlags.mIsTrusted); - nsScrollbarsForWheel::MayInactivate(); + ScrollbarsForWheel::MayInactivate(); } break; case NS_WHEEL_WHEEL: @@ -2852,7 +2852,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, MOZ_ASSERT(aEvent->mFlags.mIsTrusted); if (*aStatus == nsEventStatus_eConsumeNoDefault) { - nsScrollbarsForWheel::Inactivate(); + ScrollbarsForWheel::Inactivate(); break; } @@ -2862,7 +2862,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, // For scrolling of default action, we should honor the mouse wheel // transaction. - nsScrollbarsForWheel::PrepareToScrollText(this, aTargetFrame, wheelEvent); + ScrollbarsForWheel::PrepareToScrollText(this, aTargetFrame, wheelEvent); if (aEvent->message != NS_WHEEL_WHEEL || (!wheelEvent->deltaX && !wheelEvent->deltaY)) { @@ -2873,7 +2873,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, ComputeScrollTarget(aTargetFrame, wheelEvent, COMPUTE_DEFAULT_ACTION_TARGET); - nsScrollbarsForWheel::SetActiveScrollTarget(scrollTarget); + ScrollbarsForWheel::SetActiveScrollTarget(scrollTarget); nsIFrame* rootScrollFrame = !aTargetFrame ? nullptr : aTargetFrame->PresContext()->PresShell()->GetRootScrollFrame(); @@ -2892,7 +2892,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, DoScrollText(scrollTarget, wheelEvent); } else { nsMouseWheelTransaction::EndTransaction(); - nsScrollbarsForWheel::Inactivate(); + ScrollbarsForWheel::Inactivate(); } break; } diff --git a/dom/events/nsEventStateManager.h b/dom/events/nsEventStateManager.h index 82c9924189c0..d94ba9074887 100644 --- a/dom/events/nsEventStateManager.h +++ b/dom/events/nsEventStateManager.h @@ -29,9 +29,9 @@ class nsIMarkupDocumentViewer; class nsIScrollableFrame; class nsITimer; class nsMouseWheelTransaction; -class nsScrollbarsForWheel; namespace mozilla { +class ScrollbarsForWheel; namespace dom { class DataTransfer; class TabParent; @@ -68,7 +68,7 @@ class nsEventStateManager : public nsSupportsWeakReference, public nsIObserver { friend class nsMouseWheelTransaction; - friend class nsScrollbarsForWheel; + friend class mozilla::ScrollbarsForWheel; public: typedef mozilla::TimeStamp TimeStamp;