mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
Bug 1728251 - Remove mClip and compute it when we need it. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124008
This commit is contained in:
parent
e7b3614318
commit
51b371636c
@ -2771,8 +2771,7 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
aBuilder->GetVisibleRect().width >= 0 || !aBuilder->IsForPainting(),
|
||||
"visible rect not set");
|
||||
|
||||
nsDisplayItem::SetClipChain(
|
||||
aBuilder->ClipState().GetCurrentCombinedClipChain(aBuilder), true);
|
||||
mClipChain = aBuilder->ClipState().GetCurrentCombinedClipChain(aBuilder);
|
||||
|
||||
// The visible rect is for mCurrentFrame, so we have to use
|
||||
// mCurrentOffsetToReferenceFrame
|
||||
@ -2809,7 +2808,6 @@ int32_t nsDisplayItem::ZIndex() const { return mFrame->ZIndex().valueOr(0); }
|
||||
void nsDisplayItem::SetClipChain(const DisplayItemClipChain* aClipChain,
|
||||
bool aStore) {
|
||||
mClipChain = aClipChain;
|
||||
mClip = DisplayItemClipChain::ClipForASR(aClipChain, mActiveScrolledRoot);
|
||||
}
|
||||
|
||||
Maybe<nsRect> nsDisplayItem::GetClipWithRespectToASR(
|
||||
@ -2824,6 +2822,12 @@ Maybe<nsRect> nsDisplayItem::GetClipWithRespectToASR(
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
const DisplayItemClip& nsDisplayItem::GetClip() const {
|
||||
const DisplayItemClip* clip =
|
||||
DisplayItemClipChain::ClipForASR(mClipChain, mActiveScrolledRoot);
|
||||
return clip ? *clip : DisplayItemClip::NoClip();
|
||||
}
|
||||
|
||||
void nsDisplayItem::IntersectClip(nsDisplayListBuilder* aBuilder,
|
||||
const DisplayItemClipChain* aOther,
|
||||
bool aStore) {
|
||||
@ -5819,20 +5823,6 @@ nsDisplayStickyPosition::nsDisplayStickyPosition(
|
||||
MOZ_COUNT_CTOR(nsDisplayStickyPosition);
|
||||
}
|
||||
|
||||
void nsDisplayStickyPosition::SetClipChain(
|
||||
const DisplayItemClipChain* aClipChain, bool aStore) {
|
||||
mClipChain = aClipChain;
|
||||
mClip = nullptr;
|
||||
|
||||
MOZ_ASSERT(!mClip,
|
||||
"There should never be a clip on this item because no clip moves "
|
||||
"with it.");
|
||||
|
||||
if (aStore) {
|
||||
mOriginalClipChain = aClipChain;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the smallest distance from "0" to the range [min, max] where
|
||||
// min <= max. Despite the name, the return value is actually a 1-D vector,
|
||||
// and so may be negative if max < 0.
|
||||
|
@ -2387,8 +2387,7 @@ class nsDisplayItem : public nsDisplayItemLink {
|
||||
mToReferenceFrame(aOther.mToReferenceFrame),
|
||||
mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot),
|
||||
mActiveScrolledRoot(aOther.mActiveScrolledRoot),
|
||||
mClipChain(aOther.mClipChain),
|
||||
mClip(aOther.mClip) {
|
||||
mClipChain(aOther.mClipChain) {
|
||||
MOZ_COUNT_CTOR(nsDisplayItem);
|
||||
// TODO: It might be better to remove the flags that aren't copied.
|
||||
if (aOther.ForceNotVisible()) {
|
||||
@ -2841,9 +2840,7 @@ class nsDisplayItem : public nsDisplayItemLink {
|
||||
|
||||
virtual bool SupportsOptimizingToImage() const { return false; }
|
||||
|
||||
const DisplayItemClip& GetClip() const {
|
||||
return mClip ? *mClip : DisplayItemClip::NoClip();
|
||||
}
|
||||
virtual const DisplayItemClip& GetClip() const;
|
||||
void IntersectClip(nsDisplayListBuilder* aBuilder,
|
||||
const DisplayItemClipChain* aOther, bool aStore);
|
||||
|
||||
@ -2962,7 +2959,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
||||
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRoot;
|
||||
RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot;
|
||||
RefPtr<const DisplayItemClipChain> mClipChain;
|
||||
const DisplayItemClip* mClip = nullptr;
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
public:
|
||||
@ -5609,8 +5605,9 @@ class nsDisplayStickyPosition : public nsDisplayOwnLayer {
|
||||
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayStickyPosition)
|
||||
|
||||
void SetClipChain(const DisplayItemClipChain* aClipChain,
|
||||
bool aStore) override;
|
||||
const DisplayItemClip& GetClip() const override {
|
||||
return DisplayItemClip::NoClip();
|
||||
}
|
||||
bool IsClippedToDisplayPort() const { return mClippedToDisplayPort; }
|
||||
|
||||
NS_DISPLAY_DECL_NAME("StickyPosition", TYPE_STICKY_POSITION)
|
||||
|
Loading…
Reference in New Issue
Block a user