mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 1363922 - Part 1: Remember about the reference frame during BuildDisplayList for ScrollFrameHelper so GetScrolledRect can use it. r=mstange
MozReview-Commit-ID: 8GO6xuSH5xY
This commit is contained in:
parent
ea56f9328d
commit
fe49d64a98
@ -3134,4 +3134,21 @@ public:
|
||||
nsCOMPtr<nsIAtom> mAttrName;
|
||||
};
|
||||
|
||||
// This class allows you to easily set any pointer variable and ensure it's
|
||||
// set to nullptr when leaving its scope.
|
||||
template<typename T>
|
||||
class MOZ_RAII SetAndNullOnExit
|
||||
{
|
||||
public:
|
||||
SetAndNullOnExit(T* &aVariable, T* aValue) {
|
||||
aVariable = aValue;
|
||||
mVariable = &aVariable;
|
||||
}
|
||||
~SetAndNullOnExit() {
|
||||
*mVariable = nullptr;
|
||||
}
|
||||
private:
|
||||
T** mVariable;
|
||||
};
|
||||
|
||||
#endif // nsLayoutUtils_h__
|
||||
|
@ -2006,6 +2006,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
|
||||
, mScrollCornerBox(nullptr)
|
||||
, mResizerBox(nullptr)
|
||||
, mOuter(aOuter)
|
||||
, mReferenceFrameDuringPainting(nullptr)
|
||||
, mAsyncScroll(nullptr)
|
||||
, mAsyncSmoothMSDScroll(nullptr)
|
||||
, mLastScrollOrigin(nsGkAtoms::other)
|
||||
@ -3263,6 +3264,7 @@ void
|
||||
ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists)
|
||||
{
|
||||
SetAndNullOnExit<const nsIFrame> tmpBuilder(mReferenceFrameDuringPainting, aBuilder->GetCurrentReferenceFrame());
|
||||
if (aBuilder->IsForFrameVisibility()) {
|
||||
NotifyApproximateFrameVisibilityUpdate(false);
|
||||
}
|
||||
@ -5866,7 +5868,8 @@ ScrollFrameHelper::GetScrolledRect() const
|
||||
// relative to the reference frame, since that's the space where painting does
|
||||
// snapping.
|
||||
nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
|
||||
nsIFrame* referenceFrame = nsLayoutUtils::GetReferenceFrame(mOuter);
|
||||
const nsIFrame* referenceFrame =
|
||||
mReferenceFrameDuringPainting ? mReferenceFrameDuringPainting : nsLayoutUtils::GetReferenceFrame(mOuter);
|
||||
nsPoint toReferenceFrame = mOuter->GetOffsetToCrossDoc(referenceFrame);
|
||||
nsRect scrollPort(mScrollPort.TopLeft() + toReferenceFrame, scrollPortSize);
|
||||
nsRect scrolledRect = result + scrollPort.TopLeft();
|
||||
|
@ -493,6 +493,7 @@ public:
|
||||
nsIFrame* mScrollCornerBox;
|
||||
nsIFrame* mResizerBox;
|
||||
nsContainerFrame* mOuter;
|
||||
const nsIFrame* mReferenceFrameDuringPainting;
|
||||
RefPtr<AsyncScroll> mAsyncScroll;
|
||||
RefPtr<AsyncSmoothMSDScroll> mAsyncSmoothMSDScroll;
|
||||
RefPtr<ScrollbarActivity> mScrollbarActivity;
|
||||
|
Loading…
Reference in New Issue
Block a user