Skip to content

Commit 6c324c6

Browse files
committedSep 7, 2023
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
1 parent c160d1e commit 6c324c6

File tree

87 files changed

+326
-411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+326
-411
lines changed
 

‎layout/base/nsFrameManager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ void nsFrameManager::Destroy() {
5050
mPresShell->SetIgnoreFrameDestruction(true);
5151

5252
if (mRootFrame) {
53-
mRootFrame->Destroy();
53+
FrameDestroyContext context(mRootFrame);
54+
mRootFrame->Destroy(context);
5455
mRootFrame = nullptr;
5556
}
5657

‎layout/forms/nsColorControlFrame.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ NS_QUERYFRAME_HEAD(nsColorControlFrame)
3838
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
3939
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButtonControlFrame)
4040

41-
void nsColorControlFrame::DestroyFrom(nsIFrame* aDestructRoot,
42-
PostDestroyData& aPostDestroyData) {
43-
aPostDestroyData.AddAnonymousContent(mColorContent.forget());
44-
nsHTMLButtonControlFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
41+
void nsColorControlFrame::Destroy(DestroyContext& aContext) {
42+
aContext.AddAnonymousContent(mColorContent.forget());
43+
nsHTMLButtonControlFrame::Destroy(aContext);
4544
}
4645

4746
#ifdef DEBUG_FRAME_DUMP

0 commit comments

Comments
 (0)
Failed to load comments.