diff options
author | win7-7 <win7-7@users.noreply.github.com> | 2020-05-08 15:20:01 +0300 |
---|---|---|
committer | win7-7 <win7-7@users.noreply.github.com> | 2020-05-08 15:20:01 +0300 |
commit | f102e7f80d5d7c972e7619c3f9efe7460918c6d4 (patch) | |
tree | 5dd8ad7581b00ebeb8195405de2e1f2496376942 /layout/generic/nsFrame.cpp | |
parent | 257e62db993cec43d1ec650a8a33b3e25139cbc2 (diff) | |
download | UXP-f102e7f80d5d7c972e7619c3f9efe7460918c6d4.tar UXP-f102e7f80d5d7c972e7619c3f9efe7460918c6d4.tar.gz UXP-f102e7f80d5d7c972e7619c3f9efe7460918c6d4.tar.lz UXP-f102e7f80d5d7c972e7619c3f9efe7460918c6d4.tar.xz UXP-f102e7f80d5d7c972e7619c3f9efe7460918c6d4.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/generic/nsFrame.cpp')
-rw-r--r-- | layout/generic/nsFrame.cpp | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 024cc39bd..66f655f65 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1813,7 +1813,7 @@ nsFrame::DisplayOutline(nsDisplayListBuilder* aBuilder, void nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, nsDisplayList* aList) + nsDisplayList* aList) { if (!IsVisibleForPainting(aBuilder)) return; @@ -2072,13 +2072,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); } @@ -2086,7 +2085,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; @@ -2130,13 +2128,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(); @@ -2161,7 +2159,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; @@ -2281,7 +2279,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)); } @@ -2294,7 +2292,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, aBuilder->MarkPreserve3DFramesForDisplayList(this); } - MarkAbsoluteFramesForDisplayList(aBuilder, dirtyRect); + MarkAbsoluteFramesForDisplayList(aBuilder); nsDisplayLayerEventRegions* eventRegions = nullptr; if (aBuilder->IsBuildingLayerEventRegions()) { @@ -2303,7 +2301,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. @@ -2409,7 +2407,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()) { @@ -2474,8 +2472,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 @@ -2488,8 +2485,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, nonparticipants.AppendToTop(item); } } - WrapSeparatorTransform(aBuilder, this, dirtyRect, - &nonparticipants, &participants, index++); + WrapSeparatorTransform(aBuilder, this, &nonparticipants, &participants, index++); resultList.AppendToTop(&participants); } @@ -2500,7 +2496,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; @@ -2604,7 +2600,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, @@ -2637,12 +2632,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); @@ -2710,8 +2708,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; @@ -2771,6 +2770,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(aBuilder, child, dirty, pseudoStackingContext); + DisplayListClipState::AutoClipMultiple clipState(aBuilder); CheckForApzAwareEventHandlers(aBuilder, child); @@ -2783,7 +2783,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. @@ -2819,18 +2819,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, @@ -2862,8 +2862,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 @@ -2876,8 +2876,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()); @@ -2927,11 +2927,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()); } } |