Bug 1368547 - Remove nsFrameManagerBase::mPlaceholderMap and instead store the placeholder on a frame property on the out-of-flow

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-04-17 06:07:51 -04:00 committed by Roy Tam
commit 9b868f0298
18 changed files with 52 additions and 166 deletions

View file

@ -338,17 +338,9 @@ nsAbsoluteContainingBlock::DoMarkFramesDirty(bool aMarkAllDirty)
// Given an out-of-flow frame, this method returns the parent frame of
// its placeholder frame, if that parent is a nsContainerFrame.
static nsContainerFrame*
GetPlaceholderContainer(nsPresContext* aPresContext,
nsIFrame* aPositionedFrame)
GetPlaceholderContainer(nsIFrame* aPositionedFrame)
{
MOZ_ASSERT(aPositionedFrame, "need non-null frame");
MOZ_ASSERT(aPositionedFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
"expecting abspos frame");
MOZ_ASSERT(aPresContext && aPresContext == aPositionedFrame->PresContext(),
"need non-null pres context which matches our frame");
nsIFrame* placeholder =
aPresContext->PresShell()->GetPlaceholderFrameFor(aPositionedFrame);
nsIFrame* placeholder = aPositionedFrame->GetPlaceholderFrame();
if (!placeholder) {
return nullptr;
@ -557,8 +549,7 @@ nsAbsoluteContainingBlock::ResolveSizeDependentOffsets(
aOffsets->IEnd(outerWM) - aMargin.IStartEnd(outerWM) -
aKidSize.ISize(outerWM);
} else if (aKidReflowInput.mFlags.mIOffsetsNeedCSSAlign) {
placeholderContainer = GetPlaceholderContainer(aPresContext,
aKidReflowInput.mFrame);
placeholderContainer = GetPlaceholderContainer(aKidReflowInput.mFrame);
nscoord offset = OffsetToAlignedStaticPos(aKidReflowInput, aKidSize,
logicalCBSizeOuterWM,
placeholderContainer,
@ -579,8 +570,7 @@ nsAbsoluteContainingBlock::ResolveSizeDependentOffsets(
aKidSize.BSize(outerWM);
} else if (aKidReflowInput.mFlags.mBOffsetsNeedCSSAlign) {
if (!placeholderContainer) {
placeholderContainer = GetPlaceholderContainer(aPresContext,
aKidReflowInput.mFrame);
placeholderContainer = GetPlaceholderContainer(aKidReflowInput.mFrame);
}
nscoord offset = OffsetToAlignedStaticPos(aKidReflowInput, aKidSize,
logicalCBSizeOuterWM,
@ -655,8 +645,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
// due to the multiple coordinate spaces in play, we use a convenience flag
// to simply have the child's ReflowInput give it a static position at its
// abs.pos. CB origin, and then we'll align & offset it from there.
nsIFrame* placeholder =
aPresContext->PresShell()->GetPlaceholderFrameFor(aKidFrame);
nsIFrame* placeholder = aKidFrame->GetPlaceholderFrame();
if (placeholder && placeholder->GetParent() == aDelegatingFrame) {
rsFlags |= ReflowInput::STATIC_POS_IS_CB_ORIGIN;
}