Bug 1665332. Fetch the value of mZoomableByAPZ in the ScrollFrameHelper constructor so it is always correct. r=kats

Otherwise the only time it gets set is when the ZoomConstraintsClient specifically sets it in response to one of the things that can change it. But if the scroll frame gets reconstructed and one of those things don't happen it will be wrong.

This shows up with desktop zooming scrollbars because we check mZoomableByAPZ (or WantAsyncScroll()) before we use the apz scroll path in ScrollFrameHelper::ScrollBy().

Differential Revision: https://phabricator.services.mozilla.com/D90384
This commit is contained in:
Timothy Nikkel 2020-09-22 11:21:39 +00:00
parent ffe6596576
commit b40f06a081
4 changed files with 12 additions and 0 deletions

View File

@ -11756,3 +11756,7 @@ void PresShell::EndPaint() {
void PresShell::PingPerTickTelemetry(FlushType aFlushType) {
mLayoutTelemetry.PingPerTickTelemetry(aFlushType);
}
bool PresShell::GetZoomableByAPZ() const {
return mZoomConstraintsClient && mZoomConstraintsClient->GetAllowZoom();
}

View File

@ -1680,6 +1680,8 @@ class PresShell final : public nsStubDocumentObserver,
nsIFrame* GetDrawEventTargetFrame() { return mDrawEventTargetFrame; }
#endif
bool GetZoomableByAPZ() const;
private:
~PresShell();

View File

@ -39,6 +39,8 @@ class ZoomConstraintsClient final : public nsIDOMEventListener,
void Destroy();
void ScreenSizeChanged();
bool GetAllowZoom() const { return mZoomConstraints.mAllowZoom; }
private:
void RefreshZoomConstraints();

View File

@ -2225,6 +2225,10 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot)
mOuter->GetContent(), mOuter->PresShell(), ScreenMargin(), 0);
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(mOuter);
}
if (mIsRoot) {
mZoomableByAPZ = mOuter->PresShell()->GetZoomableByAPZ();
}
}
ScrollFrameHelper::~ScrollFrameHelper() {