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 <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit a62fa9b7cc520f3548356182bf5d6642c05be204)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Frederik Gladhorn 2021-01-06 11:17:01 +01:00 committed by Qt Cherry-pick Bot
parent 062d42e355
commit 4460711a80

View File

@ -105,14 +105,13 @@ public:
bool sizeDirty;
bool layoutDirty;
bool fullLayoutCompleted;
QList<QPointer<QTextFrame>> 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);