summaryrefslogtreecommitdiffstats
path: root/layout/base
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2020-05-08 15:20:01 +0300
committerMoonchild <moonchild@palemoon.org>2020-05-20 13:48:52 +0000
commit71137783ac6927bd0dc02fce1d6e61e6ec027753 (patch)
treedd21b7bca3f68759de3f0bc96ef465ce0a13c83f /layout/base
parentfe0963002fb16b7e3e53f75004af0e79348c861c (diff)
downloadUXP-71137783ac6927bd0dc02fce1d6e61e6ec027753.tar
UXP-71137783ac6927bd0dc02fce1d6e61e6ec027753.tar.gz
UXP-71137783ac6927bd0dc02fce1d6e61e6ec027753.tar.lz
UXP-71137783ac6927bd0dc02fce1d6e61e6ec027753.tar.xz
UXP-71137783ac6927bd0dc02fce1d6e61e6ec027753.zip
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
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/nsDisplayList.cpp16
-rw-r--r--layout/base/nsDisplayList.h25
-rw-r--r--layout/base/nsLayoutUtils.cpp6
-rw-r--r--layout/base/nsPresShell.cpp4
4 files changed, 26 insertions, 25 deletions
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 8a34d108f..b08fe4219 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -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,
diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h
index 9cee7b517..e4fb57e8a 100644
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -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
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 04ac9ef52..fb0b42a6c 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3190,7 +3190,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
@@ -3539,7 +3540,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();
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 2615bbc49..63f512af4 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4898,8 +4898,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) {