1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

LibPDF: Require Document* in Parser constructor

This makes it a bit easier to avoid calling parser->set_document, an
issue which cost me ~30 minutes to find.
This commit is contained in:
Matthew Olsson 2022-03-22 19:22:45 -07:00 committed by Andreas Kling
parent a8de9cf541
commit 60c3e786be
3 changed files with 7 additions and 6 deletions

View file

@ -22,14 +22,15 @@ static NonnullRefPtr<T> make_object(Args... args) requires(IsBaseOf<Object, T>)
return adopt_ref(*new T(forward<Args>(args)...));
}
PDFErrorOr<Vector<Command>> Parser::parse_graphics_commands(ReadonlyBytes bytes)
PDFErrorOr<Vector<Command>> Parser::parse_graphics_commands(Document* document, ReadonlyBytes bytes)
{
auto parser = adopt_ref(*new Parser(bytes));
auto parser = adopt_ref(*new Parser(document, bytes));
return parser->parse_graphics_commands();
}
Parser::Parser(Badge<Document>, ReadonlyBytes bytes)
Parser::Parser(Document* document, ReadonlyBytes bytes)
: m_reader(bytes)
, m_document(document)
{
}