Issue #1355 - Store the dirty rect on the display list builder rather than passing it as a parameter to BuildDisplayList

Also fix build bustage for De-unified layout/xul in nsRootBoxFrame.cpp
This commit is contained in:
win7-7 2020-05-08 15:20:01 +03:00 committed by Roy Tam
commit 85b85bac28
154 changed files with 259 additions and 430 deletions

View file

@ -864,10 +864,9 @@ nsDisplayListBuilder::FindAnimatedGeometryRootFor(nsDisplayItem* aItem)
void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame,
nsIFrame* aFrame,
const nsRect& aDirtyRect)
nsIFrame* aFrame)
{
nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
nsRect dirtyRectRelativeToDirtyFrame = GetDirtyRect();
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
IsPaintingToWindow()) {
NS_ASSERTION(aDirtyFrame == aFrame->GetParent(), "Dirty frame should be viewport frame");
@ -882,7 +881,9 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame,
dirtyRectRelativeToDirtyFrame.SizeTo(aDirtyFrame->GetSize());
}
}
nsRect dirty = dirtyRectRelativeToDirtyFrame - aFrame->GetOffsetTo(aDirtyFrame);
nsPoint offset = aFrame->GetOffsetTo(aDirtyFrame);
nsRect dirty = dirtyRectRelativeToDirtyFrame - offset;
nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (aFrame->IsTransformed() &&
@ -1094,8 +1095,7 @@ nsDisplayListBuilder::ResetMarkedFramesForDisplayList()
void
nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame,
const nsFrameList& aFrames,
const nsRect& aDirtyRect) {
const nsFrameList& aFrames) {
for (nsIFrame* e : aFrames) {
// Skip the AccessibleCaret frame when building no caret.
if (!IsBuildingCaret()) {
@ -1107,9 +1107,8 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame,
}
}
}
mFramesMarkedForDisplay.AppendElement(e);
MarkOutOfFlowFrameForDisplay(aDirtyFrame, e, aDirtyRect);
MarkOutOfFlowFrameForDisplay(aDirtyFrame, e);
}
}
@ -2626,7 +2625,6 @@ SpecialCutoutRegionCase(nsDisplayListBuilder* aBuilder,
return true;
}
/*static*/ bool
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,

View file

@ -444,6 +444,10 @@ public:
* BuildDisplayList on right now).
*/
const nsRect& GetDirtyRect() { return mDirtyRect; }
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; }
@ -493,11 +497,10 @@ public:
/**
* Display the caret if needed.
*/
void DisplayCaret(nsIFrame* aFrame, const nsRect& aDirtyRect,
nsDisplayList* aList) {
void DisplayCaret(nsIFrame* aFrame, nsDisplayList* aList) {
nsIFrame* frame = GetCaretFrame();
if (aFrame == frame) {
frame->DisplayCaret(this, aDirtyRect, aList);
frame->DisplayCaret(this, aList);
}
}
/**
@ -602,8 +605,7 @@ public:
* destroyed.
*/
void MarkFramesForDisplayList(nsIFrame* aDirtyFrame,
const nsFrameList& aFrames,
const nsRect& aDirtyRect);
const nsFrameList& aFrames);
/**
* Mark all child frames that Preserve3D() as needing display.
* Because these frames include transforms set on their parent, dirty rects
@ -700,8 +702,8 @@ public:
friend class AutoBuildingDisplayList;
class AutoBuildingDisplayList {
public:
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder,
nsIFrame* aForChild,
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aDirtyRect, bool aIsRoot)
: mBuilder(aBuilder),
mPrevFrame(aBuilder->mCurrentFrame),
@ -1120,11 +1122,11 @@ public:
Preserves3DContext mSavedCtx;
};
const nsRect GetPreserves3DDirtyRect(const nsIFrame *aFrame) const {
const nsRect GetPreserves3DRects() const {
return mPreserves3DCtx.mDirtyRect;
}
void SetPreserves3DDirtyRect(const nsRect &aDirtyRect) {
mPreserves3DCtx.mDirtyRect = aDirtyRect;
void SavePreserves3DRects() {
mPreserves3DCtx.mDirtyRect = mDirtyRect;
}
bool IsBuildingInvisibleItems() const { return mBuildingInvisibleItems; }
@ -1133,8 +1135,7 @@ public:
}
private:
void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
const nsRect& aDirtyRect);
void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame);
/**
* Returns whether a frame acts as an animated geometry root, optionally

View file

@ -3111,7 +3111,8 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
}
builder.EnterPresShell(aFrame);
aFrame->BuildDisplayListForStackingContext(&builder, aRect, &list);
builder.SetDirtyRect(aRect);
aFrame->BuildDisplayListForStackingContext(&builder, &list);
builder.LeavePresShell(aFrame, nullptr);
#ifdef MOZ_DUMP_PAINTING
@ -3460,7 +3461,8 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
PROFILER_LABEL("nsLayoutUtils", "PaintFrame::BuildDisplayList",
js::ProfileEntry::Category::GRAPHICS);
aFrame->BuildDisplayListForStackingContext(&builder, dirtyRect, &list);
builder.SetDirtyRect(dirtyRect);
aFrame->BuildDisplayListForStackingContext(&builder, &list);
}
nsIAtom* frameType = aFrame->GetType();

View file

@ -4868,8 +4868,8 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
// XXX deal with frame being null due to display:contents
for (; frame; frame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(frame)) {
frame->BuildDisplayListForStackingContext(&info->mBuilder,
frame->GetVisualOverflowRect(), &info->mList);
info->mBuilder.SetDirtyRect(frame->GetVisualOverflowRect());
frame->BuildDisplayListForStackingContext(&info->mBuilder, &info->mList);
}
};
if (startParent->NodeType() == nsIDOMNode::TEXT_NODE) {