summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-09-02 08:38:48 +0200
committerLars Knoll <lars.knoll@digia.com>2014-09-12 10:53:07 +0200
commit2de8fb5a6c0cc70b6185d4dfc7bcb6e851f29c29 (patch)
tree62206ee95004942d0d40f77f8e4603cb3d16051e /src
parent33e7093a840ed349c0d579f267cc300a555d54e6 (diff)
Force a full layout on the frame if it's vertical geometry changes
When the frame's vertical geometry changes because top/bottom margins, border or padding changes we need to do a full relayout of the frame to position it correctly. Task-number: QTBUG-2975 Change-Id: Ia0f063cc2057b6d7a469977d258ec1608feff9bf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index b2c82b8654..f1af362c80 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -2080,15 +2080,32 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in
QTextFrameData *fd = data(f);
QFixed newContentsWidth;
+ bool fullLayout = false;
{
QTextFrameFormat fformat = f->frameFormat();
// set sizes of this frame from the format
- fd->topMargin = QFixed::fromReal(fformat.topMargin());
- fd->bottomMargin = QFixed::fromReal(fformat.bottomMargin());
+ QFixed tm = QFixed::fromReal(fformat.topMargin());
+ if (tm != fd->topMargin) {
+ fd->topMargin = tm;
+ fullLayout = true;
+ }
+ QFixed bm = QFixed::fromReal(fformat.bottomMargin());
+ if (bm != fd->bottomMargin) {
+ fd->bottomMargin = bm;
+ fullLayout = true;
+ }
fd->leftMargin = QFixed::fromReal(fformat.leftMargin());
fd->rightMargin = QFixed::fromReal(fformat.rightMargin());
- fd->border = QFixed::fromReal(fformat.border());
- fd->padding = QFixed::fromReal(fformat.padding());
+ QFixed b = QFixed::fromReal(fformat.border());
+ if (b != fd->border) {
+ fd->border = b;
+ fullLayout = true;
+ }
+ QFixed p = QFixed::fromReal(fformat.padding());
+ if (p != fd->padding) {
+ fd->padding = p;
+ fullLayout = true;
+ }
QTextFrame *parent = f->parentFrame();
const QTextFrameData *pd = parent ? data(parent) : 0;
@@ -2143,7 +2160,7 @@ QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, in
layoutStruct.contentsWidth = 0;
layoutStruct.minimumWidth = 0;
layoutStruct.maximumWidth = QFIXED_MAX;
- layoutStruct.fullLayout = fd->oldContentsWidth != newContentsWidth;
+ layoutStruct.fullLayout = fullLayout || (fd->oldContentsWidth != newContentsWidth);
layoutStruct.updateRect = QRectF(QPointF(0, 0), QSizeF(qreal(INT_MAX), qreal(INT_MAX)));
LDEBUG << "layoutStruct: x_left" << layoutStruct.x_left << "x_right" << layoutStruct.x_right
<< "fullLayout" << layoutStruct.fullLayout;