Bug 1888702 Part 2 - Remove PrependPageBreakItem() and simplify AppendPageBreakItem(). r=layout-reviewers,emilio

The last caller of PrependPageBreakItem() is removed in
https://hg.mozilla.org/mozilla-central/rev/97613a0619b2

Since we only need to append page break items, we don't need
InsertPageBreakItem() and InsertPageBreakLocation enum. We can just implement
AppendPageBreakItem directly.

Differential Revision: https://phabricator.services.mozilla.com/D206150
This commit is contained in:
Ting-Yu Lin
2024-03-29 23:16:46 +00:00
parent a299dff332
commit 14561b86e0
2 changed files with 6 additions and 22 deletions

View File

@@ -4985,9 +4985,8 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
return data;
}
void nsCSSFrameConstructor::InsertPageBreakItem(
nsIContent* aContent, FrameConstructionItemList& aItems,
InsertPageBreakLocation location) {
void nsCSSFrameConstructor::AppendPageBreakItem(
nsIContent* aContent, FrameConstructionItemList& aItems) {
RefPtr<ComputedStyle> pseudoStyle =
mPresShell->StyleSet()->ResolveNonInheritingAnonymousBoxStyle(
PseudoStyleType::pageBreak);
@@ -4997,13 +4996,8 @@ void nsCSSFrameConstructor::InsertPageBreakItem(
static constexpr FrameConstructionData sPageBreakData(NS_NewPageBreakFrame,
FCDATA_SKIP_FRAMESET);
if (location == InsertPageBreakLocation::eBefore) {
aItems.PrependItem(this, &sPageBreakData, aContent, pseudoStyle.forget(),
true);
} else {
aItems.AppendItem(this, &sPageBreakData, aContent, pseudoStyle.forget(),
true);
}
}
bool nsCSSFrameConstructor::ShouldCreateItemsForChild(

View File

@@ -1423,18 +1423,8 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// for it.
void ReframeTextIfNeeded(nsIContent* aContent);
enum InsertPageBreakLocation { eBefore, eAfter };
inline void AppendPageBreakItem(nsIContent* aContent,
FrameConstructionItemList& aItems) {
InsertPageBreakItem(aContent, aItems, InsertPageBreakLocation::eAfter);
}
inline void PrependPageBreakItem(nsIContent* aContent,
FrameConstructionItemList& aItems) {
InsertPageBreakItem(aContent, aItems, InsertPageBreakLocation::eBefore);
}
void InsertPageBreakItem(nsIContent* aContent,
FrameConstructionItemList& aItems,
InsertPageBreakLocation location);
void AppendPageBreakItem(nsIContent* aContent,
FrameConstructionItemList& aItems);
// Function to find FrameConstructionData for aElement. Will return
// null if aElement is not HTML.