1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:27:43 +00:00

LibPDF: Keep track of OutlineItem parents

While OutlineItem had a parent field, it was never populated nor used.
This commit populates it when possible (no parent means the OutlineItem
is a top-level item).
This commit is contained in:
Rodrigo Tobar 2022-12-17 13:31:35 +08:00 committed by Andreas Kling
parent 2ea8d2547e
commit 3db6af6360

View file

@ -273,6 +273,9 @@ PDFErrorOr<NonnullRefPtr<OutlineItem>> Document::build_outline_item(NonnullRefPt
VERIFY(outline_item_dict->contains(CommonNames::Last));
auto first_ref = outline_item_dict->get_value(CommonNames::First);
auto children = TRY(build_outline_item_chain(first_ref));
for (auto& child : children) {
child.parent = outline_item;
}
outline_item->children = move(children);
}