From 793da7dd6238ce156e29c71304e24b2c05edc11d Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 26 Feb 2020 20:51:22 +0100 Subject: Revert "Issue #1355 - Better way to create display items for column backgrounds" This reverts commit 44c47c50388f526c2d134e16d5debebe94a0faf8. --- layout/base/nsDisplayList.h | 95 +++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 68 deletions(-) (limited to 'layout/base/nsDisplayList.h') diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 9ae76e2ac..9cee7b517 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -48,7 +48,6 @@ class nsISelection; class nsIScrollableFrame; class nsDisplayLayerEventRegions; class nsDisplayScrollInfoLayer; -class nsDisplayTableBackgroundSet; class nsCaret; namespace mozilla { @@ -203,7 +202,6 @@ class nsDisplayListBuilder { : mAccumulatedTransform() , mAccumulatedRect() , mAccumulatedRectLevels(0) - , mVisibleRect(aOther.mVisibleRect) , mDirtyRect(aOther.mDirtyRect) {} // Accmulate transforms of ancestors on the preserves-3d chain. @@ -212,7 +210,6 @@ class nsDisplayListBuilder { nsRect mAccumulatedRect; // How far this frame is from the root of the current 3d context. int mAccumulatedRectLevels; - nsRect mVisibleRect; nsRect mDirtyRect; }; @@ -446,14 +443,7 @@ public: * Get dirty rect relative to current frame (the frame that we're calling * BuildDisplayList on right now). */ - const nsRect& GetVisibleRect() { return mVisibleRect; } const nsRect& GetDirtyRect() { return mDirtyRect; } - - void SetVisibleRect(const nsRect& aVisibleRect) { mVisibleRect = aVisibleRect; } - void IntersectVisibleRect(const nsRect& aVisibleRect) { mVisibleRect.IntersectRect(mVisibleRect, aVisibleRect); } - void SetDirtyRect(const nsRect& aDirtyRect) { mDirtyRect = aDirtyRect; } - void IntersectDirtyRect(const nsRect& aDirtyRect) { mDirtyRect.IntersectRect(mDirtyRect, aDirtyRect); } - const nsIFrame* GetCurrentFrame() { return mCurrentFrame; } const nsIFrame* GetCurrentReferenceFrame() { return mCurrentReferenceFrame; } const nsPoint& GetCurrentFrameOffsetToReferenceFrame() { return mCurrentOffsetToReferenceFrame; } @@ -503,10 +493,11 @@ public: /** * Display the caret if needed. */ - void DisplayCaret(nsIFrame* aFrame, nsDisplayList* aList) { + void DisplayCaret(nsIFrame* aFrame, const nsRect& aDirtyRect, + nsDisplayList* aList) { nsIFrame* frame = GetCaretFrame(); if (aFrame == frame) { - frame->DisplayCaret(this, aList); + frame->DisplayCaret(this, aDirtyRect, aList); } } /** @@ -526,15 +517,6 @@ public: * Get the caret associated with the current presshell. */ nsCaret* GetCaret(); - - /** - * Returns the root scroll frame for the current PresShell, if the PresShell - * is ignoring viewport scrolling. - */ - nsIFrame* GetPresShellIgnoreScrollFrame() { - return CurrentPresShellState()->mPresShellIgnoreScrollFrame; - } - /** * Notify the display list builder that we're entering a presshell. * aReferenceFrame should be a frame in the new presshell. @@ -595,16 +577,6 @@ public: mSyncDecodeImages = aSyncDecodeImages; } - nsDisplayTableBackgroundSet* SetTableBackgroundSet( - nsDisplayTableBackgroundSet* aTableSet) { - nsDisplayTableBackgroundSet* old = mTableBackgroundSet; - mTableBackgroundSet = aTableSet; - return old; - } - nsDisplayTableBackgroundSet* GetTableBackgroundSet() const { - return mTableBackgroundSet; - } - /** * Helper method to generate background painting flags based on the * information available in the display list builder. Currently only @@ -630,9 +602,8 @@ public: * destroyed. */ void MarkFramesForDisplayList(nsIFrame* aDirtyFrame, - const nsFrameList& aFrames); - void MarkFrameForDisplay(nsIFrame* aFrame, nsIFrame* aStopAtFrame = nullptr); - void MarkFrameForDisplayIfVisible(nsIFrame* aFrame, nsIFrame* aStopAtFrame = nullptr); + const nsFrameList& aFrames, + const nsRect& aDirtyRect); /** * Mark all child frames that Preserve3D() as needing display. * Because these frames include transforms set on their parent, dirty rects @@ -647,10 +618,9 @@ public: * the display list, even though it doesn't intersect the dirty * rect, because it may have out-of-flows that do so. */ - bool ShouldDescendIntoFrame(nsIFrame* aFrame, bool aVisible) const { + bool ShouldDescendIntoFrame(nsIFrame* aFrame) const { return (aFrame->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO) || - (aVisible && aFrame->ForceDescendIntoIfVisible()) || GetIncludeAllOutOfFlows(); } @@ -730,20 +700,14 @@ public: friend class AutoBuildingDisplayList; class AutoBuildingDisplayList { public: - AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild) - : AutoBuildingDisplayList( - aBuilder, aForChild, aBuilder->GetVisibleRect(), - aBuilder->GetDirtyRect(), aForChild->IsTransformed()){} - - AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild, - const nsRect& aVisibleRect, + AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, + nsIFrame* aForChild, const nsRect& aDirtyRect, bool aIsRoot) : mBuilder(aBuilder), mPrevFrame(aBuilder->mCurrentFrame), mPrevReferenceFrame(aBuilder->mCurrentReferenceFrame), mPrevLayerEventRegions(aBuilder->mLayerEventRegions), mPrevOffset(aBuilder->mCurrentOffsetToReferenceFrame), - mPrevVisibleRect(aBuilder->mVisibleRect), mPrevDirtyRect(aBuilder->mDirtyRect), mPrevAGR(aBuilder->mCurrentAGR), mPrevIsAtRootOfPseudoStackingContext(aBuilder->mIsAtRootOfPseudoStackingContext), @@ -769,10 +733,12 @@ public: } MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR)); aBuilder->mCurrentFrame = aForChild; - aBuilder->mVisibleRect = aVisibleRect; aBuilder->mDirtyRect = aDirtyRect; aBuilder->mIsAtRootOfPseudoStackingContext = aIsRoot; } + void SetDirtyRect(const nsRect& aRect) { + mBuilder->mDirtyRect = aRect; + } void SetReferenceFrameAndCurrentOffset(const nsIFrame* aFrame, const nsPoint& aOffset) { mBuilder->mCurrentReferenceFrame = aFrame; mBuilder->mCurrentOffsetToReferenceFrame = aOffset; @@ -794,7 +760,6 @@ public: mBuilder->mCurrentReferenceFrame = mPrevReferenceFrame; mBuilder->mLayerEventRegions = mPrevLayerEventRegions; mBuilder->mCurrentOffsetToReferenceFrame = mPrevOffset; - mBuilder->mVisibleRect = mPrevVisibleRect; mBuilder->mDirtyRect = mPrevDirtyRect; mBuilder->mCurrentAGR = mPrevAGR; mBuilder->mIsAtRootOfPseudoStackingContext = mPrevIsAtRootOfPseudoStackingContext; @@ -808,7 +773,6 @@ public: nsIFrame* mPrevAnimatedGeometryRoot; nsDisplayLayerEventRegions* mPrevLayerEventRegions; nsPoint mPrevOffset; - nsRect mPrevVisibleRect; nsRect mPrevDirtyRect; AnimatedGeometryRoot* mPrevAGR; bool mPrevIsAtRootOfPseudoStackingContext; @@ -1017,19 +981,20 @@ public: return mPreserves3DCtx.mAccumulatedRectLevels; } + // Helpers for tables + nsDisplayTableItem* GetCurrentTableItem() { return mCurrentTableItem; } + void SetCurrentTableItem(nsDisplayTableItem* aTableItem) { mCurrentTableItem = aTableItem; } + struct OutOfFlowDisplayData { OutOfFlowDisplayData(const DisplayItemClip* aContainingBlockClip, const DisplayItemScrollClip* aContainingBlockScrollClip, - const nsRect &aVisibleRect, const nsRect &aDirtyRect) : mContainingBlockClip(aContainingBlockClip ? *aContainingBlockClip : DisplayItemClip()) , mContainingBlockScrollClip(aContainingBlockScrollClip) - , mVisibleRect(aVisibleRect) , mDirtyRect(aDirtyRect) {} DisplayItemClip mContainingBlockClip; const DisplayItemScrollClip* mContainingBlockScrollClip; - nsRect mVisibleRect; nsRect mDirtyRect; }; @@ -1155,13 +1120,11 @@ public: Preserves3DContext mSavedCtx; }; - const nsRect GetPreserves3DRects(nsRect* aOutVisibleRect) const { - *aOutVisibleRect = mPreserves3DCtx.mVisibleRect; + const nsRect GetPreserves3DDirtyRect(const nsIFrame *aFrame) const { return mPreserves3DCtx.mDirtyRect; } - void SavePreserves3DRects() { - mPreserves3DCtx.mVisibleRect = mVisibleRect; - mPreserves3DCtx.mDirtyRect = mDirtyRect; + void SetPreserves3DDirtyRect(const nsRect &aDirtyRect) { + mPreserves3DCtx.mDirtyRect = aDirtyRect; } bool IsBuildingInvisibleItems() const { return mBuildingInvisibleItems; } @@ -1170,7 +1133,8 @@ public: } private: - void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame); + void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame, + const nsRect& aDirtyRect); /** * Returns whether a frame acts as an animated geometry root, optionally @@ -1210,7 +1174,6 @@ private: nsRect mCaretRect; uint32_t mFirstFrameMarkedForDisplay; bool mIsBackgroundOnly; - nsIFrame* mPresShellIgnoreScrollFrame; // This is a per-document flag turning off event handling for all content // in the document, and is set when we enter a subdocument for a pointer- // events:none frame. @@ -1239,6 +1202,7 @@ private: AutoTArray mPresShellStates; AutoTArray mFramesMarkedForDisplay; AutoTArray mThemeGeometries; + nsDisplayTableItem* mCurrentTableItem; DisplayListClipState mClipState; // mCurrentFrame is the frame that we're currently calling (or about to call) // BuildDisplayList on. @@ -1265,7 +1229,6 @@ private: nsTHashtable > mAGRBudgetSet; // Relative to mCurrentFrame. - nsRect mVisibleRect; nsRect mDirtyRect; nsRegion mWindowExcludeGlassRegion; nsRegion mWindowOpaqueRegion; @@ -1282,7 +1245,6 @@ private: nsTArray mScrollClipsToDestroy; nsTArray mDisplayItemClipsToDestroy; nsDisplayListBuilderMode mMode; - nsDisplayTableBackgroundSet* mTableBackgroundSet; ViewID mCurrentScrollParentId; ViewID mCurrentScrollbarTarget; uint32_t mCurrentScrollbarFlags; @@ -2325,13 +2287,12 @@ protected: * to the object, and all distinct. */ struct nsDisplayListCollection : public nsDisplayListSet { - explicit nsDisplayListCollection(nsDisplayListBuilder* aBuilder) - : nsDisplayListSet(&mLists[0], &mLists[1], &mLists[2], &mLists[3], &mLists[4], + nsDisplayListCollection() : + nsDisplayListSet(&mLists[0], &mLists[1], &mLists[2], &mLists[3], &mLists[4], + &mLists[5]) {} + explicit nsDisplayListCollection(nsDisplayList* aBorderBackground) : + nsDisplayListSet(aBorderBackground, &mLists[1], &mLists[2], &mLists[3], &mLists[4], &mLists[5]) {} - explicit nsDisplayListCollection(nsDisplayListBuilder* aBuilder, - nsDisplayList* aBorderBackground) - : nsDisplayListSet(aBorderBackground, &mLists[1], &mLists[2], &mLists[3], &mLists[4], - &mLists[5]) {} /** * Sort all lists by content order. @@ -2778,9 +2739,7 @@ public: bool aAllowWillPaintBorderOptimization = true, nsStyleContext* aStyleContext = nullptr, const nsRect& aBackgroundOriginRect = nsRect(), - nsIFrame* aSecondaryReferenceFrame = nullptr, - mozilla::Maybe* - aAutoBuildingDisplayList = nullptr); + nsIFrame* aSecondaryReferenceFrame = nullptr); virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, -- cgit v1.2.3