Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert

This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
This commit is contained in:
Emilio Cobos Álvarez
2023-09-06 22:34:35 +00:00
parent 468664aae9
commit 0698c96bd1
87 changed files with 311 additions and 409 deletions

View File

@@ -126,8 +126,7 @@ nsIScrollableFrame* nsTextControlFrame::GetScrollTargetFrame() const {
return do_QueryFrame(mRootNode->GetPrimaryFrame());
}
void nsTextControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) {
void nsTextControlFrame::Destroy(DestroyContext& aContext) {
RemoveProperty(TextControlInitializer());
// Unbind the text editor state object from the frame. The editor will live
@@ -166,12 +165,12 @@ void nsTextControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
// If we're a subclass like nsNumberControlFrame, then it owns the root of the
// anonymous subtree where mRootNode is.
aPostDestroyData.AddAnonymousContent(mRootNode.forget());
aPostDestroyData.AddAnonymousContent(mPlaceholderDiv.forget());
aPostDestroyData.AddAnonymousContent(mPreviewDiv.forget());
aPostDestroyData.AddAnonymousContent(mRevealButton.forget());
aContext.AddAnonymousContent(mRootNode.forget());
aContext.AddAnonymousContent(mPlaceholderDiv.forget());
aContext.AddAnonymousContent(mPreviewDiv.forget());
aContext.AddAnonymousContent(mRevealButton.forget());
nsContainerFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
nsContainerFrame::Destroy(aContext);
}
LogicalSize nsTextControlFrame::CalcIntrinsicSize(