diff options
author | Rodrigo Tobar <rtobar@icrar.org> | 2022-12-17 13:31:35 +0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-17 19:40:52 +0100 |
commit | 3db6af6360875d8aac237d9e5bf9c64e4c732250 (patch) | |
tree | 630ca759a7984f41856733ca1572b6115a2d7536 /Userland | |
parent | 2ea8d2547e2524f718a8f44d849db4a29401315b (diff) | |
download | serenity-3db6af6360875d8aac237d9e5bf9c64e4c732250.zip |
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).
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibPDF/Document.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibPDF/Document.cpp b/Userland/Libraries/LibPDF/Document.cpp index 5dac546ac5..6b0fd04973 100644 --- a/Userland/Libraries/LibPDF/Document.cpp +++ b/Userland/Libraries/LibPDF/Document.cpp @@ -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); } |