mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 05:47:29 +09:00
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:
parent
854827bd83
commit
9b868f0298
18 changed files with 52 additions and 166 deletions
|
|
@ -1564,8 +1564,7 @@ ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
|||
// have been if it had been in the flow
|
||||
nsHypotheticalPosition hypotheticalPos;
|
||||
if ((iStartIsAuto && iEndIsAuto) || (bStartIsAuto && bEndIsAuto)) {
|
||||
nsIFrame* placeholderFrame =
|
||||
aPresContext->PresShell()->GetPlaceholderFrameFor(mFrame);
|
||||
nsPlaceholderFrame* placeholderFrame = mFrame->GetPlaceholderFrame();
|
||||
NS_ASSERTION(placeholderFrame, "no placeholder frame");
|
||||
|
||||
if (placeholderFrame->HasAnyStateBits(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4336,8 +4336,7 @@ CheckPlaceholderInLine(nsIFrame* aBlock, nsLineBox* aLine, nsFloatCache* aFC)
|
|||
"float in a line should never be a continuation");
|
||||
NS_ASSERTION(!(aFC->mFloat->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT),
|
||||
"float in a line should never be a pushed float");
|
||||
nsIFrame* ph = aBlock->PresContext()->FrameManager()->
|
||||
GetPlaceholderFrameFor(aFC->mFloat->FirstInFlow());
|
||||
nsIFrame* ph = aFC->mFloat->FirstInFlow()->GetPlaceholderFrame();
|
||||
for (nsIFrame* f = ph; f; f = f->GetParent()) {
|
||||
if (f->GetParent() == aBlock)
|
||||
return aLine->Contains(f);
|
||||
|
|
@ -4939,9 +4938,8 @@ nsBlockFrame::DrainSelfPushedFloats()
|
|||
if (f->GetPrevContinuation()) {
|
||||
// FIXME
|
||||
} else {
|
||||
nsPlaceholderFrame *placeholder =
|
||||
presContext->FrameManager()->GetPlaceholderFrameFor(f);
|
||||
nsIFrame *floatOriginalParent = presContext->PresShell()->
|
||||
nsPlaceholderFrame* placeholder = f->GetPlaceholderFrame();
|
||||
nsIFrame* floatOriginalParent = presContext->PresShell()->
|
||||
FrameConstructor()->GetFloatContainingBlock(placeholder);
|
||||
if (floatOriginalParent != this) {
|
||||
// This is a first continuation that was pushed from one of our
|
||||
|
|
@ -5565,7 +5563,7 @@ FindChildContaining(nsBlockFrame* aFrame, nsIFrame* aFindFrame)
|
|||
return nullptr;
|
||||
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
|
||||
break;
|
||||
aFindFrame = aFrame->PresContext()->FrameManager()->GetPlaceholderFrameFor(child);
|
||||
aFindFrame = child->GetPlaceholderFrame();
|
||||
}
|
||||
|
||||
return child;
|
||||
|
|
@ -6847,9 +6845,8 @@ nsBlockFrame::ChildIsDirty(nsIFrame* aChild)
|
|||
AddStateBits(NS_BLOCK_LOOK_FOR_DIRTY_FRAMES);
|
||||
} else {
|
||||
NS_ASSERTION(aChild->IsFloating(), "should be a float");
|
||||
nsIFrame *thisFC = FirstContinuation();
|
||||
nsIFrame *placeholderPath =
|
||||
PresContext()->FrameManager()->GetPlaceholderFrameFor(aChild);
|
||||
nsIFrame* thisFC = FirstContinuation();
|
||||
nsIFrame* placeholderPath = aChild->GetPlaceholderFrame();
|
||||
// SVG code sometimes sends FrameNeedsReflow notifications during
|
||||
// frame destruction, leading to null placeholders, but we're safe
|
||||
// ignoring those.
|
||||
|
|
|
|||
|
|
@ -320,8 +320,7 @@ nsFirstLetterFrame::CreateContinuationForFloatingParent(nsPresContext* aPresCont
|
|||
*aContinuation = nullptr;
|
||||
|
||||
nsIPresShell* presShell = aPresContext->PresShell();
|
||||
nsPlaceholderFrame* placeholderFrame =
|
||||
presShell->FrameManager()->GetPlaceholderFrameFor(this);
|
||||
nsPlaceholderFrame* placeholderFrame = GetPlaceholderFrame();
|
||||
nsContainerFrame* parent = placeholderFrame->GetParent();
|
||||
|
||||
nsIFrame* continuation = presShell->FrameConstructor()->
|
||||
|
|
|
|||
|
|
@ -633,8 +633,7 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
|||
|
||||
nsIPresShell *shell = presContext->GetPresShell();
|
||||
if (mState & NS_FRAME_OUT_OF_FLOW) {
|
||||
nsPlaceholderFrame* placeholder =
|
||||
shell->FrameManager()->GetPlaceholderFrameFor(this);
|
||||
nsPlaceholderFrame* placeholder = GetPlaceholderFrame();
|
||||
NS_ASSERTION(!placeholder || (aDestructRoot != this),
|
||||
"Don't call Destroy() on OOFs, call Destroy() on the placeholder.");
|
||||
NS_ASSERTION(!placeholder ||
|
||||
|
|
@ -642,7 +641,6 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
|||
"Placeholder relationship should have been torn down already; "
|
||||
"this might mean we have a stray placeholder in the tree.");
|
||||
if (placeholder) {
|
||||
shell->FrameManager()->UnregisterPlaceholderFrame(placeholder);
|
||||
placeholder->SetOutOfFlowFrame(nullptr);
|
||||
}
|
||||
}
|
||||
|
|
@ -8060,9 +8058,8 @@ int32_t
|
|||
nsFrame::GetLineNumber(nsIFrame *aFrame, bool aLockScroll, nsIFrame** aContainingBlock)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "null aFrame");
|
||||
nsFrameManager* frameManager = aFrame->PresContext()->FrameManager();
|
||||
nsIFrame *blockFrame = aFrame;
|
||||
nsIFrame *thisBlock;
|
||||
nsIFrame* blockFrame = aFrame;
|
||||
nsIFrame* thisBlock;
|
||||
nsAutoLineIterator it;
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
while (NS_FAILED(result) && blockFrame)
|
||||
|
|
@ -8075,7 +8072,7 @@ nsFrame::GetLineNumber(nsIFrame *aFrame, bool aLockScroll, nsIFrame** aContainin
|
|||
// abspos continuations don't have placeholders, get the fif
|
||||
thisBlock = thisBlock->FirstInFlow();
|
||||
}
|
||||
thisBlock = frameManager->GetPlaceholderFrameFor(thisBlock);
|
||||
thisBlock = thisBlock->GetPlaceholderFrame();
|
||||
if (!thisBlock)
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -9027,7 +9024,6 @@ nsStyleContext*
|
|||
nsFrame::DoGetParentStyleContext(nsIFrame** aProviderFrame) const
|
||||
{
|
||||
*aProviderFrame = nullptr;
|
||||
nsFrameManager* fm = PresContext()->FrameManager();
|
||||
|
||||
// Handle display:contents and the root frame, when there's no parent frame
|
||||
// to inherit from.
|
||||
|
|
@ -9044,6 +9040,7 @@ nsFrame::DoGetParentStyleContext(nsIFrame** aProviderFrame) const
|
|||
/* if next is true then it's really a request for the table frame's
|
||||
parent context, see nsTable[Outer]Frame::GetParentStyleContext. */
|
||||
pseudo == nsCSSAnonBoxes::tableWrapper) {
|
||||
nsFrameManager* fm = PresContext()->FrameManager();
|
||||
nsStyleContext* sc = fm->GetDisplayContentsStyleFor(parentContent);
|
||||
if (MOZ_UNLIKELY(sc)) {
|
||||
return sc;
|
||||
|
|
@ -9080,7 +9077,7 @@ nsFrame::DoGetParentStyleContext(nsIFrame** aProviderFrame) const
|
|||
// We're an out-of-flow frame. For out-of-flow frames, we must
|
||||
// resolve underneath the placeholder's parent. The placeholder is
|
||||
// reached from the first-in-flow.
|
||||
nsIFrame* placeholder = fm->GetPlaceholderFrameFor(FirstInFlow());
|
||||
nsIFrame* placeholder = FirstInFlow()->GetPlaceholderFrame();
|
||||
if (!placeholder) {
|
||||
NS_NOTREACHED("no placeholder frame for out-of-flow frame");
|
||||
*aProviderFrame = GetCorrectedParent(this);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class nsLineList_iterator;
|
|||
class nsAbsoluteContainingBlock;
|
||||
class nsIContent;
|
||||
class nsContainerFrame;
|
||||
class nsPlaceholderFrame;
|
||||
|
||||
struct nsPeekOffsetStruct;
|
||||
struct nsPoint;
|
||||
|
|
@ -728,6 +729,16 @@ public:
|
|||
*/
|
||||
inline nsContainerFrame* GetInFlowParent();
|
||||
|
||||
/**
|
||||
* Return the placeholder for this frame (which must be out-of-flow).
|
||||
* @note this will only return non-null if |this| is the first-in-flow
|
||||
* although we don't assert that here for legacy reasons.
|
||||
*/
|
||||
inline nsPlaceholderFrame* GetPlaceholderFrame() const {
|
||||
MOZ_ASSERT(HasAnyStateBits(NS_FRAME_OUT_OF_FLOW));
|
||||
return GetProperty(PlaceholderFrameProperty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this frame's parent to aParent.
|
||||
* If the frame may have moved into or out of a scrollframe's
|
||||
|
|
@ -1047,6 +1058,8 @@ public:
|
|||
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BidiDataProperty, mozilla::FrameBidiData)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(PlaceholderFrameProperty, nsPlaceholderFrame)
|
||||
|
||||
mozilla::FrameBidiData GetBidiData()
|
||||
{
|
||||
return GetProperty(BidiDataProperty());
|
||||
|
|
|
|||
|
|
@ -166,8 +166,8 @@ nsContainerFrame*
|
|||
nsIFrame::GetInFlowParent()
|
||||
{
|
||||
if (GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
|
||||
nsFrameManager* fm = PresContext()->FrameManager();
|
||||
return fm->GetPlaceholderFrameFor(FirstContinuation())->GetParent();
|
||||
nsIFrame* ph = FirstContinuation()->GetProperty(nsIFrame::PlaceholderFrameProperty());
|
||||
return ph->GetParent();
|
||||
}
|
||||
|
||||
return GetParent();
|
||||
|
|
|
|||
|
|
@ -156,16 +156,15 @@ nsPlaceholderFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
|||
{
|
||||
nsIFrame* oof = mOutOfFlowFrame;
|
||||
if (oof) {
|
||||
// Unregister out-of-flow frame
|
||||
nsFrameManager* fm = PresContext()->GetPresShell()->FrameManager();
|
||||
fm->UnregisterPlaceholderFrame(this);
|
||||
mOutOfFlowFrame = nullptr;
|
||||
oof->DeleteProperty(nsIFrame::PlaceholderFrameProperty());
|
||||
// If aDestructRoot is not an ancestor of the out-of-flow frame,
|
||||
// then call RemoveFrame on it here.
|
||||
// Also destroy it here if it's a popup frame. (Bug 96291)
|
||||
if ((GetStateBits() & PLACEHOLDER_FOR_POPUP) ||
|
||||
!nsLayoutUtils::IsProperAncestorFrame(aDestructRoot, oof)) {
|
||||
ChildListID listId = nsLayoutUtils::GetChildListNameFor(oof);
|
||||
nsFrameManager* fm = PresContext()->GetPresShell()->FrameManager();
|
||||
fm->RemoveFrame(listId, oof);
|
||||
}
|
||||
// else oof will be destroyed by its parent
|
||||
|
|
|
|||
|
|
@ -1383,8 +1383,7 @@ BuildTextRuns(DrawTarget* aDrawTarget, nsTextFrame* aForFrame,
|
|||
nsIFrame* lineContainerChild = aForFrame;
|
||||
if (!aLineContainer) {
|
||||
if (aForFrame->IsFloatingFirstLetterChild()) {
|
||||
lineContainerChild = aForFrame->PresContext()->PresShell()->
|
||||
GetPlaceholderFrameFor(aForFrame->GetParent());
|
||||
lineContainerChild = aForFrame->GetParent()->GetPlaceholderFrame();
|
||||
}
|
||||
aLineContainer = FindLineContainer(lineContainerChild);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue