Bug 1865012 Part 4 - Remove PageValuesProperty copy in frame continuations. r=dholbert

It was added in bug 1804772. After Part 1, accessing FirstInFlow() is constant
time, so we don't need to duplicate PageValuesProperty in each frame
continuation.

Differential Revision: https://phabricator.services.mozilla.com/D197759
This commit is contained in:
Ting-Yu Lin
2024-01-22 19:50:49 +00:00
parent 43d19da8ac
commit 064ae31be8
2 changed files with 4 additions and 19 deletions

View File

@@ -8033,23 +8033,6 @@ nsIFrame* nsCSSFrameConstructor::CreateContinuingFrame(
// aFrame cannot be a dynamic reflow root because it has a continuation now.
aFrame->RemoveStateBits(NS_FRAME_DYNAMIC_REFLOW_ROOT);
// XXXalaskanemily: This avoids linear-time FirstContinuation lookups during
// paginated reflow, but there are a lot of smarter ways to manage this. We
// might also want to share the struct (refcount or some guarantee the struct
// will remain valid during reflow).
if (nsIFrame::PageValues* pageValues =
aFrame->GetProperty(nsIFrame::PageValuesProperty())) {
// It is possible that both values of a PageValues struct can be
// overwritten with null. If that's the case, then as a minor optimization
// we don't need to create a copy of the struct since this property being
// missing is equivalent to having null start/end values.
if (pageValues->mStartPageValue || pageValues->mEndPageValue) {
nsIFrame::PageValues* const newPageValues =
new nsIFrame::PageValues(*pageValues);
newFrame->SetProperty(nsIFrame::PageValuesProperty(), newPageValues);
}
}
MOZ_ASSERT(!newFrame->GetNextSibling(), "unexpected sibling");
return newFrame;
}