From 416b4cf685030114837bd375664fd12047895a62 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 9 Nov 2018 10:04:54 +0100 Subject: Set correct vertical position for text following a very large image If the document is paged and contains an image spanning more than one page, correctly set the y position for everything following that image. Change-Id: I1c584c7a907c1728c2965f1dc3fdc56069ab3172 Fixes: QTBUG-59886 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextdocumentlayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index ebd7a7d69f..323253c70d 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -155,7 +155,7 @@ struct QTextLayoutStruct { { return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate(); } inline void newPage() - { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY; } + { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = qMax(y, pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY); } }; class QTextTableData : public QTextFrameData @@ -2709,7 +2709,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1; getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight, &lineBottom); - if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom && + while (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom && layoutStruct->pageHeight >= lineBreakHeight) { layoutStruct->newPage(); -- cgit v1.2.3