QTextDocumentLayout could get into an infinite loop when the
contents exceeded QFIXED_MAX.
Specifically, QFIXED_MAX is used as meaning "one infinite page"
which means that newPage() will just return when it sees this
page height. If the page actually grew larger than this, though,
we would treat it as a page break and enter a loop where we try
to call newPage() to create new pages and never return.
The layout engine cannot support documents this large, so we detect
the case and then just finish the layout loop early when it is
encountered.
Pick-to: 6.5 6.6
Fixes: QTBUG-112968
Change-Id: I485303d714d112119a971c43e0086bf6d3d23e9f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>