From 4460711a802b4dfb6a9e71666185b15c59fb2e3a Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 6 Jan 2021 11:17:01 +0100 Subject: Revert "Fix invalid text layout data when a full layout run is interrupted" This reverts commit 09ee4282e5eedf5b44245e8b28b223339f87ddfa. The commit made the layouting time go from linear to quadratic, which is problematic when rendering big documents impractical. I wrote an alternative fix for QTBUG-20354 which will come as separate change since it approaches the problem in a different way. Fixes: QTBUG-89599 Task-number: QTBUG-20354 Change-Id: Ie450332f06ee40e60c8e4c6c7d10834bff1acf74 Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit a62fa9b7cc520f3548356182bf5d6642c05be204) Reviewed-by: Qt Cherry-pick Bot --- src/gui/text/qtextdocumentlayout.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 7a46ae4ce9..141fe0eba5 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -105,14 +105,13 @@ public: bool sizeDirty; bool layoutDirty; - bool fullLayoutCompleted; QList> floats; }; QTextFrameData::QTextFrameData() : maximumWidth(QFIXED_MAX), - currentLayoutStruct(nullptr), sizeDirty(true), layoutDirty(true), fullLayoutCompleted(false) + currentLayoutStruct(nullptr), sizeDirty(true), layoutDirty(true) { } @@ -2944,7 +2943,7 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in QTextFrameData *fd = data(f); QFixed newContentsWidth; - bool fullLayout = (f == document->rootFrame() && !fd->fullLayoutCompleted); + bool fullLayout = false; { QTextFrameFormat fformat = f->frameFormat(); // set sizes of this frame from the format @@ -3398,7 +3397,6 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout cp.contentsWidth = layoutStruct->contentsWidth; checkPoints.append(cp); checkPoints.reserve(checkPoints.size()); - fd->fullLayoutCompleted = true; } else { currentLazyLayoutPosition = checkPoints.constLast().positionInFrame; // ####### @@ -3810,7 +3808,6 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length) d->contentHasAlignment = false; d->currentLazyLayoutPosition = 0; d->checkPoints.clear(); - data(d->docPrivate->rootFrame())->fullLayoutCompleted = false; d->layoutStep(); } else { d->ensureLayoutedByPosition(from); -- cgit v1.2.3