mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1181135 - Copy DisplayItemClips in order to avoid dangling pointers. r=tn
This commit is contained in:
parent
9bcea3c39d
commit
ea041c6ffb
@ -3670,7 +3670,7 @@ GetScrollClipIntersection(nsDisplayListBuilder* aBuilder, const nsIFrame* aAnima
|
||||
continue;
|
||||
}
|
||||
|
||||
const DisplayItemClip* clip = scrollFrame->ComputeScrollClip(aIsCaret);
|
||||
Maybe<DisplayItemClip> clip = scrollFrame->ComputeScrollClip(aIsCaret);
|
||||
if (clip) {
|
||||
resultClip.IntersectWith(*clip);
|
||||
}
|
||||
@ -4542,7 +4542,7 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry)
|
||||
}
|
||||
|
||||
FrameMetrics& metrics = info->metrics;
|
||||
const DisplayItemClip* clip = info->clip;
|
||||
Maybe<DisplayItemClip> clip = info->clip;
|
||||
|
||||
if (clip &&
|
||||
clip->HasClip() &&
|
||||
|
@ -1806,8 +1806,6 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
|
||||
, mResolution(1.0)
|
||||
, mScrollPosForLayerPixelAlignment(-1, -1)
|
||||
, mLastUpdateImagesPos(-1, -1)
|
||||
, mAncestorClip(nullptr)
|
||||
, mAncestorClipForCaret(nullptr)
|
||||
, mNeverHasVerticalScrollbar(false)
|
||||
, mNeverHasHorizontalScrollbar(false)
|
||||
, mHasVerticalScrollbar(false)
|
||||
@ -2786,8 +2784,8 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
// Clear the scroll port clip that was set during the last paint.
|
||||
mAncestorClip = nullptr;
|
||||
mAncestorClipForCaret = nullptr;
|
||||
mAncestorClip = Nothing();
|
||||
mAncestorClipForCaret = Nothing();
|
||||
|
||||
// We put non-overlay scrollbars in their own layers when this is the root
|
||||
// scroll frame and we are a toplevel content document. In this situation,
|
||||
@ -3028,7 +3026,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// Capture the clip state of the parent scroll frame. This will be saved
|
||||
// on FrameMetrics for layers with this frame as their animated geoemetry
|
||||
// root.
|
||||
mAncestorClipForCaret = aBuilder->ClipState().GetCurrentCombinedClip(aBuilder);
|
||||
mAncestorClipForCaret = ToMaybe(aBuilder->ClipState().GetCurrentCombinedClip(aBuilder));
|
||||
|
||||
// Add the non-caret content box clip here so that it gets picked up by
|
||||
// mAncestorClip.
|
||||
@ -3041,7 +3039,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
clipStateNonCaret->ClipContainingBlockDescendants(*contentBoxClipForNonCaretContent);
|
||||
}
|
||||
}
|
||||
mAncestorClip = aBuilder->ClipState().GetCurrentCombinedClip(aBuilder);
|
||||
mAncestorClip = ToMaybe(aBuilder->ClipState().GetCurrentCombinedClip(aBuilder));
|
||||
|
||||
// If we are using a display port, then ignore any pre-existing clip
|
||||
// passed down from our parents. The pre-existing clip would just defeat
|
||||
@ -3121,12 +3119,12 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
scrolledContent.MoveTo(aLists);
|
||||
}
|
||||
|
||||
const DisplayItemClip*
|
||||
Maybe<DisplayItemClip>
|
||||
ScrollFrameHelper::ComputeScrollClip(bool aIsForCaret) const
|
||||
{
|
||||
const DisplayItemClip* ancestorClip = aIsForCaret ? mAncestorClipForCaret : mAncestorClip;
|
||||
const Maybe<DisplayItemClip>& ancestorClip = aIsForCaret ? mAncestorClipForCaret : mAncestorClip;
|
||||
if (!mShouldBuildScrollableLayer || mIsScrollableLayerInRootContainer) {
|
||||
return nullptr;
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
return ancestorClip;
|
||||
@ -3148,7 +3146,7 @@ ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer,
|
||||
needsParentLayerClip = false;
|
||||
}
|
||||
|
||||
const DisplayItemClip* ancestorClip = aIsForCaret ? mAncestorClipForCaret : mAncestorClip;
|
||||
const Maybe<DisplayItemClip>& ancestorClip = aIsForCaret ? mAncestorClipForCaret : mAncestorClip;
|
||||
|
||||
nsPoint toReferenceFrame = mOuter->GetOffsetToCrossDoc(aContainerReferenceFrame);
|
||||
bool isRootContent = mIsRoot && mOuter->PresContext()->IsRootContentDocument();
|
||||
|
@ -382,7 +382,7 @@ public:
|
||||
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
||||
const ContainerLayerParameters& aParameters,
|
||||
bool aIsForCaret) const;
|
||||
virtual const mozilla::DisplayItemClip* ComputeScrollClip(bool aIsForCaret) const;
|
||||
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) const;
|
||||
|
||||
// nsIScrollbarMediator
|
||||
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
@ -461,9 +461,9 @@ public:
|
||||
|
||||
FrameMetrics::ViewID mScrollParentID;
|
||||
|
||||
// The scroll port clip. Only valid during painting.
|
||||
const DisplayItemClip* mAncestorClip;
|
||||
const DisplayItemClip* mAncestorClipForCaret;
|
||||
// The scroll port clip.
|
||||
Maybe<DisplayItemClip> mAncestorClip;
|
||||
Maybe<DisplayItemClip> mAncestorClipForCaret;
|
||||
|
||||
bool mNeverHasVerticalScrollbar:1;
|
||||
bool mNeverHasHorizontalScrollbar:1;
|
||||
@ -845,7 +845,7 @@ public:
|
||||
{
|
||||
return mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame, aParameters, aIsForCaret);
|
||||
}
|
||||
virtual const mozilla::DisplayItemClip* ComputeScrollClip(bool aIsForCaret) const override
|
||||
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) const override
|
||||
{
|
||||
return mHelper.ComputeScrollClip(aIsForCaret);
|
||||
}
|
||||
@ -1245,7 +1245,7 @@ public:
|
||||
{
|
||||
return mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame, aParameters, aIsForCaret);
|
||||
}
|
||||
virtual const mozilla::DisplayItemClip* ComputeScrollClip(bool aIsForCaret) const override
|
||||
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) const override
|
||||
{
|
||||
return mHelper.ComputeScrollClip(aIsForCaret);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define nsIScrollFrame_h___
|
||||
|
||||
#include "nsCoord.h"
|
||||
#include "DisplayItemClip.h"
|
||||
#include "ScrollbarStyles.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
@ -32,7 +33,6 @@ class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
struct ContainerLayerParameters;
|
||||
class DisplayItemClip;
|
||||
namespace layers {
|
||||
class Layer;
|
||||
} // namespace layers
|
||||
@ -40,7 +40,7 @@ class Layer;
|
||||
struct FrameMetricsAndClip
|
||||
{
|
||||
layers::FrameMetrics metrics;
|
||||
const DisplayItemClip* clip;
|
||||
mozilla::Maybe<DisplayItemClip> clip;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
@ -449,7 +449,7 @@ public:
|
||||
*/
|
||||
virtual bool UsesContainerScrolling() const = 0;
|
||||
|
||||
virtual const mozilla::DisplayItemClip* ComputeScrollClip(bool aIsForCaret) const = 0;
|
||||
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user