Bug 990907 - Add a flag on nsIScrollableFrame to indicate if it is actively being scrolled by APZ. r=tn

This commit is contained in:
Kartikaya Gupta 2015-02-25 09:32:09 -05:00
parent 655c3f565f
commit 98767506c5
4 changed files with 35 additions and 0 deletions

View File

@ -249,6 +249,9 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
case APZStateChange::TransformBegin:
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
if (sf) {
sf->SetTransformingByAPZ(true);
}
nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(sf);
if (scrollbarMediator) {
scrollbarMediator->ScrollbarActivityStarted();
@ -266,6 +269,9 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
case APZStateChange::TransformEnd:
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
if (sf) {
sf->SetTransformingByAPZ(false);
}
nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(sf);
if (scrollbarMediator) {
scrollbarMediator->ScrollbarActivityStopped();

View File

@ -1896,6 +1896,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
, mHasBeenScrolled(false)
, mIsResolutionSet(false)
, mScaleToResolution(false)
, mTransformingByAPZ(false)
{
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
mScrollbarActivity = new ScrollbarActivity(do_QueryFrame(aOuter));

View File

@ -324,6 +324,13 @@ public:
void MarkNotRecentlyScrolled();
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
void SetTransformingByAPZ(bool aTransforming) {
mTransformingByAPZ = aTransforming;
}
bool IsTransformingByAPZ() const {
return mTransformingByAPZ;
}
void ScheduleSyntheticMouseMove();
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
@ -466,6 +473,10 @@ public:
// Only meaningful for root scroll frames.
bool mScaleToResolution:1;
// True if the APZ is in the process of async-transforming this scrollframe,
// (as best as we can tell on the main thread, anyway).
bool mTransformingByAPZ:1;
protected:
/**
* @note This method might destroy the frame, pres shell and other objects.
@ -811,6 +822,13 @@ public:
}
virtual void ScrollbarActivityStarted() const MOZ_OVERRIDE;
virtual void ScrollbarActivityStopped() const MOZ_OVERRIDE;
virtual void SetTransformingByAPZ(bool aTransforming) MOZ_OVERRIDE {
mHelper.SetTransformingByAPZ(aTransforming);
}
bool IsTransformingByAPZ() const MOZ_OVERRIDE {
return mHelper.IsTransformingByAPZ();
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
@ -1181,6 +1199,13 @@ public:
virtual void ScrollbarActivityStarted() const MOZ_OVERRIDE;
virtual void ScrollbarActivityStopped() const MOZ_OVERRIDE;
virtual void SetTransformingByAPZ(bool aTransforming) MOZ_OVERRIDE {
mHelper.SetTransformingByAPZ(aTransforming);
}
bool IsTransformingByAPZ() const MOZ_OVERRIDE {
return mHelper.IsTransformingByAPZ();
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif

View File

@ -397,6 +397,9 @@ public:
* Mark the scrollbar frames for reflow.
*/
virtual void MarkScrollbarsDirtyForReflow() const = 0;
virtual void SetTransformingByAPZ(bool aTransforming) = 0;
virtual bool IsTransformingByAPZ() const = 0;
};
#endif