summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/generic/nsFrame.cpp')
-rw-r--r--layout/generic/nsFrame.cpp65
1 files changed, 32 insertions, 33 deletions
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 6b0848e74..0bcc3f4c7 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1815,7 +1815,7 @@ nsFrame::DisplayOutline(nsDisplayListBuilder* aBuilder,
void
nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder,
- const nsRect& aDirtyRect, nsDisplayList* aList)
+ nsDisplayList* aList)
{
if (!IsVisibleForPainting(aBuilder))
return;
@@ -2074,13 +2074,12 @@ ItemParticipatesIn3DContext(nsIFrame* aAncestor, nsDisplayItem* aItem)
static void
WrapSeparatorTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
- nsRect& aDirtyRect,
nsDisplayList* aSource, nsDisplayList* aTarget,
int aIndex) {
if (!aSource->IsEmpty()) {
nsDisplayTransform *sepIdItem =
new (aBuilder) nsDisplayTransform(aBuilder, aFrame, aSource,
- aDirtyRect, Matrix4x4(), aIndex);
+ aBuilder->GetDirtyRect(), Matrix4x4(), aIndex);
sepIdItem->SetNoExtendContext();
aTarget->AppendToTop(sepIdItem);
}
@@ -2088,7 +2087,6 @@ WrapSeparatorTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
void
nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
- const nsRect& aDirtyRect,
nsDisplayList* aList) {
if (GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
return;
@@ -2132,13 +2130,13 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
autoPreserves3DContext.emplace(aBuilder);
// Save dirty rect on the builder to avoid being distorted for
// multiple transforms along the chain.
- aBuilder->SetPreserves3DDirtyRect(aDirtyRect);
+ aBuilder->SavePreserves3DRects();
}
// For preserves3d, use the dirty rect already installed on the
// builder, since aDirtyRect maybe distorted for transforms along
// the chain.
- nsRect dirtyRect = aDirtyRect;
+ nsRect dirtyRect = aBuilder->GetDirtyRect();
bool inTransform = aBuilder->IsInTransform();
bool isTransformed = IsTransformed();
@@ -2163,7 +2161,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
// If we're in preserve-3d then grab the dirty rect that was given to the root
// and transform using the combined transform.
if (Combines3DTransformWithAncestors()) {
- dirtyRect = aBuilder->GetPreserves3DDirtyRect(this);
+ dirtyRect = aBuilder->GetPreserves3DRects();
}
nsRect untransformedDirtyRect;
@@ -2283,7 +2281,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
Maybe<nsRect> clipPropClip = GetClipPropClipRect(disp, effects, GetSize());
if (clipPropClip) {
- dirtyRect.IntersectRect(dirtyRect, *clipPropClip);
+ aBuilder->IntersectDirtyRect(*clipPropClip);
nestedClipState.ClipContentDescendants(
*clipPropClip + aBuilder->ToReferenceFrame(this));
}
@@ -2296,7 +2294,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
aBuilder->MarkPreserve3DFramesForDisplayList(this);
}
- MarkAbsoluteFramesForDisplayList(aBuilder, dirtyRect);
+ MarkAbsoluteFramesForDisplayList(aBuilder);
nsDisplayLayerEventRegions* eventRegions = nullptr;
if (aBuilder->IsBuildingLayerEventRegions()) {
@@ -2305,7 +2303,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
aBuilder->SetLayerEventRegions(eventRegions);
}
aBuilder->AdjustWindowDraggingRegion(this);
- BuildDisplayList(aBuilder, dirtyRect, set);
+ BuildDisplayList(aBuilder, set);
if (eventRegions) {
// If the event regions item ended up empty, throw it away rather than
// adding it to the display list.
@@ -2411,7 +2409,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
clipState.ExitStackingContextContents(&containerItemScrollClip);
}
// Revert to the post-filter dirty rect.
- buildingDisplayList.SetDirtyRect(dirtyRectOutsideSVGEffects);
+ aBuilder->SetDirtyRect(dirtyRectOutsideSVGEffects);
// Skip all filter effects while generating glyph mask.
if (usingFilter && !aBuilder->IsForGenerateGlyphMask()) {
@@ -2476,8 +2474,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
while (nsDisplayItem* item = resultList.RemoveBottom()) {
if (ItemParticipatesIn3DContext(this, item) && !item->GetClip().HasClip()) {
// The frame of this item participates the same 3D context.
- WrapSeparatorTransform(aBuilder, this, dirtyRect,
- &nonparticipants, &participants, index++);
+ WrapSeparatorTransform(aBuilder, this, &nonparticipants, &participants, index++);
participants.AppendToTop(item);
} else {
// The frame of the item doesn't participate the current
@@ -2490,8 +2487,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
nonparticipants.AppendToTop(item);
}
}
- WrapSeparatorTransform(aBuilder, this, dirtyRect,
- &nonparticipants, &participants, index++);
+ WrapSeparatorTransform(aBuilder, this, &nonparticipants, &participants, index++);
resultList.AppendToTop(&participants);
}
@@ -2502,7 +2498,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
}
// Revert to the dirtyrect coming in from the parent, without our transform
// taken into account.
- buildingDisplayList.SetDirtyRect(dirtyRectOutsideTransform);
+ aBuilder->SetDirtyRect(dirtyRectOutsideTransform);
// Revert to the outer reference frame and offset because all display
// items we create from now on are outside the transform.
nsPoint toOuterReferenceFrame;
@@ -2606,7 +2602,6 @@ WrapInWrapList(nsDisplayListBuilder* aBuilder,
void
nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
nsIFrame* aChild,
- const nsRect& aDirtyRect,
const nsDisplayListSet& aLists,
uint32_t aFlags) {
// If painting is restricted to just the background of the top level frame,
@@ -2639,12 +2634,15 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
pseudoStackingContext = true;
}
- // dirty rect in child-relative coordinates
- nsRect dirty = aDirtyRect - child->GetOffsetTo(this);
-
nsIAtom* childType = child->GetType();
nsDisplayListBuilder::OutOfFlowDisplayData* savedOutOfFlowData = nullptr;
bool isPlaceholder = false;
+
+ // dirty rect in child-relative coordinates
+ NS_ASSERTION(aBuilder->GetCurrentFrame() == this, "Wrong coord space!");
+ nsPoint offset = child->GetOffsetTo(this);
+ nsRect dirty = aBuilder->GetDirtyRect() - offset;
+
if (childType == nsGkAtoms::placeholderFrame) {
isPlaceholder = true;
nsPlaceholderFrame* placeholder = static_cast<nsPlaceholderFrame*>(child);
@@ -2712,8 +2710,9 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
(shell->IgnoringViewportScrolling() && child == shell->GetRootScrollFrame());
if (!keepDescending) {
nsRect childDirty;
- if (!childDirty.IntersectRect(dirty, child->GetVisualOverflowRect()))
+ if (!childDirty.IntersectRect(dirty, child->GetVisualOverflowRect())) {
return;
+ }
// Usually we could set dirty to childDirty now but there's no
// benefit, and it can be confusing. It can especially confuse
// situations where we're going to ignore a scrollframe's clipping;
@@ -2773,6 +2772,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
nsDisplayListBuilder::AutoBuildingDisplayList
buildingForChild(aBuilder, child, dirty, pseudoStackingContext);
+
DisplayListClipState::AutoClipMultiple clipState(aBuilder);
CheckForApzAwareEventHandlers(aBuilder, child);
@@ -2785,7 +2785,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
savedOutOfFlowData->mContainingBlockScrollClip);
} else if (GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO &&
isPlaceholder) {
- NS_ASSERTION(dirty.IsEmpty(), "should have empty dirty rect");
+ NS_ASSERTION(dirty.IsEmpty(), "should have empty visible rect");
// Every item we build from now until we descent into an out of flow that
// does have saved out of flow data should be invisible. This state gets
// restored when AutoBuildingDisplayList gets out of scope.
@@ -2821,18 +2821,18 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
// True stacking context.
// For stacking contexts, BuildDisplayListForStackingContext handles
// clipping and MarkAbsoluteFramesForDisplayList.
- child->BuildDisplayListForStackingContext(aBuilder, dirty, &list);
- aBuilder->DisplayCaret(child, dirty, &list);
+ child->BuildDisplayListForStackingContext(aBuilder, &list);
+ aBuilder->DisplayCaret(child, &list);
} else {
Maybe<nsRect> clipPropClip =
child->GetClipPropClipRect(disp, effects, child->GetSize());
if (clipPropClip) {
- dirty.IntersectRect(dirty, *clipPropClip);
+ aBuilder->IntersectDirtyRect(*clipPropClip);
clipState.ClipContentDescendants(
*clipPropClip + aBuilder->ToReferenceFrame(child));
}
- child->MarkAbsoluteFramesForDisplayList(aBuilder, dirty);
+ child->MarkAbsoluteFramesForDisplayList(aBuilder);
if (aBuilder->IsBuildingLayerEventRegions()) {
// If this frame has a different animated geometry root than its parent,
@@ -2864,8 +2864,8 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
// return early.
aBuilder->AdjustWindowDraggingRegion(child);
- child->BuildDisplayList(aBuilder, dirty, aLists);
- aBuilder->DisplayCaret(child, dirty, aLists.Content());
+ child->BuildDisplayList(aBuilder, aLists);
+ aBuilder->DisplayCaret(child, aLists.Content());
#ifdef DEBUG
DisplayDebugBorders(aBuilder, child, aLists);
#endif
@@ -2878,8 +2878,8 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
// z-index:non-auto
nsDisplayListCollection pseudoStack;
aBuilder->AdjustWindowDraggingRegion(child);
- child->BuildDisplayList(aBuilder, dirty, pseudoStack);
- aBuilder->DisplayCaret(child, dirty, pseudoStack.Content());
+ child->BuildDisplayList(aBuilder, pseudoStack);
+ aBuilder->DisplayCaret(child, pseudoStack.Content());
list.AppendToTop(pseudoStack.BorderBackground());
list.AppendToTop(pseudoStack.BlockBorderBackgrounds());
@@ -2929,11 +2929,10 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
}
void
-nsIFrame::MarkAbsoluteFramesForDisplayList(nsDisplayListBuilder* aBuilder,
- const nsRect& aDirtyRect)
+nsIFrame::MarkAbsoluteFramesForDisplayList(nsDisplayListBuilder* aBuilder)
{
if (IsAbsoluteContainer()) {
- aBuilder->MarkFramesForDisplayList(this, GetAbsoluteContainingBlock()->GetChildList(), aDirtyRect);
+ aBuilder->MarkFramesForDisplayList(this, GetAbsoluteContainingBlock()->GetChildList());
}
}