Bug 1804798 - Explicitly set auto page name (and corresponding debug flag) when inserting frames in nsCSSFrameConstructor::ContentRangeInserted r=dholbert

Unfortunately, this can be called through both reflow and frame construction
much like nsCSSFrameConstructor::ContentAppended, so we can't just use a page-
name tracker.

Differential Revision: https://phabricator.services.mozilla.com/D164760
This commit is contained in:
Emily McDonough
2022-12-15 20:30:29 +00:00
parent 118de82fe1
commit aa11e19241
3 changed files with 23 additions and 0 deletions

View File

@@ -7217,6 +7217,21 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild,
nsFrameConstructorSaveState floatSaveState;
state.MaybePushFloatContainingBlock(insertion.mParentFrame, floatSaveState);
if (state.mPresContext->IsPaginated() &&
StaticPrefs::layout_css_named_pages_enabled()) {
// Because this function can be called outside frame construction, we need
// to set state.mAutoPageNameValue based on what the parent frame's auto
// value is.
// Calling this from outside the frame constructor can violate many of the
// expectations in AutoFrameConstructionPageName, and unlike during frame
// construction we already have an auto value from parentFrame, so we do
// not use AutoFrameConstructionPageName here.
state.mAutoPageNameValue = insertion.mParentFrame->GetAutoPageValue();
#ifdef DEBUG
insertion.mParentFrame->mWasVisitedByAutoFrameConstructionPageName = true;
#endif
}
// If the container is a table and a caption will be appended, it needs to be
// put in the table wrapper frame's additional child list.
// We make no attempt here to set flags to indicate whether the list