text/qtextdocumentlayout.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qtextdocumentlayout_p.h" -
43#include "qtextdocument_p.h" -
44#include "qtextimagehandler_p.h" -
45#include "qtexttable.h" -
46#include "qtextlist.h" -
47#include "qtextengine_p.h" -
48#include "private/qcssutil_p.h" -
49#include "private/qguiapplication_p.h" -
50 -
51#include "qabstracttextdocumentlayout_p.h" -
52#include "qcssparser_p.h" -
53 -
54#include <qpainter.h> -
55#include <qmath.h> -
56#include <qrect.h> -
57#include <qpalette.h> -
58#include <qdebug.h> -
59#include <qvarlengtharray.h> -
60#include <limits.h> -
61#include <qbasictimer.h> -
62#include "private/qfunctions_p.h" -
63 -
64#include <algorithm> -
65 -
66// #define LAYOUT_DEBUG -
67 -
68#ifdef LAYOUT_DEBUG -
69#define LDEBUG qDebug() -
70#define INC_INDENT debug_indent += " " -
71#define DEC_INDENT debug_indent = debug_indent.left(debug_indent.length()-2) -
72#else -
73#define LDEBUG if(0) qDebug() -
74#define INC_INDENT do {} while(0) -
75#define DEC_INDENT do {} while(0) -
76#endif -
77 -
78QT_BEGIN_NAMESPACE -
79 -
80// ################ should probably add frameFormatChange notification! -
81 -
82struct QTextLayoutStruct; -
83 -
84class QTextFrameData : public QTextFrameLayoutData -
85{ -
86public: -
87 QTextFrameData(); -
88 -
89 // relative to parent frame -
90 QFixedPoint position; -
91 QFixedSize size; -
92 -
93 // contents starts at (margin+border/margin+border) -
94 QFixed topMargin; -
95 QFixed bottomMargin; -
96 QFixed leftMargin; -
97 QFixed rightMargin; -
98 QFixed border; -
99 QFixed padding; -
100 // contents width includes padding (as we need to treat this on a per cell basis for tables) -
101 QFixed contentsWidth; -
102 QFixed contentsHeight; -
103 QFixed oldContentsWidth; -
104 -
105 // accumulated margins -
106 QFixed effectiveTopMargin; -
107 QFixed effectiveBottomMargin; -
108 -
109 QFixed minimumWidth; -
110 QFixed maximumWidth; -
111 -
112 QTextLayoutStruct *currentLayoutStruct; -
113 -
114 bool sizeDirty; -
115 bool layoutDirty; -
116 -
117 QList<QPointer<QTextFrame> > floats; -
118}; -
119 -
120QTextFrameData::QTextFrameData() -
121 : maximumWidth(QFIXED_MAX), -
122 currentLayoutStruct(0), sizeDirty(true), layoutDirty(true) -
123{ -
124}
executed: }
Execution Count:828
828
125 -
126struct QTextLayoutStruct { -
127 QTextLayoutStruct() : maximumWidth(QFIXED_MAX), fullLayout(false) -
128 {}
executed: }
Execution Count:2770
2770
129 QTextFrame *frame; -
130 QFixed x_left; -
131 QFixed x_right; -
132 QFixed frameY; // absolute y position of the current frame -
133 QFixed y; // always relative to the current frame -
134 QFixed contentsWidth; -
135 QFixed minimumWidth; -
136 QFixed maximumWidth; -
137 bool fullLayout; -
138 QList<QTextFrame *> pendingFloats; -
139 QFixed pageHeight; -
140 QFixed pageBottom; -
141 QFixed pageTopMargin; -
142 QFixed pageBottomMargin; -
143 QRectF updateRect; -
144 QRectF updateRectForFloats; -
145 -
146 inline void addUpdateRectForFloat(const QRectF &rect) { -
147 if (updateRectForFloats.isValid())
evaluated: updateRectForFloats.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
148 updateRectForFloats |= rect;
executed: updateRectForFloats |= rect;
Execution Count:1
1
149 else -
150 updateRectForFloats = rect;
executed: updateRectForFloats = rect;
Execution Count:2
2
151 } -
152 -
153 inline QFixed absoluteY() const -
154 { return frameY + y; }
executed: return frameY + y;
Execution Count:28701
28701
155 -
156 inline int currentPage() const -
157 { return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate(); }
executed: return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate();
Execution Count:1220
1220
158 -
159 inline void newPage() -
160 { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY; }
never executed: return;
executed: }
Execution Count:4
partially evaluated: pageHeight == (2147483647/256)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
161}; -
162 -
163class QTextTableData : public QTextFrameData -
164{ -
165public: -
166 QFixed cellSpacing, cellPadding; -
167 qreal deviceScale; -
168 QVector<QFixed> minWidths; -
169 QVector<QFixed> maxWidths; -
170 QVector<QFixed> widths; -
171 QVector<QFixed> heights; -
172 QVector<QFixed> columnPositions; -
173 QVector<QFixed> rowPositions; -
174 -
175 QVector<QFixed> cellVerticalOffsets; -
176 -
177 QFixed headerHeight; -
178 -
179 // maps from cell index (row + col * rowCount) to child frames belonging to -
180 // the specific cell -
181 QMultiHash<int, QTextFrame *> childFrameMap; -
182 -
183 inline QFixed cellWidth(int column, int colspan) const -
184 { return columnPositions.at(column + colspan - 1) + widths.at(column + colspan - 1)
executed: return columnPositions.at(column + colspan - 1) + widths.at(column + colspan - 1) - columnPositions.at(column);
Execution Count:357
357
185 - columnPositions.at(column); }
executed: return columnPositions.at(column + colspan - 1) + widths.at(column + colspan - 1) - columnPositions.at(column);
Execution Count:357
357
186 -
187 inline void calcRowPosition(int row) -
188 { -
189 if (row > 0)
evaluated: row > 0
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:29
29-194
190 rowPositions[row] = rowPositions.at(row - 1) + heights.at(row - 1) + border + cellSpacing + border;
executed: rowPositions[row] = rowPositions.at(row - 1) + heights.at(row - 1) + border + cellSpacing + border;
Execution Count:194
194
191 }
executed: }
Execution Count:223
223
192 -
193 QRectF cellRect(const QTextTableCell &cell) const; -
194 -
195 inline QFixed paddingProperty(const QTextFormat &format, QTextFormat::Property property) const -
196 { -
197 QVariant v = format.property(property);
executed (the execution status of this line is deduced): QVariant v = format.property(property);
-
198 if (v.isNull()) {
partially evaluated: v.isNull()
TRUEFALSE
yes
Evaluation Count:4848
no
Evaluation Count:0
0-4848
199 return cellPadding;
executed: return cellPadding;
Execution Count:4848
4848
200 } else { -
201 Q_ASSERT(v.userType() == QVariant::Double || v.userType() == QMetaType::Float);
never executed (the execution status of this line is deduced): qt_noop();
-
202 return QFixed::fromReal(v.toReal() * deviceScale);
never executed: return QFixed::fromReal(v.toReal() * deviceScale);
0
203 } -
204 } -
205 -
206 inline QFixed topPadding(const QTextFormat &format) const -
207 { -
208 return paddingProperty(format, QTextFormat::TableCellTopPadding);
executed: return paddingProperty(format, QTextFormat::TableCellTopPadding);
Execution Count:1594
1594
209 } -
210 -
211 inline QFixed bottomPadding(const QTextFormat &format) const -
212 { -
213 return paddingProperty(format, QTextFormat::TableCellBottomPadding);
executed: return paddingProperty(format, QTextFormat::TableCellBottomPadding);
Execution Count:1542
1542
214 } -
215 -
216 inline QFixed leftPadding(const QTextFormat &format) const -
217 { -
218 return paddingProperty(format, QTextFormat::TableCellLeftPadding);
executed: return paddingProperty(format, QTextFormat::TableCellLeftPadding);
Execution Count:882
882
219 } -
220 -
221 inline QFixed rightPadding(const QTextFormat &format) const -
222 { -
223 return paddingProperty(format, QTextFormat::TableCellRightPadding);
executed: return paddingProperty(format, QTextFormat::TableCellRightPadding);
Execution Count:830
830
224 } -
225 -
226 inline QFixedPoint cellPosition(const QTextTableCell &cell) const -
227 { -
228 const QTextFormat fmt = cell.format();
executed (the execution status of this line is deduced): const QTextFormat fmt = cell.format();
-
229 return cellPosition(cell.row(), cell.column()) + QFixedPoint(leftPadding(fmt), topPadding(fmt));
executed: return cellPosition(cell.row(), cell.column()) + QFixedPoint(leftPadding(fmt), topPadding(fmt));
Execution Count:1
1
230 } -
231 -
232 void updateTableSize(); -
233 -
234private: -
235 inline QFixedPoint cellPosition(int row, int col) const -
236 { return QFixedPoint(columnPositions.at(col), rowPositions.at(row) + cellVerticalOffsets.at(col + row * widths.size())); }
executed: return QFixedPoint(columnPositions.at(col), rowPositions.at(row) + cellVerticalOffsets.at(col + row * widths.size()));
Execution Count:1
1
237}; -
238 -
239static QTextFrameData *createData(QTextFrame *f) -
240{ -
241 QTextFrameData *data;
executed (the execution status of this line is deduced): QTextFrameData *data;
-
242 if (qobject_cast<QTextTable *>(f))
evaluated: qobject_cast<QTextTable *>(f)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:818
10-818
243 data = new QTextTableData;
executed: data = new QTextTableData;
Execution Count:10
10
244 else -
245 data = new QTextFrameData;
executed: data = new QTextFrameData;
Execution Count:818
818
246 f->setLayoutData(data);
executed (the execution status of this line is deduced): f->setLayoutData(data);
-
247 return data;
executed: return data;
Execution Count:828
828
248} -
249 -
250static inline QTextFrameData *data(QTextFrame *f) -
251{ -
252 QTextFrameData *data = static_cast<QTextFrameData *>(f->layoutData());
executed (the execution status of this line is deduced): QTextFrameData *data = static_cast<QTextFrameData *>(f->layoutData());
-
253 if (!data)
evaluated: !data
TRUEFALSE
yes
Evaluation Count:828
yes
Evaluation Count:76443
828-76443
254 data = createData(f);
executed: data = createData(f);
Execution Count:828
828
255 return data;
executed: return data;
Execution Count:77271
77271
256} -
257 -
258static bool isFrameFromInlineObject(QTextFrame *f) -
259{ -
260 return f->firstPosition() > f->lastPosition();
executed: return f->firstPosition() > f->lastPosition();
Execution Count:1979
1979
261} -
262 -
263void QTextTableData::updateTableSize() -
264{ -
265 const QFixed effectiveTopMargin = this->topMargin + border + padding;
executed (the execution status of this line is deduced): const QFixed effectiveTopMargin = this->topMargin + border + padding;
-
266 const QFixed effectiveBottomMargin = this->bottomMargin + border + padding;
executed (the execution status of this line is deduced): const QFixed effectiveBottomMargin = this->bottomMargin + border + padding;
-
267 const QFixed effectiveLeftMargin = this->leftMargin + border + padding;
executed (the execution status of this line is deduced): const QFixed effectiveLeftMargin = this->leftMargin + border + padding;
-
268 const QFixed effectiveRightMargin = this->rightMargin + border + padding;
executed (the execution status of this line is deduced): const QFixed effectiveRightMargin = this->rightMargin + border + padding;
-
269 size.height = contentsHeight == -1
partially evaluated: contentsHeight == -1
TRUEFALSE
yes
Evaluation Count:29
no
Evaluation Count:0
0-29
270 ? rowPositions.last() + heights.last() + padding + border + cellSpacing + effectiveBottomMargin
executed (the execution status of this line is deduced): ? rowPositions.last() + heights.last() + padding + border + cellSpacing + effectiveBottomMargin
-
271 : effectiveTopMargin + contentsHeight + effectiveBottomMargin;
executed (the execution status of this line is deduced): : effectiveTopMargin + contentsHeight + effectiveBottomMargin;
-
272 size.width = effectiveLeftMargin + contentsWidth + effectiveRightMargin;
executed (the execution status of this line is deduced): size.width = effectiveLeftMargin + contentsWidth + effectiveRightMargin;
-
273}
executed: }
Execution Count:29
29
274 -
275QRectF QTextTableData::cellRect(const QTextTableCell &cell) const -
276{ -
277 const int row = cell.row();
executed (the execution status of this line is deduced): const int row = cell.row();
-
278 const int rowSpan = cell.rowSpan();
executed (the execution status of this line is deduced): const int rowSpan = cell.rowSpan();
-
279 const int column = cell.column();
executed (the execution status of this line is deduced): const int column = cell.column();
-
280 const int colSpan = cell.columnSpan();
executed (the execution status of this line is deduced): const int colSpan = cell.columnSpan();
-
281 -
282 return QRectF(columnPositions.at(column).toReal(),
executed: return QRectF(columnPositions.at(column).toReal(), rowPositions.at(row).toReal(), (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).toReal(), (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).toReal());
Execution Count:75
75
283 rowPositions.at(row).toReal(),
executed: return QRectF(columnPositions.at(column).toReal(), rowPositions.at(row).toReal(), (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).toReal(), (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).toReal());
Execution Count:75
75
284 (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).toReal(),
executed: return QRectF(columnPositions.at(column).toReal(), rowPositions.at(row).toReal(), (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).toReal(), (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).toReal());
Execution Count:75
75
285 (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).toReal());
executed: return QRectF(columnPositions.at(column).toReal(), rowPositions.at(row).toReal(), (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).toReal(), (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).toReal());
Execution Count:75
75
286} -
287 -
288static inline bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextBlockFormat &format, const QTextFrame::Iterator &nextIt) -
289{ -
290 return !nextIt.atEnd()
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
291 && qobject_cast<QTextTable *>(nextIt.currentFrame())
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
292 && block.isValid()
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
293 && block.length() == 1
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
294 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
295 && !format.hasProperty(QTextFormat::BackgroundBrush)
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
296 && nextIt.currentFrame()->firstPosition() == block.position() + 1
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
297 ;
executed: return !nextIt.atEnd() && qobject_cast<QTextTable *>(nextIt.currentFrame()) && block.isValid() && block.length() == 1 && !format.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth) && !format.hasProperty(QTextFormat::BackgroundBrush) && nextIt.currentFrame()->firstPosition() == block.position() + 1 ;
Execution Count:4055
4055
298} -
299 -
300static inline bool isEmptyBlockBeforeTable(QTextFrame::Iterator it) -
301{ -
302 QTextFrame::Iterator next = it; ++next;
executed (the execution status of this line is deduced): QTextFrame::Iterator next = it; ++next;
-
303 if (it.currentFrame())
partially evaluated: it.currentFrame()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
304 return false;
never executed: return false;
0
305 QTextBlock block = it.currentBlock();
executed (the execution status of this line is deduced): QTextBlock block = it.currentBlock();
-
306 return isEmptyBlockBeforeTable(block, block.blockFormat(), next);
executed: return isEmptyBlockBeforeTable(block, block.blockFormat(), next);
Execution Count:8
8
307} -
308 -
309static inline bool isEmptyBlockAfterTable(const QTextBlock &block, const QTextFrame *previousFrame) -
310{ -
311 return qobject_cast<const QTextTable *>(previousFrame)
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() == 1 && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:4011
4011
312 && block.isValid()
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() == 1 && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:4011
4011
313 && block.length() == 1
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() == 1 && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:4011
4011
314 && previousFrame->lastPosition() == block.position() - 1
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() == 1 && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:4011
4011
315 ;
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() == 1 && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:4011
4011
316} -
317 -
318static inline bool isLineSeparatorBlockAfterTable(const QTextBlock &block, const QTextFrame *previousFrame) -
319{ -
320 return qobject_cast<const QTextTable *>(previousFrame)
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() > 1 && block.text().at(0) == QChar::LineSeparator && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:3615
3615
321 && block.isValid()
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() > 1 && block.text().at(0) == QChar::LineSeparator && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:3615
3615
322 && block.length() > 1
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() > 1 && block.text().at(0) == QChar::LineSeparator && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:3615
3615
323 && block.text().at(0) == QChar::LineSeparator
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() > 1 && block.text().at(0) == QChar::LineSeparator && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:3615
3615
324 && previousFrame->lastPosition() == block.position() - 1
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() > 1 && block.text().at(0) == QChar::LineSeparator && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:3615
3615
325 ;
executed: return qobject_cast<const QTextTable *>(previousFrame) && block.isValid() && block.length() > 1 && block.text().at(0) == QChar::LineSeparator && previousFrame->lastPosition() == block.position() - 1 ;
Execution Count:3615
3615
326} -
327 -
328/* -
329 -
330Optimization strategies: -
331 -
332HTML layout: -
333 -
334* Distinguish between normal and special flow. For normal flow the condition: -
335 y1 > y2 holds for all blocks with b1.key() > b2.key(). -
336* Special flow is: floats, table cells -
337 -
338* Normal flow within table cells. Tables (not cells) are part of the normal flow. -
339 -
340 -
341* If blocks grows/shrinks in height and extends over whole page width at the end, move following blocks. -
342* If height doesn't change, no need to do anything -
343 -
344Table cells: -
345 -
346* If minWidth of cell changes, recalculate table width, relayout if needed. -
347* What about maxWidth when doing auto layout? -
348 -
349Floats: -
350* need fixed or proportional width, otherwise don't float! -
351* On width/height change relayout surrounding paragraphs. -
352 -
353Document width change: -
354* full relayout needed -
355 -
356 -
357Float handling: -
358 -
359* Floats are specified by a special format object. -
360* currently only floating images are implemented. -
361 -
362*/ -
363 -
364/* -
365 -
366 On the table layouting: -
367 -
368 +---[ table border ]------------------------- -
369 | [ cell spacing ] -
370 | +------[ cell border ]-----+ +-------- -
371 | | | | -
372 | | -
373 | | -
374 | | -
375 | -
376 -
377 rowPositions[i] and columnPositions[i] point at the cell content -
378 position. So for example the left border is drawn at -
379 x = columnPositions[i] - fd->border and similar for y. -
380 -
381*/ -
382 -
383struct QCheckPoint -
384{ -
385 QFixed y; -
386 QFixed frameY; // absolute y position of the current frame -
387 int positionInFrame; -
388 QFixed minimumWidth; -
389 QFixed maximumWidth; -
390 QFixed contentsWidth; -
391}; -
392Q_DECLARE_TYPEINFO(QCheckPoint, Q_PRIMITIVE_TYPE); -
393 -
394Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCheckPoint &checkPoint, QFixed y) -
395{ -
396 return checkPoint.y < y;
executed: return checkPoint.y < y;
Execution Count:940
940
397} -
398 -
399Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCheckPoint &checkPoint, int pos) -
400{ -
401 return checkPoint.positionInFrame < pos;
executed: return checkPoint.positionInFrame < pos;
Execution Count:728
728
402} -
403 -
404#if defined(Q_CC_MSVC) && _MSC_VER < 1600 -
405//The STL implementation of MSVC 2008 requires the definitions -
406 -
407Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCheckPoint &checkPoint1, const QCheckPoint &checkPoint2) -
408{ -
409 return checkPoint1.y < checkPoint2.y; -
410} -
411 -
412Q_STATIC_GLOBAL_OPERATOR bool operator<(QFixed y, const QCheckPoint &checkPoint) -
413{ -
414 return y < checkPoint.y; -
415} -
416 -
417Q_STATIC_GLOBAL_OPERATOR bool operator<(int pos, const QCheckPoint &checkPoint) -
418{ -
419 return pos < checkPoint.positionInFrame; -
420} -
421 -
422#endif -
423 -
424static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect = QRectF()) -
425{ -
426 p->save();
never executed (the execution status of this line is deduced): p->save();
-
427 if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) {
never evaluated: brush.style() >= Qt::LinearGradientPattern
never evaluated: brush.style() <= Qt::ConicalGradientPattern
0
428 if (!gradientRect.isNull()) {
never evaluated: !gradientRect.isNull()
0
429 QTransform m;
never executed (the execution status of this line is deduced): QTransform m;
-
430 m.translate(gradientRect.left(), gradientRect.top());
never executed (the execution status of this line is deduced): m.translate(gradientRect.left(), gradientRect.top());
-
431 m.scale(gradientRect.width(), gradientRect.height());
never executed (the execution status of this line is deduced): m.scale(gradientRect.width(), gradientRect.height());
-
432 brush.setTransform(m);
never executed (the execution status of this line is deduced): brush.setTransform(m);
-
433 const_cast<QGradient *>(brush.gradient())->setCoordinateMode(QGradient::LogicalMode);
never executed (the execution status of this line is deduced): const_cast<QGradient *>(brush.gradient())->setCoordinateMode(QGradient::LogicalMode);
-
434 }
never executed: }
0
435 } else {
never executed: }
0
436 p->setBrushOrigin(origin);
never executed (the execution status of this line is deduced): p->setBrushOrigin(origin);
-
437 }
never executed: }
0
438 p->fillRect(rect, brush);
never executed (the execution status of this line is deduced): p->fillRect(rect, brush);
-
439 p->restore();
never executed (the execution status of this line is deduced): p->restore();
-
440}
never executed: }
0
441 -
442class QTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivate -
443{ -
444 Q_DECLARE_PUBLIC(QTextDocumentLayout) -
445public: -
446 QTextDocumentLayoutPrivate(); -
447 -
448 QTextOption::WrapMode wordWrapMode; -
449#ifdef LAYOUT_DEBUG -
450 mutable QString debug_indent; -
451#endif -
452 -
453 int fixedColumnWidth; -
454 int cursorWidth; -
455 -
456 QSizeF lastReportedSize; -
457 QRectF viewportRect; -
458 QRectF clipRect; -
459 -
460 mutable int currentLazyLayoutPosition; -
461 mutable int lazyLayoutStepSize; -
462 QBasicTimer layoutTimer; -
463 mutable QBasicTimer sizeChangedTimer; -
464 uint showLayoutProgress : 1; -
465 uint insideDocumentChange : 1; -
466 -
467 int lastPageCount; -
468 qreal idealWidth; -
469 bool contentHasAlignment; -
470 -
471 QFixed blockIndent(const QTextBlockFormat &blockFormat) const; -
472 -
473 void drawFrame(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, -
474 QTextFrame *f) const; -
475 void drawFlow(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, -
476 QTextFrame::Iterator it, const QList<QTextFrame *> &floats, QTextBlock *cursorBlockNeedingRepaint) const; -
477 void drawBlock(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, -
478 QTextBlock bl, bool inRootFrame) const; -
479 void drawListItem(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, -
480 QTextBlock bl, const QTextCharFormat *selectionFormat) const; -
481 void drawTableCell(const QRectF &cellRect, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &cell_context, -
482 QTextTable *table, QTextTableData *td, int r, int c, -
483 QTextBlock *cursorBlockNeedingRepaint, QPointF *cursorBlockOffset) const; -
484 void drawBorder(QPainter *painter, const QRectF &rect, qreal topMargin, qreal bottomMargin, qreal border, -
485 const QBrush &brush, QTextFrameFormat::BorderStyle style) const; -
486 void drawFrameDecoration(QPainter *painter, QTextFrame *frame, QTextFrameData *fd, const QRectF &clip, const QRectF &rect) const; -
487 -
488 enum HitPoint { -
489 PointBefore, -
490 PointAfter, -
491 PointInside, -
492 PointExact -
493 }; -
494 HitPoint hitTest(QTextFrame *frame, const QFixedPoint &point, int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const; -
495 HitPoint hitTest(QTextFrame::Iterator it, HitPoint hit, const QFixedPoint &p, -
496 int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const; -
497 HitPoint hitTest(QTextTable *table, const QFixedPoint &point, int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const; -
498 HitPoint hitTest(QTextBlock bl, const QFixedPoint &point, int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const; -
499 -
500 QTextLayoutStruct layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width, -
501 int layoutFrom, int layoutTo, QTextTableData *tableData, QFixed absoluteTableY, -
502 bool withPageBreaks); -
503 void setCellPosition(QTextTable *t, const QTextTableCell &cell, const QPointF &pos); -
504 QRectF layoutTable(QTextTable *t, int layoutFrom, int layoutTo, QFixed parentY); -
505 -
506 void positionFloat(QTextFrame *frame, QTextLine *currentLine = 0); -
507 -
508 // calls the next one -
509 QRectF layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed parentY = 0); -
510 QRectF layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed frameWidth, QFixed frameHeight, QFixed parentY = 0); -
511 -
512 void layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat, -
513 QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat); -
514 void layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width = 0); -
515 void pageBreakInsideTable(QTextTable *table, QTextLayoutStruct *layoutStruct); -
516 -
517 -
518 void floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const; -
519 QFixed findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const; -
520 -
521 QVector<QCheckPoint> checkPoints; -
522 -
523 QTextFrame::Iterator frameIteratorForYPosition(QFixed y) const; -
524 QTextFrame::Iterator frameIteratorForTextPosition(int position) const; -
525 -
526 void ensureLayouted(QFixed y) const; -
527 void ensureLayoutedByPosition(int position) const; -
528 inline void ensureLayoutFinished() const -
529 { ensureLayoutedByPosition(INT_MAX); }
executed: }
Execution Count:311
311
530 void layoutStep() const; -
531 -
532 QRectF frameBoundingRectInternal(QTextFrame *frame) const; -
533 -
534 qreal scaleToDevice(qreal value) const; -
535 QFixed scaleToDevice(QFixed value) const; -
536}; -
537 -
538QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate() -
539 : fixedColumnWidth(-1), -
540 cursorWidth(1), -
541 currentLazyLayoutPosition(-1), -
542 lazyLayoutStepSize(1000), -
543 lastPageCount(-1) -
544{ -
545 showLayoutProgress = true;
executed (the execution status of this line is deduced): showLayoutProgress = true;
-
546 insideDocumentChange = false;
executed (the execution status of this line is deduced): insideDocumentChange = false;
-
547 idealWidth = 0;
executed (the execution status of this line is deduced): idealWidth = 0;
-
548 contentHasAlignment = false;
executed (the execution status of this line is deduced): contentHasAlignment = false;
-
549}
executed: }
Execution Count:314
314
550 -
551QTextFrame::Iterator QTextDocumentLayoutPrivate::frameIteratorForYPosition(QFixed y) const -
552{ -
553 QTextFrame *rootFrame = document->rootFrame();
executed (the execution status of this line is deduced): QTextFrame *rootFrame = document->rootFrame();
-
554 -
555 if (checkPoints.isEmpty()
partially evaluated: checkPoints.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:307
0-307
556 || y < 0 || y > data(rootFrame)->size.height)
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:307
partially evaluated: y > data(rootFrame)->size.height
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:307
0-307
557 return rootFrame->begin();
never executed: return rootFrame->begin();
0
558 -
559 QVector<QCheckPoint>::ConstIterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), y);
executed (the execution status of this line is deduced): QVector<QCheckPoint>::ConstIterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), y);
-
560 if (checkPoint == checkPoints.end())
partially evaluated: checkPoint == checkPoints.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:307
0-307
561 return rootFrame->begin();
never executed: return rootFrame->begin();
0
562 -
563 if (checkPoint != checkPoints.begin())
evaluated: checkPoint != checkPoints.begin()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:279
28-279
564 --checkPoint;
executed: --checkPoint;
Execution Count:28
28
565 -
566 const int position = rootFrame->firstPosition() + checkPoint->positionInFrame;
executed (the execution status of this line is deduced): const int position = rootFrame->firstPosition() + checkPoint->positionInFrame;
-
567 return frameIteratorForTextPosition(position);
executed: return frameIteratorForTextPosition(position);
Execution Count:307
307
568} -
569 -
570QTextFrame::Iterator QTextDocumentLayoutPrivate::frameIteratorForTextPosition(int position) const -
571{ -
572 QTextFrame *rootFrame = docPrivate->rootFrame();
executed (the execution status of this line is deduced): QTextFrame *rootFrame = docPrivate->rootFrame();
-
573 -
574 const QTextDocumentPrivate::BlockMap &map = docPrivate->blockMap();
executed (the execution status of this line is deduced): const QTextDocumentPrivate::BlockMap &map = docPrivate->blockMap();
-
575 const int begin = map.findNode(rootFrame->firstPosition());
executed (the execution status of this line is deduced): const int begin = map.findNode(rootFrame->firstPosition());
-
576 const int end = map.findNode(rootFrame->lastPosition()+1);
executed (the execution status of this line is deduced): const int end = map.findNode(rootFrame->lastPosition()+1);
-
577 -
578 const int block = map.findNode(position);
executed (the execution status of this line is deduced): const int block = map.findNode(position);
-
579 const int blockPos = map.position(block);
executed (the execution status of this line is deduced): const int blockPos = map.position(block);
-
580 -
581 QTextFrame::iterator it(rootFrame, block, begin, end);
executed (the execution status of this line is deduced): QTextFrame::iterator it(rootFrame, block, begin, end);
-
582 -
583 QTextFrame *containingFrame = docPrivate->frameAt(blockPos);
executed (the execution status of this line is deduced): QTextFrame *containingFrame = docPrivate->frameAt(blockPos);
-
584 if (containingFrame != rootFrame) {
partially evaluated: containingFrame != rootFrame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:671
0-671
585 while (containingFrame->parentFrame() != rootFrame) {
never evaluated: containingFrame->parentFrame() != rootFrame
0
586 containingFrame = containingFrame->parentFrame();
never executed (the execution status of this line is deduced): containingFrame = containingFrame->parentFrame();
-
587 Q_ASSERT(containingFrame);
never executed (the execution status of this line is deduced): qt_noop();
-
588 }
never executed: }
0
589 -
590 it.cf = containingFrame;
never executed (the execution status of this line is deduced): it.cf = containingFrame;
-
591 it.cb = 0;
never executed (the execution status of this line is deduced): it.cb = 0;
-
592 }
never executed: }
0
593 -
594 return it;
executed: return it;
Execution Count:671
671
595} -
596 -
597QTextDocumentLayoutPrivate::HitPoint -
598QTextDocumentLayoutPrivate::hitTest(QTextFrame *frame, const QFixedPoint &point, int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const -
599{ -
600 QTextFrameData *fd = data(frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(frame);
-
601 // ######### -
602 if (fd->layoutDirty)
partially evaluated: fd->layoutDirty
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
603 return PointAfter;
never executed: return PointAfter;
0
604 Q_ASSERT(!fd->layoutDirty);
executed (the execution status of this line is deduced): qt_noop();
-
605 Q_ASSERT(!fd->sizeDirty);
executed (the execution status of this line is deduced): qt_noop();
-
606 const QFixedPoint relativePoint(point.x - fd->position.x, point.y - fd->position.y);
executed (the execution status of this line is deduced): const QFixedPoint relativePoint(point.x - fd->position.x, point.y - fd->position.y);
-
607 -
608 QTextFrame *rootFrame = docPrivate->rootFrame();
executed (the execution status of this line is deduced): QTextFrame *rootFrame = docPrivate->rootFrame();
-
609 -
610// LDEBUG << "checking frame" << frame->firstPosition() << "point=" << point -
611// << "position" << fd->position << "size" << fd->size; -
612 if (frame != rootFrame) {
partially evaluated: frame != rootFrame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
613 if (relativePoint.y < 0 || relativePoint.x < 0) {
never evaluated: relativePoint.y < 0
never evaluated: relativePoint.x < 0
0
614 *position = frame->firstPosition() - 1;
never executed (the execution status of this line is deduced): *position = frame->firstPosition() - 1;
-
615// LDEBUG << "before pos=" << *position; -
616 return PointBefore;
never executed: return PointBefore;
0
617 } else if (relativePoint.y > fd->size.height || relativePoint.x > fd->size.width) {
never evaluated: relativePoint.y > fd->size.height
never evaluated: relativePoint.x > fd->size.width
0
618 *position = frame->lastPosition() + 1;
never executed (the execution status of this line is deduced): *position = frame->lastPosition() + 1;
-
619// LDEBUG << "after pos=" << *position; -
620 return PointAfter;
never executed: return PointAfter;
0
621 } -
622 } -
623 -
624 if (isFrameFromInlineObject(frame)) {
partially evaluated: isFrameFromInlineObject(frame)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
625 *position = frame->firstPosition() - 1;
never executed (the execution status of this line is deduced): *position = frame->firstPosition() - 1;
-
626 return PointExact;
never executed: return PointExact;
0
627 } -
628 -
629 if (QTextTable *table = qobject_cast<QTextTable *>(frame)) {
partially evaluated: QTextTable *table = qobject_cast<QTextTable *>(frame)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
630 const int rows = table->rows();
never executed (the execution status of this line is deduced): const int rows = table->rows();
-
631 const int columns = table->columns();
never executed (the execution status of this line is deduced): const int columns = table->columns();
-
632 QTextTableData *td = static_cast<QTextTableData *>(data(table));
never executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(table));
-
633 -
634 if (!td->childFrameMap.isEmpty()) {
never evaluated: !td->childFrameMap.isEmpty()
0
635 for (int r = 0; r < rows; ++r) {
never evaluated: r < rows
0
636 for (int c = 0; c < columns; ++c) {
never evaluated: c < columns
0
637 QTextTableCell cell = table->cellAt(r, c);
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(r, c);
-
638 if (cell.row() != r || cell.column() != c)
never evaluated: cell.row() != r
never evaluated: cell.column() != c
0
639 continue;
never executed: continue;
0
640 -
641 QRectF cellRect = td->cellRect(cell);
never executed (the execution status of this line is deduced): QRectF cellRect = td->cellRect(cell);
-
642 const QFixedPoint cellPos = QFixedPoint::fromPointF(cellRect.topLeft());
never executed (the execution status of this line is deduced): const QFixedPoint cellPos = QFixedPoint::fromPointF(cellRect.topLeft());
-
643 const QFixedPoint pointInCell = relativePoint - cellPos;
never executed (the execution status of this line is deduced): const QFixedPoint pointInCell = relativePoint - cellPos;
-
644 -
645 const QList<QTextFrame *> childFrames = td->childFrameMap.values(r + c * rows);
never executed (the execution status of this line is deduced): const QList<QTextFrame *> childFrames = td->childFrameMap.values(r + c * rows);
-
646 for (int i = 0; i < childFrames.size(); ++i) {
never evaluated: i < childFrames.size()
0
647 QTextFrame *child = childFrames.at(i);
never executed (the execution status of this line is deduced): QTextFrame *child = childFrames.at(i);
-
648 if (isFrameFromInlineObject(child)
never evaluated: isFrameFromInlineObject(child)
0
649 && child->frameFormat().position() != QTextFrameFormat::InFlow
never evaluated: child->frameFormat().position() != QTextFrameFormat::InFlow
0
650 && hitTest(child, pointInCell, position, l, accuracy) == PointExact)
never evaluated: hitTest(child, pointInCell, position, l, accuracy) == PointExact
0
651 { -
652 return PointExact;
never executed: return PointExact;
0
653 } -
654 }
never executed: }
0
655 }
never executed: }
0
656 }
never executed: }
0
657 }
never executed: }
0
658 -
659 return hitTest(table, relativePoint, position, l, accuracy);
never executed: return hitTest(table, relativePoint, position, l, accuracy);
0
660 } -
661 -
662 const QList<QTextFrame *> childFrames = frame->childFrames();
executed (the execution status of this line is deduced): const QList<QTextFrame *> childFrames = frame->childFrames();
-
663 for (int i = 0; i < childFrames.size(); ++i) {
partially evaluated: i < childFrames.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
664 QTextFrame *child = childFrames.at(i);
never executed (the execution status of this line is deduced): QTextFrame *child = childFrames.at(i);
-
665 if (isFrameFromInlineObject(child)
never evaluated: isFrameFromInlineObject(child)
0
666 && child->frameFormat().position() != QTextFrameFormat::InFlow
never evaluated: child->frameFormat().position() != QTextFrameFormat::InFlow
0
667 && hitTest(child, relativePoint, position, l, accuracy) == PointExact)
never evaluated: hitTest(child, relativePoint, position, l, accuracy) == PointExact
0
668 { -
669 return PointExact;
never executed: return PointExact;
0
670 } -
671 }
never executed: }
0
672 -
673 QTextFrame::Iterator it = frame->begin();
executed (the execution status of this line is deduced): QTextFrame::Iterator it = frame->begin();
-
674 -
675 if (frame == rootFrame) {
partially evaluated: frame == rootFrame
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
676 it = frameIteratorForYPosition(relativePoint.y);
executed (the execution status of this line is deduced): it = frameIteratorForYPosition(relativePoint.y);
-
677 -
678 Q_ASSERT(it.parentFrame() == frame);
executed (the execution status of this line is deduced): qt_noop();
-
679 }
executed: }
Execution Count:9
9
680 -
681 if (it.currentFrame())
partially evaluated: it.currentFrame()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
682 *position = it.currentFrame()->firstPosition();
never executed: *position = it.currentFrame()->firstPosition();
0
683 else -
684 *position = it.currentBlock().position();
executed: *position = it.currentBlock().position();
Execution Count:9
9
685 -
686 return hitTest(it, PointBefore, relativePoint, position, l, accuracy);
executed: return hitTest(it, PointBefore, relativePoint, position, l, accuracy);
Execution Count:9
9
687} -
688 -
689QTextDocumentLayoutPrivate::HitPoint -
690QTextDocumentLayoutPrivate::hitTest(QTextFrame::Iterator it, HitPoint hit, const QFixedPoint &p, -
691 int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const -
692{ -
693 INC_INDENT;
executed: }
Execution Count:9
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
694 -
695 for (; !it.atEnd(); ++it) {
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
1-13
696 QTextFrame *c = it.currentFrame();
executed (the execution status of this line is deduced): QTextFrame *c = it.currentFrame();
-
697 HitPoint hp;
executed (the execution status of this line is deduced): HitPoint hp;
-
698 int pos = -1;
executed (the execution status of this line is deduced): int pos = -1;
-
699 if (c) {
partially evaluated: c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
700 hp = hitTest(c, p, &pos, l, accuracy);
never executed (the execution status of this line is deduced): hp = hitTest(c, p, &pos, l, accuracy);
-
701 } else {
never executed: }
0
702 hp = hitTest(it.currentBlock(), p, &pos, l, accuracy);
executed (the execution status of this line is deduced): hp = hitTest(it.currentBlock(), p, &pos, l, accuracy);
-
703 }
executed: }
Execution Count:13
13
704 if (hp >= PointInside) {
evaluated: hp >= PointInside
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5
5-8
705 if (isEmptyBlockBeforeTable(it))
partially evaluated: isEmptyBlockBeforeTable(it)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
706 continue;
never executed: continue;
0
707 hit = hp;
executed (the execution status of this line is deduced): hit = hp;
-
708 *position = pos;
executed (the execution status of this line is deduced): *position = pos;
-
709 break;
executed: break;
Execution Count:8
8
710 } -
711 if (hp == PointBefore && pos < *position) {
partially evaluated: hp == PointBefore
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
never evaluated: pos < *position
0-5
712 *position = pos;
never executed (the execution status of this line is deduced): *position = pos;
-
713 hit = hp;
never executed (the execution status of this line is deduced): hit = hp;
-
714 } else if (hp == PointAfter && pos > *position) {
never executed: }
partially evaluated: hp == PointAfter
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: pos > *position
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
715 *position = pos;
executed (the execution status of this line is deduced): *position = pos;
-
716 hit = hp;
executed (the execution status of this line is deduced): hit = hp;
-
717 }
executed: }
Execution Count:5
5
718 } -
719 -
720 DEC_INDENT;
executed: }
Execution Count:9
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
721// LDEBUG << "inside=" << hit << " pos=" << *position; -
722 return hit;
executed: return hit;
Execution Count:9
9
723} -
724 -
725QTextDocumentLayoutPrivate::HitPoint -
726QTextDocumentLayoutPrivate::hitTest(QTextTable *table, const QFixedPoint &point, -
727 int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const -
728{ -
729 QTextTableData *td = static_cast<QTextTableData *>(data(table));
never executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(table));
-
730 -
731 QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
never executed (the execution status of this line is deduced): QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
-
732 if (rowIt == td->rowPositions.constEnd()) {
never evaluated: rowIt == td->rowPositions.constEnd()
0
733 rowIt = td->rowPositions.constEnd() - 1;
never executed (the execution status of this line is deduced): rowIt = td->rowPositions.constEnd() - 1;
-
734 } else if (rowIt != td->rowPositions.constBegin()) {
never executed: }
never evaluated: rowIt != td->rowPositions.constBegin()
0
735 --rowIt;
never executed (the execution status of this line is deduced): --rowIt;
-
736 }
never executed: }
0
737 -
738 QVector<QFixed>::ConstIterator colIt = std::lower_bound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
never executed (the execution status of this line is deduced): QVector<QFixed>::ConstIterator colIt = std::lower_bound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
-
739 if (colIt == td->columnPositions.constEnd()) {
never evaluated: colIt == td->columnPositions.constEnd()
0
740 colIt = td->columnPositions.constEnd() - 1;
never executed (the execution status of this line is deduced): colIt = td->columnPositions.constEnd() - 1;
-
741 } else if (colIt != td->columnPositions.constBegin()) {
never executed: }
never evaluated: colIt != td->columnPositions.constBegin()
0
742 --colIt;
never executed (the execution status of this line is deduced): --colIt;
-
743 }
never executed: }
0
744 -
745 QTextTableCell cell = table->cellAt(rowIt - td->rowPositions.constBegin(),
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(rowIt - td->rowPositions.constBegin(),
-
746 colIt - td->columnPositions.constBegin());
never executed (the execution status of this line is deduced): colIt - td->columnPositions.constBegin());
-
747 if (!cell.isValid())
never evaluated: !cell.isValid()
0
748 return PointBefore;
never executed: return PointBefore;
0
749 -
750 *position = cell.firstPosition();
never executed (the execution status of this line is deduced): *position = cell.firstPosition();
-
751 -
752 HitPoint hp = hitTest(cell.begin(), PointInside, point - td->cellPosition(cell), position, l, accuracy);
never executed (the execution status of this line is deduced): HitPoint hp = hitTest(cell.begin(), PointInside, point - td->cellPosition(cell), position, l, accuracy);
-
753 -
754 if (hp == PointExact)
never evaluated: hp == PointExact
0
755 return hp;
never executed: return hp;
0
756 if (hp == PointAfter)
never evaluated: hp == PointAfter
0
757 *position = cell.lastPosition();
never executed: *position = cell.lastPosition();
0
758 return PointInside;
never executed: return PointInside;
0
759} -
760 -
761QTextDocumentLayoutPrivate::HitPoint -
762QTextDocumentLayoutPrivate::hitTest(QTextBlock bl, const QFixedPoint &point, int *position, QTextLayout **l, -
763 Qt::HitTestAccuracy accuracy) const -
764{ -
765 QTextLayout *tl = bl.layout();
executed (the execution status of this line is deduced): QTextLayout *tl = bl.layout();
-
766 QRectF textrect = tl->boundingRect();
executed (the execution status of this line is deduced): QRectF textrect = tl->boundingRect();
-
767 textrect.translate(tl->position());
executed (the execution status of this line is deduced): textrect.translate(tl->position());
-
768// LDEBUG << " checking block" << bl.position() << "point=" << point -
769// << " tlrect" << textrect; -
770 *position = bl.position();
executed (the execution status of this line is deduced): *position = bl.position();
-
771 if (point.y.toReal() < textrect.top()) {
partially evaluated: point.y.toReal() < textrect.top()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
772// LDEBUG << " before pos=" << *position; -
773 return PointBefore;
never executed: return PointBefore;
0
774 } else if (point.y.toReal() > textrect.bottom()) {
evaluated: point.y.toReal() > textrect.bottom()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:8
5-8
775 *position += bl.length();
executed (the execution status of this line is deduced): *position += bl.length();
-
776// LDEBUG << " after pos=" << *position; -
777 return PointAfter;
executed: return PointAfter;
Execution Count:5
5
778 } -
779 -
780 QPointF pos = point.toPointF() - tl->position();
executed (the execution status of this line is deduced): QPointF pos = point.toPointF() - tl->position();
-
781 -
782 // ### rtl? -
783 -
784 HitPoint hit = PointInside;
executed (the execution status of this line is deduced): HitPoint hit = PointInside;
-
785 *l = tl;
executed (the execution status of this line is deduced): *l = tl;
-
786 int off = 0;
executed (the execution status of this line is deduced): int off = 0;
-
787 for (int i = 0; i < tl->lineCount(); ++i) {
partially evaluated: i < tl->lineCount()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
788 QTextLine line = tl->lineAt(i);
executed (the execution status of this line is deduced): QTextLine line = tl->lineAt(i);
-
789 const QRectF lr = line.naturalTextRect();
executed (the execution status of this line is deduced): const QRectF lr = line.naturalTextRect();
-
790 if (lr.top() > pos.y()) {
partially evaluated: lr.top() > pos.y()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
791 off = qMin(off, line.textStart());
never executed (the execution status of this line is deduced): off = qMin(off, line.textStart());
-
792 } else if (lr.bottom() <= pos.y()) {
never executed: }
evaluated: lr.bottom() <= pos.y()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
0-8
793 off = qMax(off, line.textStart() + line.textLength());
executed (the execution status of this line is deduced): off = qMax(off, line.textStart() + line.textLength());
-
794 } else {
executed: }
Execution Count:1
1
795 if (lr.left() <= pos.x() && lr.right() >= pos.x())
partially evaluated: lr.left() <= pos.x()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: lr.right() >= pos.x()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
796 hit = PointExact;
executed: hit = PointExact;
Execution Count:8
8
797 // when trying to hit an anchor we want it to hit not only in the left -
798 // half -
799 if (accuracy == Qt::ExactHit)
evaluated: accuracy == Qt::ExactHit
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
800 off = line.xToCursor(pos.x(), QTextLine::CursorOnCharacter);
executed: off = line.xToCursor(pos.x(), QTextLine::CursorOnCharacter);
Execution Count:6
6
801 else -
802 off = line.xToCursor(pos.x(), QTextLine::CursorBetweenCharacters);
executed: off = line.xToCursor(pos.x(), QTextLine::CursorBetweenCharacters);
Execution Count:2
2
803 break;
executed: break;
Execution Count:8
8
804 } -
805 } -
806 *position += off;
executed (the execution status of this line is deduced): *position += off;
-
807 -
808// LDEBUG << " inside=" << hit << " pos=" << *position; -
809 return hit;
executed: return hit;
Execution Count:8
8
810} -
811 -
812// ### could be moved to QTextBlock -
813QFixed QTextDocumentLayoutPrivate::blockIndent(const QTextBlockFormat &blockFormat) const -
814{ -
815 qreal indent = blockFormat.indent();
executed (the execution status of this line is deduced): qreal indent = blockFormat.indent();
-
816 -
817 QTextObject *object = document->objectForFormat(blockFormat);
executed (the execution status of this line is deduced): QTextObject *object = document->objectForFormat(blockFormat);
-
818 if (object)
partially evaluated: object
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3643
0-3643
819 indent += object->format().toListFormat().indent();
never executed: indent += object->format().toListFormat().indent();
0
820 -
821 if (qIsNull(indent))
partially evaluated: qIsNull(indent)
TRUEFALSE
yes
Evaluation Count:3643
no
Evaluation Count:0
0-3643
822 return 0;
executed: return 0;
Execution Count:3643
3643
823 -
824 qreal scale = 1;
never executed (the execution status of this line is deduced): qreal scale = 1;
-
825 if (paintDevice) {
never evaluated: paintDevice
0
826 scale = qreal(paintDevice->logicalDpiY()) / qreal(qt_defaultDpi());
never executed (the execution status of this line is deduced): scale = qreal(paintDevice->logicalDpiY()) / qreal(qt_defaultDpi());
-
827 }
never executed: }
0
828 -
829 return QFixed::fromReal(indent * scale * document->indentWidth());
never executed: return QFixed::fromReal(indent * scale * document->indentWidth());
0
830} -
831 -
832void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rect, qreal topMargin, qreal bottomMargin, -
833 qreal border, const QBrush &brush, QTextFrameFormat::BorderStyle style) const -
834{ -
835 const qreal pageHeight = document->pageSize().height();
executed (the execution status of this line is deduced): const qreal pageHeight = document->pageSize().height();
-
836 const int topPage = pageHeight > 0 ? static_cast<int>(rect.top() / pageHeight) : 0;
partially evaluated: pageHeight > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:58
0-58
837 const int bottomPage = pageHeight > 0 ? static_cast<int>((rect.bottom() + border) / pageHeight) : 0;
partially evaluated: pageHeight > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:58
0-58
838 -
839#ifndef QT_NO_CSSPARSER -
840 QCss::BorderStyle cssStyle = static_cast<QCss::BorderStyle>(style + 1);
executed (the execution status of this line is deduced): QCss::BorderStyle cssStyle = static_cast<QCss::BorderStyle>(style + 1);
-
841#endif //QT_NO_CSSPARSER -
842 -
843 bool turn_off_antialiasing = !(painter->renderHints() & QPainter::Antialiasing);
executed (the execution status of this line is deduced): bool turn_off_antialiasing = !(painter->renderHints() & QPainter::Antialiasing);
-
844 painter->setRenderHint(QPainter::Antialiasing);
executed (the execution status of this line is deduced): painter->setRenderHint(QPainter::Antialiasing);
-
845 -
846 for (int i = topPage; i <= bottomPage; ++i) {
evaluated: i <= bottomPage
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:58
58
847 QRectF clipped = rect.toRect();
executed (the execution status of this line is deduced): QRectF clipped = rect.toRect();
-
848 -
849 if (topPage != bottomPage) {
partially evaluated: topPage != bottomPage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:58
0-58
850 clipped.setTop(qMax(clipped.top(), i * pageHeight + topMargin - border));
never executed (the execution status of this line is deduced): clipped.setTop(qMax(clipped.top(), i * pageHeight + topMargin - border));
-
851 clipped.setBottom(qMin(clipped.bottom(), (i + 1) * pageHeight - bottomMargin));
never executed (the execution status of this line is deduced): clipped.setBottom(qMin(clipped.bottom(), (i + 1) * pageHeight - bottomMargin));
-
852 -
853 if (clipped.bottom() <= clipped.top())
never evaluated: clipped.bottom() <= clipped.top()
0
854 continue;
never executed: continue;
0
855 }
never executed: }
0
856#ifndef QT_NO_CSSPARSER -
857 qDrawEdge(painter, clipped.left(), clipped.top(), clipped.left() + border, clipped.bottom() + border, 0, 0, QCss::LeftEdge, cssStyle, brush);
executed (the execution status of this line is deduced): qDrawEdge(painter, clipped.left(), clipped.top(), clipped.left() + border, clipped.bottom() + border, 0, 0, QCss::LeftEdge, cssStyle, brush);
-
858 qDrawEdge(painter, clipped.left() + border, clipped.top(), clipped.right() + border, clipped.top() + border, 0, 0, QCss::TopEdge, cssStyle, brush);
executed (the execution status of this line is deduced): qDrawEdge(painter, clipped.left() + border, clipped.top(), clipped.right() + border, clipped.top() + border, 0, 0, QCss::TopEdge, cssStyle, brush);
-
859 qDrawEdge(painter, clipped.right(), clipped.top() + border, clipped.right() + border, clipped.bottom(), 0, 0, QCss::RightEdge, cssStyle, brush);
executed (the execution status of this line is deduced): qDrawEdge(painter, clipped.right(), clipped.top() + border, clipped.right() + border, clipped.bottom(), 0, 0, QCss::RightEdge, cssStyle, brush);
-
860 qDrawEdge(painter, clipped.left() + border, clipped.bottom(), clipped.right() + border, clipped.bottom() + border, 0, 0, QCss::BottomEdge, cssStyle, brush);
executed (the execution status of this line is deduced): qDrawEdge(painter, clipped.left() + border, clipped.bottom(), clipped.right() + border, clipped.bottom() + border, 0, 0, QCss::BottomEdge, cssStyle, brush);
-
861#else -
862 painter->save(); -
863 painter->setPen(Qt::NoPen); -
864 painter->setBrush(brush); -
865 painter->drawRect(QRectF(clipped.left(), clipped.top(), clipped.left() + border, clipped.bottom() + border)); -
866 painter->drawRect(QRectF(clipped.left() + border, clipped.top(), clipped.right() + border, clipped.top() + border)); -
867 painter->drawRect(QRectF(clipped.right(), clipped.top() + border, clipped.right() + border, clipped.bottom())); -
868 painter->drawRect(QRectF(clipped.left() + border, clipped.bottom(), clipped.right() + border, clipped.bottom() + border)); -
869 painter->restore(); -
870#endif //QT_NO_CSSPARSER -
871 }
executed: }
Execution Count:58
58
872 if (turn_off_antialiasing)
partially evaluated: turn_off_antialiasing
TRUEFALSE
yes
Evaluation Count:58
no
Evaluation Count:0
0-58
873 painter->setRenderHint(QPainter::Antialiasing, false);
executed: painter->setRenderHint(QPainter::Antialiasing, false);
Execution Count:58
58
874}
executed: }
Execution Count:58
58
875 -
876void QTextDocumentLayoutPrivate::drawFrameDecoration(QPainter *painter, QTextFrame *frame, QTextFrameData *fd, const QRectF &clip, const QRectF &rect) const -
877{ -
878 -
879 const QBrush bg = frame->frameFormat().background();
executed (the execution status of this line is deduced): const QBrush bg = frame->frameFormat().background();
-
880 if (bg != Qt::NoBrush) {
partially evaluated: bg != Qt::NoBrush
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:307
0-307
881 QRectF bgRect = rect;
never executed (the execution status of this line is deduced): QRectF bgRect = rect;
-
882 bgRect.adjust((fd->leftMargin + fd->border).toReal(),
never executed (the execution status of this line is deduced): bgRect.adjust((fd->leftMargin + fd->border).toReal(),
-
883 (fd->topMargin + fd->border).toReal(),
never executed (the execution status of this line is deduced): (fd->topMargin + fd->border).toReal(),
-
884 - (fd->rightMargin + fd->border).toReal(),
never executed (the execution status of this line is deduced): - (fd->rightMargin + fd->border).toReal(),
-
885 - (fd->bottomMargin + fd->border).toReal());
never executed (the execution status of this line is deduced): - (fd->bottomMargin + fd->border).toReal());
-
886 -
887 QRectF gradientRect; // invalid makes it default to bgRect
never executed (the execution status of this line is deduced): QRectF gradientRect;
-
888 QPointF origin = bgRect.topLeft();
never executed (the execution status of this line is deduced): QPointF origin = bgRect.topLeft();
-
889 if (!frame->parentFrame()) {
never evaluated: !frame->parentFrame()
0
890 bgRect = clip;
never executed (the execution status of this line is deduced): bgRect = clip;
-
891 gradientRect.setWidth(painter->device()->width());
never executed (the execution status of this line is deduced): gradientRect.setWidth(painter->device()->width());
-
892 gradientRect.setHeight(painter->device()->height());
never executed (the execution status of this line is deduced): gradientRect.setHeight(painter->device()->height());
-
893 }
never executed: }
0
894 fillBackground(painter, bgRect, bg, origin, gradientRect);
never executed (the execution status of this line is deduced): fillBackground(painter, bgRect, bg, origin, gradientRect);
-
895 }
never executed: }
0
896 if (fd->border != 0) {
evaluated: fd->border != 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:299
8-299
897 painter->save();
executed (the execution status of this line is deduced): painter->save();
-
898 painter->setBrush(Qt::lightGray);
executed (the execution status of this line is deduced): painter->setBrush(Qt::lightGray);
-
899 painter->setPen(Qt::NoPen);
executed (the execution status of this line is deduced): painter->setPen(Qt::NoPen);
-
900 -
901 const qreal leftEdge = rect.left() + fd->leftMargin.toReal();
executed (the execution status of this line is deduced): const qreal leftEdge = rect.left() + fd->leftMargin.toReal();
-
902 const qreal border = fd->border.toReal();
executed (the execution status of this line is deduced): const qreal border = fd->border.toReal();
-
903 const qreal topMargin = fd->topMargin.toReal();
executed (the execution status of this line is deduced): const qreal topMargin = fd->topMargin.toReal();
-
904 const qreal leftMargin = fd->leftMargin.toReal();
executed (the execution status of this line is deduced): const qreal leftMargin = fd->leftMargin.toReal();
-
905 const qreal bottomMargin = fd->bottomMargin.toReal();
executed (the execution status of this line is deduced): const qreal bottomMargin = fd->bottomMargin.toReal();
-
906 const qreal rightMargin = fd->rightMargin.toReal();
executed (the execution status of this line is deduced): const qreal rightMargin = fd->rightMargin.toReal();
-
907 const qreal w = rect.width() - 2 * border - leftMargin - rightMargin;
executed (the execution status of this line is deduced): const qreal w = rect.width() - 2 * border - leftMargin - rightMargin;
-
908 const qreal h = rect.height() - 2 * border - topMargin - bottomMargin;
executed (the execution status of this line is deduced): const qreal h = rect.height() - 2 * border - topMargin - bottomMargin;
-
909 -
910 drawBorder(painter, QRectF(leftEdge, rect.top() + topMargin, w + border, h + border),
executed (the execution status of this line is deduced): drawBorder(painter, QRectF(leftEdge, rect.top() + topMargin, w + border, h + border),
-
911 fd->effectiveTopMargin.toReal(), fd->effectiveBottomMargin.toReal(),
executed (the execution status of this line is deduced): fd->effectiveTopMargin.toReal(), fd->effectiveBottomMargin.toReal(),
-
912 border, frame->frameFormat().borderBrush(), frame->frameFormat().borderStyle());
executed (the execution status of this line is deduced): border, frame->frameFormat().borderBrush(), frame->frameFormat().borderStyle());
-
913 -
914 painter->restore();
executed (the execution status of this line is deduced): painter->restore();
-
915 }
executed: }
Execution Count:8
8
916}
executed: }
Execution Count:307
307
917 -
918static void adjustContextSelectionsForCell(QAbstractTextDocumentLayout::PaintContext &cell_context, -
919 const QTextTableCell &cell, -
920 int r, int c, -
921 const int *selectedTableCells) -
922{ -
923 for (int i = 0; i < cell_context.selections.size(); ++i) {
partially evaluated: i < cell_context.selections.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:75
0-75
924 int row_start = selectedTableCells[i * 4];
never executed (the execution status of this line is deduced): int row_start = selectedTableCells[i * 4];
-
925 int col_start = selectedTableCells[i * 4 + 1];
never executed (the execution status of this line is deduced): int col_start = selectedTableCells[i * 4 + 1];
-
926 int num_rows = selectedTableCells[i * 4 + 2];
never executed (the execution status of this line is deduced): int num_rows = selectedTableCells[i * 4 + 2];
-
927 int num_cols = selectedTableCells[i * 4 + 3];
never executed (the execution status of this line is deduced): int num_cols = selectedTableCells[i * 4 + 3];
-
928 -
929 if (row_start != -1) {
never evaluated: row_start != -1
0
930 if (r >= row_start && r < row_start + num_rows
never evaluated: r >= row_start
never evaluated: r < row_start + num_rows
0
931 && c >= col_start && c < col_start + num_cols)
never evaluated: c >= col_start
never evaluated: c < col_start + num_cols
0
932 { -
933 int firstPosition = cell.firstPosition();
never executed (the execution status of this line is deduced): int firstPosition = cell.firstPosition();
-
934 int lastPosition = cell.lastPosition();
never executed (the execution status of this line is deduced): int lastPosition = cell.lastPosition();
-
935 -
936 // make sure empty cells are still selected -
937 if (firstPosition == lastPosition)
never evaluated: firstPosition == lastPosition
0
938 ++lastPosition;
never executed: ++lastPosition;
0
939 -
940 cell_context.selections[i].cursor.setPosition(firstPosition);
never executed (the execution status of this line is deduced): cell_context.selections[i].cursor.setPosition(firstPosition);
-
941 cell_context.selections[i].cursor.setPosition(lastPosition, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cell_context.selections[i].cursor.setPosition(lastPosition, QTextCursor::KeepAnchor);
-
942 } else {
never executed: }
0
943 cell_context.selections[i].cursor.clearSelection();
never executed (the execution status of this line is deduced): cell_context.selections[i].cursor.clearSelection();
-
944 }
never executed: }
0
945 } -
946 -
947 // FullWidthSelection is not useful for tables -
948 cell_context.selections[i].format.clearProperty(QTextFormat::FullWidthSelection);
never executed (the execution status of this line is deduced): cell_context.selections[i].format.clearProperty(QTextFormat::FullWidthSelection);
-
949 }
never executed: }
0
950}
executed: }
Execution Count:75
75
951 -
952void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *painter, -
953 const QAbstractTextDocumentLayout::PaintContext &context, -
954 QTextFrame *frame) const -
955{ -
956 QTextFrameData *fd = data(frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(frame);
-
957 // ####### -
958 if (fd->layoutDirty)
partially evaluated: fd->layoutDirty
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:307
0-307
959 return;
never executed: return;
0
960 Q_ASSERT(!fd->sizeDirty);
executed (the execution status of this line is deduced): qt_noop();
-
961 Q_ASSERT(!fd->layoutDirty);
executed (the execution status of this line is deduced): qt_noop();
-
962 -
963 const QPointF off = offset + fd->position.toPointF();
executed (the execution status of this line is deduced): const QPointF off = offset + fd->position.toPointF();
-
964 if (context.clip.isValid()
evaluated: context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:282
yes
Evaluation Count:25
25-282
965 && (off.y() > context.clip.bottom() || off.y() + fd->size.height.toReal() < context.clip.top()
partially evaluated: off.y() > context.clip.bottom()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
partially evaluated: off.y() + fd->size.height.toReal() < context.clip.top()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
0-282
966 || off.x() > context.clip.right() || off.x() + fd->size.width.toReal() < context.clip.left()))
partially evaluated: off.x() > context.clip.right()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
partially evaluated: off.x() + fd->size.width.toReal() < context.clip.left()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
0-282
967 return;
never executed: return;
0
968 -
969// LDEBUG << debug_indent << "drawFrame" << frame->firstPosition() << "--" << frame->lastPosition() << "at" << offset; -
970// INC_INDENT; -
971 -
972 // if the cursor is /on/ a table border we may need to repaint it -
973 // afterwards, as we usually draw the decoration first -
974 QTextBlock cursorBlockNeedingRepaint;
executed (the execution status of this line is deduced): QTextBlock cursorBlockNeedingRepaint;
-
975 QPointF offsetOfRepaintedCursorBlock = off;
executed (the execution status of this line is deduced): QPointF offsetOfRepaintedCursorBlock = off;
-
976 -
977 QTextTable *table = qobject_cast<QTextTable *>(frame);
executed (the execution status of this line is deduced): QTextTable *table = qobject_cast<QTextTable *>(frame);
-
978 const QRectF frameRect(off, fd->size.toSizeF());
executed (the execution status of this line is deduced): const QRectF frameRect(off, fd->size.toSizeF());
-
979 -
980 if (table) {
evaluated: table
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:298
9-298
981 const int rows = table->rows();
executed (the execution status of this line is deduced): const int rows = table->rows();
-
982 const int columns = table->columns();
executed (the execution status of this line is deduced): const int columns = table->columns();
-
983 QTextTableData *td = static_cast<QTextTableData *>(data(table));
executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(table));
-
984 -
985 QVarLengthArray<int> selectedTableCells(context.selections.size() * 4);
executed (the execution status of this line is deduced): QVarLengthArray<int> selectedTableCells(context.selections.size() * 4);
-
986 for (int i = 0; i < context.selections.size(); ++i) {
partially evaluated: i < context.selections.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
987 const QAbstractTextDocumentLayout::Selection &s = context.selections.at(i);
never executed (the execution status of this line is deduced): const QAbstractTextDocumentLayout::Selection &s = context.selections.at(i);
-
988 int row_start = -1, col_start = -1, num_rows = -1, num_cols = -1;
never executed (the execution status of this line is deduced): int row_start = -1, col_start = -1, num_rows = -1, num_cols = -1;
-
989 -
990 if (s.cursor.currentTable() == table)
never evaluated: s.cursor.currentTable() == table
0
991 s.cursor.selectedTableCells(&row_start, &num_rows, &col_start, &num_cols);
never executed: s.cursor.selectedTableCells(&row_start, &num_rows, &col_start, &num_cols);
0
992 -
993 selectedTableCells[i * 4] = row_start;
never executed (the execution status of this line is deduced): selectedTableCells[i * 4] = row_start;
-
994 selectedTableCells[i * 4 + 1] = col_start;
never executed (the execution status of this line is deduced): selectedTableCells[i * 4 + 1] = col_start;
-
995 selectedTableCells[i * 4 + 2] = num_rows;
never executed (the execution status of this line is deduced): selectedTableCells[i * 4 + 2] = num_rows;
-
996 selectedTableCells[i * 4 + 3] = num_cols;
never executed (the execution status of this line is deduced): selectedTableCells[i * 4 + 3] = num_cols;
-
997 }
never executed: }
0
998 -
999 QFixed pageHeight = QFixed::fromReal(document->pageSize().height());
executed (the execution status of this line is deduced): QFixed pageHeight = QFixed::fromReal(document->pageSize().height());
-
1000 if (pageHeight <= 0)
partially evaluated: pageHeight <= 0
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
1001 pageHeight = QFIXED_MAX;
executed: pageHeight = (2147483647/256);
Execution Count:9
9
1002 -
1003 const int tableStartPage = (td->position.y / pageHeight).truncate();
executed (the execution status of this line is deduced): const int tableStartPage = (td->position.y / pageHeight).truncate();
-
1004 const int tableEndPage = ((td->position.y + td->size.height) / pageHeight).truncate();
executed (the execution status of this line is deduced): const int tableEndPage = ((td->position.y + td->size.height) / pageHeight).truncate();
-
1005 -
1006 qreal border = td->border.toReal();
executed (the execution status of this line is deduced): qreal border = td->border.toReal();
-
1007 drawFrameDecoration(painter, frame, fd, context.clip, frameRect);
executed (the execution status of this line is deduced): drawFrameDecoration(painter, frame, fd, context.clip, frameRect);
-
1008 -
1009 // draw the table headers -
1010 const int headerRowCount = qMin(table->format().headerRowCount(), rows - 1);
executed (the execution status of this line is deduced): const int headerRowCount = qMin(table->format().headerRowCount(), rows - 1);
-
1011 int page = tableStartPage + 1;
executed (the execution status of this line is deduced): int page = tableStartPage + 1;
-
1012 while (page <= tableEndPage) {
partially evaluated: page <= tableEndPage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
1013 const QFixed pageTop = page * pageHeight + td->effectiveTopMargin + td->cellSpacing + td->border;
never executed (the execution status of this line is deduced): const QFixed pageTop = page * pageHeight + td->effectiveTopMargin + td->cellSpacing + td->border;
-
1014 const qreal headerOffset = (pageTop - td->rowPositions.at(0)).toReal();
never executed (the execution status of this line is deduced): const qreal headerOffset = (pageTop - td->rowPositions.at(0)).toReal();
-
1015 for (int r = 0; r < headerRowCount; ++r) {
never evaluated: r < headerRowCount
0
1016 for (int c = 0; c < columns; ++c) {
never evaluated: c < columns
0
1017 QTextTableCell cell = table->cellAt(r, c);
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(r, c);
-
1018 QAbstractTextDocumentLayout::PaintContext cell_context = context;
never executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::PaintContext cell_context = context;
-
1019 adjustContextSelectionsForCell(cell_context, cell, r, c, selectedTableCells.data());
never executed (the execution status of this line is deduced): adjustContextSelectionsForCell(cell_context, cell, r, c, selectedTableCells.data());
-
1020 QRectF cellRect = td->cellRect(cell);
never executed (the execution status of this line is deduced): QRectF cellRect = td->cellRect(cell);
-
1021 -
1022 cellRect.translate(off.x(), headerOffset);
never executed (the execution status of this line is deduced): cellRect.translate(off.x(), headerOffset);
-
1023 // we need to account for the cell border in the clipping test -
1024 int leftAdjust = qMin(qreal(0), 1 - border);
never executed (the execution status of this line is deduced): int leftAdjust = qMin(qreal(0), 1 - border);
-
1025 if (cell_context.clip.isValid() && !cellRect.adjusted(leftAdjust, leftAdjust, border, border).intersects(cell_context.clip))
never evaluated: cell_context.clip.isValid()
never evaluated: !cellRect.adjusted(leftAdjust, leftAdjust, border, border).intersects(cell_context.clip)
0
1026 continue;
never executed: continue;
0
1027 -
1028 drawTableCell(cellRect, painter, cell_context, table, td, r, c, &cursorBlockNeedingRepaint,
never executed (the execution status of this line is deduced): drawTableCell(cellRect, painter, cell_context, table, td, r, c, &cursorBlockNeedingRepaint,
-
1029 &offsetOfRepaintedCursorBlock);
never executed (the execution status of this line is deduced): &offsetOfRepaintedCursorBlock);
-
1030 }
never executed: }
0
1031 }
never executed: }
0
1032 ++page;
never executed (the execution status of this line is deduced): ++page;
-
1033 }
never executed: }
0
1034 -
1035 int firstRow = 0;
executed (the execution status of this line is deduced): int firstRow = 0;
-
1036 int lastRow = rows;
executed (the execution status of this line is deduced): int lastRow = rows;
-
1037 -
1038 if (context.clip.isValid()) {
partially evaluated: context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
1039 QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
executed (the execution status of this line is deduced): QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
-
1040 if (rowIt != td->rowPositions.constEnd() && rowIt != td->rowPositions.constBegin()) {
partially evaluated: rowIt != td->rowPositions.constEnd()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
partially evaluated: rowIt != td->rowPositions.constBegin()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
1041 --rowIt;
never executed (the execution status of this line is deduced): --rowIt;
-
1042 firstRow = rowIt - td->rowPositions.constBegin();
never executed (the execution status of this line is deduced): firstRow = rowIt - td->rowPositions.constBegin();
-
1043 }
never executed: }
0
1044 -
1045 rowIt = std::upper_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.bottom() - off.y()));
executed (the execution status of this line is deduced): rowIt = std::upper_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.bottom() - off.y()));
-
1046 if (rowIt != td->rowPositions.constEnd()) {
evaluated: rowIt != td->rowPositions.constEnd()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
1047 ++rowIt;
executed (the execution status of this line is deduced): ++rowIt;
-
1048 lastRow = rowIt - td->rowPositions.constBegin();
executed (the execution status of this line is deduced): lastRow = rowIt - td->rowPositions.constBegin();
-
1049 }
executed: }
Execution Count:4
4
1050 }
executed: }
Execution Count:9
9
1051 -
1052 for (int c = 0; c < columns; ++c) {
evaluated: c < columns
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:9
9-29
1053 QTextTableCell cell = table->cellAt(firstRow, c);
executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(firstRow, c);
-
1054 firstRow = qMin(firstRow, cell.row());
executed (the execution status of this line is deduced): firstRow = qMin(firstRow, cell.row());
-
1055 }
executed: }
Execution Count:29
29
1056 -
1057 for (int r = firstRow; r < lastRow; ++r) {
evaluated: r < lastRow
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:9
9-22
1058 for (int c = 0; c < columns; ++c) {
evaluated: c < columns
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:22
22-75
1059 QTextTableCell cell = table->cellAt(r, c);
executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(r, c);
-
1060 QAbstractTextDocumentLayout::PaintContext cell_context = context;
executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::PaintContext cell_context = context;
-
1061 adjustContextSelectionsForCell(cell_context, cell, r, c, selectedTableCells.data());
executed (the execution status of this line is deduced): adjustContextSelectionsForCell(cell_context, cell, r, c, selectedTableCells.data());
-
1062 QRectF cellRect = td->cellRect(cell);
executed (the execution status of this line is deduced): QRectF cellRect = td->cellRect(cell);
-
1063 -
1064 cellRect.translate(off);
executed (the execution status of this line is deduced): cellRect.translate(off);
-
1065 // we need to account for the cell border in the clipping test -
1066 int leftAdjust = qMin(qreal(0), 1 - border);
executed (the execution status of this line is deduced): int leftAdjust = qMin(qreal(0), 1 - border);
-
1067 if (cell_context.clip.isValid() && !cellRect.adjusted(leftAdjust, leftAdjust, border, border).intersects(cell_context.clip))
partially evaluated: cell_context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:75
no
Evaluation Count:0
evaluated: !cellRect.adjusted(leftAdjust, leftAdjust, border, border).intersects(cell_context.clip)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:51
0-75
1068 continue;
executed: continue;
Execution Count:24
24
1069 -
1070 drawTableCell(cellRect, painter, cell_context, table, td, r, c, &cursorBlockNeedingRepaint,
executed (the execution status of this line is deduced): drawTableCell(cellRect, painter, cell_context, table, td, r, c, &cursorBlockNeedingRepaint,
-
1071 &offsetOfRepaintedCursorBlock);
executed (the execution status of this line is deduced): &offsetOfRepaintedCursorBlock);
-
1072 }
executed: }
Execution Count:51
51
1073 }
executed: }
Execution Count:22
22
1074 -
1075 } else {
executed: }
Execution Count:9
9
1076 drawFrameDecoration(painter, frame, fd, context.clip, frameRect);
executed (the execution status of this line is deduced): drawFrameDecoration(painter, frame, fd, context.clip, frameRect);
-
1077 -
1078 QTextFrame::Iterator it = frame->begin();
executed (the execution status of this line is deduced): QTextFrame::Iterator it = frame->begin();
-
1079 -
1080 if (frame == docPrivate->rootFrame())
partially evaluated: frame == docPrivate->rootFrame()
TRUEFALSE
yes
Evaluation Count:298
no
Evaluation Count:0
0-298
1081 it = frameIteratorForYPosition(QFixed::fromReal(context.clip.top()));
executed: it = frameIteratorForYPosition(QFixed::fromReal(context.clip.top()));
Execution Count:298
298
1082 -
1083 QList<QTextFrame *> floats;
executed (the execution status of this line is deduced): QList<QTextFrame *> floats;
-
1084 for (int i = 0; i < fd->floats.count(); ++i)
evaluated: i < fd->floats.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:298
1-298
1085 floats.append(fd->floats.at(i));
executed: floats.append(fd->floats.at(i));
Execution Count:1
1
1086 -
1087 drawFlow(off, painter, context, it, floats, &cursorBlockNeedingRepaint);
executed (the execution status of this line is deduced): drawFlow(off, painter, context, it, floats, &cursorBlockNeedingRepaint);
-
1088 }
executed: }
Execution Count:298
298
1089 -
1090 if (cursorBlockNeedingRepaint.isValid()) {
evaluated: cursorBlockNeedingRepaint.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:303
4-303
1091 const QPen oldPen = painter->pen();
executed (the execution status of this line is deduced): const QPen oldPen = painter->pen();
-
1092 painter->setPen(context.palette.color(QPalette::Text));
executed (the execution status of this line is deduced): painter->setPen(context.palette.color(QPalette::Text));
-
1093 const int cursorPos = context.cursorPosition - cursorBlockNeedingRepaint.position();
executed (the execution status of this line is deduced): const int cursorPos = context.cursorPosition - cursorBlockNeedingRepaint.position();
-
1094 cursorBlockNeedingRepaint.layout()->drawCursor(painter, offsetOfRepaintedCursorBlock,
executed (the execution status of this line is deduced): cursorBlockNeedingRepaint.layout()->drawCursor(painter, offsetOfRepaintedCursorBlock,
-
1095 cursorPos, cursorWidth);
executed (the execution status of this line is deduced): cursorPos, cursorWidth);
-
1096 painter->setPen(oldPen);
executed (the execution status of this line is deduced): painter->setPen(oldPen);
-
1097 }
executed: }
Execution Count:4
4
1098 -
1099// DEC_INDENT; -
1100 -
1101 return;
executed: return;
Execution Count:307
307
1102} -
1103 -
1104void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &cell_context, -
1105 QTextTable *table, QTextTableData *td, int r, int c, -
1106 QTextBlock *cursorBlockNeedingRepaint, QPointF *cursorBlockOffset) const -
1107{ -
1108 QTextTableCell cell = table->cellAt(r, c);
executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(r, c);
-
1109 int rspan = cell.rowSpan();
executed (the execution status of this line is deduced): int rspan = cell.rowSpan();
-
1110 int cspan = cell.columnSpan();
executed (the execution status of this line is deduced): int cspan = cell.columnSpan();
-
1111 if (rspan != 1) {
partially evaluated: rspan != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51
0-51
1112 int cr = cell.row();
never executed (the execution status of this line is deduced): int cr = cell.row();
-
1113 if (cr != r)
never evaluated: cr != r
0
1114 return;
never executed: return;
0
1115 }
never executed: }
0
1116 if (cspan != 1) {
partially evaluated: cspan != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51
0-51
1117 int cc = cell.column();
never executed (the execution status of this line is deduced): int cc = cell.column();
-
1118 if (cc != c)
never evaluated: cc != c
0
1119 return;
never executed: return;
0
1120 }
never executed: }
0
1121 -
1122 QTextFormat fmt = cell.format();
executed (the execution status of this line is deduced): QTextFormat fmt = cell.format();
-
1123 const QFixed leftPadding = td->leftPadding(fmt);
executed (the execution status of this line is deduced): const QFixed leftPadding = td->leftPadding(fmt);
-
1124 const QFixed topPadding = td->topPadding(fmt);
executed (the execution status of this line is deduced): const QFixed topPadding = td->topPadding(fmt);
-
1125 -
1126 if (td->border != 0) {
evaluated: td->border != 0
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:1
1-50
1127 const QBrush oldBrush = painter->brush();
executed (the execution status of this line is deduced): const QBrush oldBrush = painter->brush();
-
1128 const QPen oldPen = painter->pen();
executed (the execution status of this line is deduced): const QPen oldPen = painter->pen();
-
1129 -
1130 const qreal border = td->border.toReal();
executed (the execution status of this line is deduced): const qreal border = td->border.toReal();
-
1131 -
1132 QRectF borderRect(cellRect.left() - border, cellRect.top() - border, cellRect.width() + border, cellRect.height() + border);
executed (the execution status of this line is deduced): QRectF borderRect(cellRect.left() - border, cellRect.top() - border, cellRect.width() + border, cellRect.height() + border);
-
1133 -
1134 // invert the border style for cells -
1135 QTextFrameFormat::BorderStyle cellBorder = table->format().borderStyle();
executed (the execution status of this line is deduced): QTextFrameFormat::BorderStyle cellBorder = table->format().borderStyle();
-
1136 switch (cellBorder) { -
1137 case QTextFrameFormat::BorderStyle_Inset: -
1138 cellBorder = QTextFrameFormat::BorderStyle_Outset;
never executed (the execution status of this line is deduced): cellBorder = QTextFrameFormat::BorderStyle_Outset;
-
1139 break;
never executed: break;
0
1140 case QTextFrameFormat::BorderStyle_Outset: -
1141 cellBorder = QTextFrameFormat::BorderStyle_Inset;
executed (the execution status of this line is deduced): cellBorder = QTextFrameFormat::BorderStyle_Inset;
-
1142 break;
executed: break;
Execution Count:50
50
1143 case QTextFrameFormat::BorderStyle_Groove: -
1144 cellBorder = QTextFrameFormat::BorderStyle_Ridge;
never executed (the execution status of this line is deduced): cellBorder = QTextFrameFormat::BorderStyle_Ridge;
-
1145 break;
never executed: break;
0
1146 case QTextFrameFormat::BorderStyle_Ridge: -
1147 cellBorder = QTextFrameFormat::BorderStyle_Groove;
never executed (the execution status of this line is deduced): cellBorder = QTextFrameFormat::BorderStyle_Groove;
-
1148 break;
never executed: break;
0
1149 default: -
1150 break;
never executed: break;
0
1151 } -
1152 -
1153 qreal topMargin = (td->effectiveTopMargin + td->cellSpacing + td->border).toReal();
executed (the execution status of this line is deduced): qreal topMargin = (td->effectiveTopMargin + td->cellSpacing + td->border).toReal();
-
1154 qreal bottomMargin = (td->effectiveBottomMargin + td->cellSpacing + td->border).toReal();
executed (the execution status of this line is deduced): qreal bottomMargin = (td->effectiveBottomMargin + td->cellSpacing + td->border).toReal();
-
1155 -
1156 const int headerRowCount = qMin(table->format().headerRowCount(), table->rows() - 1);
executed (the execution status of this line is deduced): const int headerRowCount = qMin(table->format().headerRowCount(), table->rows() - 1);
-
1157 if (r >= headerRowCount)
partially evaluated: r >= headerRowCount
TRUEFALSE
yes
Evaluation Count:50
no
Evaluation Count:0
0-50
1158 topMargin += td->headerHeight.toReal();
executed: topMargin += td->headerHeight.toReal();
Execution Count:50
50
1159 -
1160 drawBorder(painter, borderRect, topMargin, bottomMargin,
executed (the execution status of this line is deduced): drawBorder(painter, borderRect, topMargin, bottomMargin,
-
1161 border, table->format().borderBrush(), cellBorder);
executed (the execution status of this line is deduced): border, table->format().borderBrush(), cellBorder);
-
1162 -
1163 painter->setBrush(oldBrush);
executed (the execution status of this line is deduced): painter->setBrush(oldBrush);
-
1164 painter->setPen(oldPen);
executed (the execution status of this line is deduced): painter->setPen(oldPen);
-
1165 }
executed: }
Execution Count:50
50
1166 -
1167 const QBrush bg = cell.format().background();
executed (the execution status of this line is deduced): const QBrush bg = cell.format().background();
-
1168 const QPointF brushOrigin = painter->brushOrigin();
executed (the execution status of this line is deduced): const QPointF brushOrigin = painter->brushOrigin();
-
1169 if (bg.style() != Qt::NoBrush) {
partially evaluated: bg.style() != Qt::NoBrush
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51
0-51
1170 fillBackground(painter, cellRect, bg, cellRect.topLeft());
never executed (the execution status of this line is deduced): fillBackground(painter, cellRect, bg, cellRect.topLeft());
-
1171 -
1172 if (bg.style() > Qt::SolidPattern)
never evaluated: bg.style() > Qt::SolidPattern
0
1173 painter->setBrushOrigin(cellRect.topLeft());
never executed: painter->setBrushOrigin(cellRect.topLeft());
0
1174 }
never executed: }
0
1175 -
1176 const QFixed verticalOffset = td->cellVerticalOffsets.at(c + r * table->columns());
executed (the execution status of this line is deduced): const QFixed verticalOffset = td->cellVerticalOffsets.at(c + r * table->columns());
-
1177 -
1178 const QPointF cellPos = QPointF(cellRect.left() + leftPadding.toReal(),
executed (the execution status of this line is deduced): const QPointF cellPos = QPointF(cellRect.left() + leftPadding.toReal(),
-
1179 cellRect.top() + (topPadding + verticalOffset).toReal());
executed (the execution status of this line is deduced): cellRect.top() + (topPadding + verticalOffset).toReal());
-
1180 -
1181 QTextBlock repaintBlock;
executed (the execution status of this line is deduced): QTextBlock repaintBlock;
-
1182 drawFlow(cellPos, painter, cell_context, cell.begin(),
executed (the execution status of this line is deduced): drawFlow(cellPos, painter, cell_context, cell.begin(),
-
1183 td->childFrameMap.values(r + c * table->rows()),
executed (the execution status of this line is deduced): td->childFrameMap.values(r + c * table->rows()),
-
1184 &repaintBlock);
executed (the execution status of this line is deduced): &repaintBlock);
-
1185 if (repaintBlock.isValid()) {
partially evaluated: repaintBlock.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51
0-51
1186 *cursorBlockNeedingRepaint = repaintBlock;
never executed (the execution status of this line is deduced): *cursorBlockNeedingRepaint = repaintBlock;
-
1187 *cursorBlockOffset = cellPos;
never executed (the execution status of this line is deduced): *cursorBlockOffset = cellPos;
-
1188 }
never executed: }
0
1189 -
1190 if (bg.style() > Qt::SolidPattern)
partially evaluated: bg.style() > Qt::SolidPattern
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51
0-51
1191 painter->setBrushOrigin(brushOrigin);
never executed: painter->setBrushOrigin(brushOrigin);
0
1192}
executed: }
Execution Count:51
51
1193 -
1194void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, -
1195 QTextFrame::Iterator it, const QList<QTextFrame *> &floats, QTextBlock *cursorBlockNeedingRepaint) const -
1196{ -
1197 Q_Q(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayout * const q = q_func();
-
1198 const bool inRootFrame = (!it.atEnd() && it.parentFrame() && it.parentFrame()->parentFrame() == 0);
partially evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:349
no
Evaluation Count:0
partially evaluated: it.parentFrame()
TRUEFALSE
yes
Evaluation Count:349
no
Evaluation Count:0
evaluated: it.parentFrame()->parentFrame() == 0
TRUEFALSE
yes
Evaluation Count:298
yes
Evaluation Count:51
0-349
1199 -
1200 QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end();
executed (the execution status of this line is deduced): QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end();
-
1201 if (inRootFrame && context.clip.isValid()) {
evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:298
yes
Evaluation Count:51
evaluated: context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:273
yes
Evaluation Count:25
25-298
1202 lastVisibleCheckPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom()));
executed (the execution status of this line is deduced): lastVisibleCheckPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom()));
-
1203 }
executed: }
Execution Count:273
273
1204 -
1205 QTextBlock previousBlock;
executed (the execution status of this line is deduced): QTextBlock previousBlock;
-
1206 QTextFrame *previousFrame = 0;
executed (the execution status of this line is deduced): QTextFrame *previousFrame = 0;
-
1207 -
1208 for (; !it.atEnd(); ++it) {
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:405
yes
Evaluation Count:349
349-405
1209 QTextFrame *c = it.currentFrame();
executed (the execution status of this line is deduced): QTextFrame *c = it.currentFrame();
-
1210 -
1211 if (inRootFrame && !checkPoints.isEmpty()) {
evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:354
yes
Evaluation Count:51
partially evaluated: !checkPoints.isEmpty()
TRUEFALSE
yes
Evaluation Count:354
no
Evaluation Count:0
0-354
1212 int currentPosInDoc;
executed (the execution status of this line is deduced): int currentPosInDoc;
-
1213 if (c)
evaluated: c
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:345
9-345
1214 currentPosInDoc = c->firstPosition();
executed: currentPosInDoc = c->firstPosition();
Execution Count:9
9
1215 else -
1216 currentPosInDoc = it.currentBlock().position();
executed: currentPosInDoc = it.currentBlock().position();
Execution Count:345
345
1217 -
1218 // if we're past what is already laid out then we're better off -
1219 // not trying to draw things that may not be positioned correctly yet -
1220 if (currentPosInDoc >= checkPoints.last().positionInFrame)
partially evaluated: currentPosInDoc >= checkPoints.last().positionInFrame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:354
0-354
1221 break;
never executed: break;
0
1222 -
1223 if (lastVisibleCheckPoint != checkPoints.end()
evaluated: lastVisibleCheckPoint != checkPoints.end()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:290
64-290
1224 && context.clip.isValid()
partially evaluated: context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:64
no
Evaluation Count:0
0-64
1225 && currentPosInDoc >= lastVisibleCheckPoint->positionInFrame
partially evaluated: currentPosInDoc >= lastVisibleCheckPoint->positionInFrame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:64
0-64
1226 ) -
1227 break;
never executed: break;
0
1228 }
executed: }
Execution Count:354
354
1229 -
1230 if (c)
evaluated: c
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:396
9-396
1231 drawFrame(offset, painter, context, c);
executed: drawFrame(offset, painter, context, c);
Execution Count:9
9
1232 else { -
1233 QAbstractTextDocumentLayout::PaintContext pc = context;
executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::PaintContext pc = context;
-
1234 if (isEmptyBlockAfterTable(it.currentBlock(), previousFrame))
evaluated: isEmptyBlockAfterTable(it.currentBlock(), previousFrame)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:387
9-387
1235 pc.selections.clear();
executed: pc.selections.clear();
Execution Count:9
9
1236 drawBlock(offset, painter, pc, it.currentBlock(), inRootFrame);
executed (the execution status of this line is deduced): drawBlock(offset, painter, pc, it.currentBlock(), inRootFrame);
-
1237 }
executed: }
Execution Count:396
396
1238 -
1239 // when entering a table and the previous block is empty -
1240 // then layoutFlow 'hides' the block that just causes a -
1241 // new line by positioning it /on/ the table border. as we -
1242 // draw that block before the table itself the decoration -
1243 // 'overpaints' the cursor and we need to paint it afterwards -
1244 // again -
1245 if (isEmptyBlockBeforeTable(previousBlock, previousBlock.blockFormat(), it)
evaluated: isEmptyBlockBeforeTable(previousBlock, previousBlock.blockFormat(), it)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:396
9-396
1246 && previousBlock.contains(context.cursorPosition)
evaluated: previousBlock.contains(context.cursorPosition)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
1247 ) { -
1248 *cursorBlockNeedingRepaint = previousBlock;
executed (the execution status of this line is deduced): *cursorBlockNeedingRepaint = previousBlock;
-
1249 }
executed: }
Execution Count:4
4
1250 -
1251 previousBlock = it.currentBlock();
executed (the execution status of this line is deduced): previousBlock = it.currentBlock();
-
1252 previousFrame = c;
executed (the execution status of this line is deduced): previousFrame = c;
-
1253 }
executed: }
Execution Count:405
405
1254 -
1255 for (int i = 0; i < floats.count(); ++i) {
evaluated: i < floats.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:349
1-349
1256 QTextFrame *frame = floats.at(i);
executed (the execution status of this line is deduced): QTextFrame *frame = floats.at(i);
-
1257 if (!isFrameFromInlineObject(frame)
partially evaluated: !isFrameFromInlineObject(frame)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1258 || frame->frameFormat().position() == QTextFrameFormat::InFlow)
partially evaluated: frame->frameFormat().position() == QTextFrameFormat::InFlow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1259 continue;
never executed: continue;
0
1260 -
1261 const int pos = frame->firstPosition() - 1;
executed (the execution status of this line is deduced): const int pos = frame->firstPosition() - 1;
-
1262 QTextCharFormat format = const_cast<QTextDocumentLayout *>(q)->format(pos);
executed (the execution status of this line is deduced): QTextCharFormat format = const_cast<QTextDocumentLayout *>(q)->format(pos);
-
1263 QTextObjectInterface *handler = q->handlerForObject(format.objectType());
executed (the execution status of this line is deduced): QTextObjectInterface *handler = q->handlerForObject(format.objectType());
-
1264 if (handler) {
partially evaluated: handler
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1265 QRectF rect = frameBoundingRectInternal(frame);
executed (the execution status of this line is deduced): QRectF rect = frameBoundingRectInternal(frame);
-
1266 handler->drawObject(painter, rect, document, pos, format);
executed (the execution status of this line is deduced): handler->drawObject(painter, rect, document, pos, format);
-
1267 }
executed: }
Execution Count:1
1
1268 }
executed: }
Execution Count:1
1
1269}
executed: }
Execution Count:349
349
1270 -
1271void QTextDocumentLayoutPrivate::drawBlock(const QPointF &offset, QPainter *painter, -
1272 const QAbstractTextDocumentLayout::PaintContext &context, -
1273 QTextBlock bl, bool inRootFrame) const -
1274{ -
1275 const QTextLayout *tl = bl.layout();
executed (the execution status of this line is deduced): const QTextLayout *tl = bl.layout();
-
1276 QRectF r = tl->boundingRect();
executed (the execution status of this line is deduced): QRectF r = tl->boundingRect();
-
1277 r.translate(offset + tl->position());
executed (the execution status of this line is deduced): r.translate(offset + tl->position());
-
1278 if (context.clip.isValid() && (r.bottom() < context.clip.y() || r.top() > context.clip.bottom()))
evaluated: context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:57
evaluated: r.bottom() < context.clip.y()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:338
evaluated: r.top() > context.clip.bottom()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:332
1-339
1279 return;
executed: return;
Execution Count:7
7
1280// LDEBUG << debug_indent << "drawBlock" << bl.position() << "at" << offset << "br" << tl->boundingRect(); -
1281 -
1282 QTextBlockFormat blockFormat = bl.blockFormat();
executed (the execution status of this line is deduced): QTextBlockFormat blockFormat = bl.blockFormat();
-
1283 -
1284 QBrush bg = blockFormat.background();
executed (the execution status of this line is deduced): QBrush bg = blockFormat.background();
-
1285 if (bg != Qt::NoBrush) {
partially evaluated: bg != Qt::NoBrush
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:389
0-389
1286 QRectF rect = r;
never executed (the execution status of this line is deduced): QRectF rect = r;
-
1287 -
1288 // extend the background rectangle if we're in the root frame with NoWrap, -
1289 // as the rect of the text block will then be only the width of the text -
1290 // instead of the full page width -
1291 if (inRootFrame && document->pageSize().width() <= 0) {
never evaluated: inRootFrame
never evaluated: document->pageSize().width() <= 0
0
1292 const QTextFrameData *fd = data(document->rootFrame());
never executed (the execution status of this line is deduced): const QTextFrameData *fd = data(document->rootFrame());
-
1293 rect.setRight((fd->size.width - fd->rightMargin).toReal());
never executed (the execution status of this line is deduced): rect.setRight((fd->size.width - fd->rightMargin).toReal());
-
1294 }
never executed: }
0
1295 -
1296 fillBackground(painter, rect, bg, r.topLeft());
never executed (the execution status of this line is deduced): fillBackground(painter, rect, bg, r.topLeft());
-
1297 }
never executed: }
0
1298 -
1299 QVector<QTextLayout::FormatRange> selections;
executed (the execution status of this line is deduced): QVector<QTextLayout::FormatRange> selections;
-
1300 int blpos = bl.position();
executed (the execution status of this line is deduced): int blpos = bl.position();
-
1301 int bllen = bl.length();
executed (the execution status of this line is deduced): int bllen = bl.length();
-
1302 const QTextCharFormat *selFormat = 0;
executed (the execution status of this line is deduced): const QTextCharFormat *selFormat = 0;
-
1303 for (int i = 0; i < context.selections.size(); ++i) {
partially evaluated: i < context.selections.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:389
0-389
1304 const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i);
never executed (the execution status of this line is deduced): const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i);
-
1305 const int selStart = range.cursor.selectionStart() - blpos;
never executed (the execution status of this line is deduced): const int selStart = range.cursor.selectionStart() - blpos;
-
1306 const int selEnd = range.cursor.selectionEnd() - blpos;
never executed (the execution status of this line is deduced): const int selEnd = range.cursor.selectionEnd() - blpos;
-
1307 if (selStart < bllen && selEnd > 0
never evaluated: selStart < bllen
never evaluated: selEnd > 0
0
1308 && selEnd > selStart) {
never evaluated: selEnd > selStart
0
1309 QTextLayout::FormatRange o;
never executed (the execution status of this line is deduced): QTextLayout::FormatRange o;
-
1310 o.start = selStart;
never executed (the execution status of this line is deduced): o.start = selStart;
-
1311 o.length = selEnd - selStart;
never executed (the execution status of this line is deduced): o.length = selEnd - selStart;
-
1312 o.format = range.format;
never executed (the execution status of this line is deduced): o.format = range.format;
-
1313 selections.append(o);
never executed (the execution status of this line is deduced): selections.append(o);
-
1314 } else if (! range.cursor.hasSelection() && range.format.hasProperty(QTextFormat::FullWidthSelection)
never executed: }
never evaluated: ! range.cursor.hasSelection()
never evaluated: range.format.hasProperty(QTextFormat::FullWidthSelection)
0
1315 && bl.contains(range.cursor.position())) {
never evaluated: bl.contains(range.cursor.position())
0
1316 // for full width selections we don't require an actual selection, just -
1317 // a position to specify the line. that's more convenience in usage. -
1318 QTextLayout::FormatRange o;
never executed (the execution status of this line is deduced): QTextLayout::FormatRange o;
-
1319 QTextLine l = tl->lineForTextPosition(range.cursor.position() - blpos);
never executed (the execution status of this line is deduced): QTextLine l = tl->lineForTextPosition(range.cursor.position() - blpos);
-
1320 o.start = l.textStart();
never executed (the execution status of this line is deduced): o.start = l.textStart();
-
1321 o.length = l.textLength();
never executed (the execution status of this line is deduced): o.length = l.textLength();
-
1322 if (o.start + o.length == bllen - 1)
never evaluated: o.start + o.length == bllen - 1
0
1323 ++o.length; // include newline
never executed: ++o.length;
0
1324 o.format = range.format;
never executed (the execution status of this line is deduced): o.format = range.format;
-
1325 selections.append(o);
never executed (the execution status of this line is deduced): selections.append(o);
-
1326 }
never executed: }
0
1327 if (selStart < 0 && selEnd >= 1)
never evaluated: selStart < 0
never evaluated: selEnd >= 1
0
1328 selFormat = &range.format;
never executed: selFormat = &range.format;
0
1329 }
never executed: }
0
1330 -
1331 QTextObject *object = document->objectForFormat(bl.blockFormat());
executed (the execution status of this line is deduced): QTextObject *object = document->objectForFormat(bl.blockFormat());
-
1332 if (object && object->format().toListFormat().style() != QTextListFormat::ListStyleUndefined)
partially evaluated: object
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:389
never evaluated: object->format().toListFormat().style() != QTextListFormat::ListStyleUndefined
0-389
1333 drawListItem(offset, painter, context, bl, selFormat);
never executed: drawListItem(offset, painter, context, bl, selFormat);
0
1334 -
1335 QPen oldPen = painter->pen();
executed (the execution status of this line is deduced): QPen oldPen = painter->pen();
-
1336 painter->setPen(context.palette.color(QPalette::Text));
executed (the execution status of this line is deduced): painter->setPen(context.palette.color(QPalette::Text));
-
1337 -
1338 tl->draw(painter, offset, selections, context.clip.isValid() ? (context.clip & clipRect) : clipRect);
executed (the execution status of this line is deduced): tl->draw(painter, offset, selections, context.clip.isValid() ? (context.clip & clipRect) : clipRect);
-
1339 -
1340 if ((context.cursorPosition >= blpos && context.cursorPosition < blpos + bllen)
evaluated: context.cursorPosition >= blpos
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:355
partially evaluated: context.cursorPosition < blpos + bllen
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-355
1341 || (context.cursorPosition < -1 && !tl->preeditAreaText().isEmpty())) {
partially evaluated: context.cursorPosition < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:355
never evaluated: !tl->preeditAreaText().isEmpty()
0-355
1342 int cpos = context.cursorPosition;
executed (the execution status of this line is deduced): int cpos = context.cursorPosition;
-
1343 if (cpos < -1)
partially evaluated: cpos < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
0-34
1344 cpos = tl->preeditAreaPosition() - (cpos + 2);
never executed: cpos = tl->preeditAreaPosition() - (cpos + 2);
0
1345 else -
1346 cpos -= blpos;
executed: cpos -= blpos;
Execution Count:34
34
1347 tl->drawCursor(painter, offset, cpos, cursorWidth);
executed (the execution status of this line is deduced): tl->drawCursor(painter, offset, cpos, cursorWidth);
-
1348 }
executed: }
Execution Count:34
34
1349 -
1350 if (blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) {
partially evaluated: blockFormat.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:389
0-389
1351 const qreal width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth).value(r.width());
never executed (the execution status of this line is deduced): const qreal width = blockFormat.lengthProperty(QTextFormat::BlockTrailingHorizontalRulerWidth).value(r.width());
-
1352 painter->setPen(context.palette.color(QPalette::Dark));
never executed (the execution status of this line is deduced): painter->setPen(context.palette.color(QPalette::Dark));
-
1353 qreal y = r.bottom();
never executed (the execution status of this line is deduced): qreal y = r.bottom();
-
1354 if (bl.length() == 1)
never evaluated: bl.length() == 1
0
1355 y = r.top() + r.height() / 2;
never executed: y = r.top() + r.height() / 2;
0
1356 -
1357 const qreal middleX = r.left() + r.width() / 2;
never executed (the execution status of this line is deduced): const qreal middleX = r.left() + r.width() / 2;
-
1358 painter->drawLine(QLineF(middleX - width / 2, y, middleX + width / 2, y));
never executed (the execution status of this line is deduced): painter->drawLine(QLineF(middleX - width / 2, y, middleX + width / 2, y));
-
1359 }
never executed: }
0
1360 -
1361 painter->setPen(oldPen);
executed (the execution status of this line is deduced): painter->setPen(oldPen);
-
1362}
executed: }
Execution Count:389
389
1363 -
1364 -
1365void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *painter, -
1366 const QAbstractTextDocumentLayout::PaintContext &context, -
1367 QTextBlock bl, const QTextCharFormat *selectionFormat) const -
1368{ -
1369 Q_Q(const QTextDocumentLayout);
never executed (the execution status of this line is deduced): const QTextDocumentLayout * const q = q_func();
-
1370 const QTextBlockFormat blockFormat = bl.blockFormat();
never executed (the execution status of this line is deduced): const QTextBlockFormat blockFormat = bl.blockFormat();
-
1371 const QTextCharFormat charFormat = QTextCursor(bl).charFormat();
never executed (the execution status of this line is deduced): const QTextCharFormat charFormat = QTextCursor(bl).charFormat();
-
1372 QFont font(charFormat.font());
never executed (the execution status of this line is deduced): QFont font(charFormat.font());
-
1373 if (q->paintDevice())
never evaluated: q->paintDevice()
0
1374 font = QFont(font, q->paintDevice());
never executed: font = QFont(font, q->paintDevice());
0
1375 -
1376 const QFontMetrics fontMetrics(font);
never executed (the execution status of this line is deduced): const QFontMetrics fontMetrics(font);
-
1377 QTextObject * const object = document->objectForFormat(blockFormat);
never executed (the execution status of this line is deduced): QTextObject * const object = document->objectForFormat(blockFormat);
-
1378 const QTextListFormat lf = object->format().toListFormat();
never executed (the execution status of this line is deduced): const QTextListFormat lf = object->format().toListFormat();
-
1379 int style = lf.style();
never executed (the execution status of this line is deduced): int style = lf.style();
-
1380 QString itemText;
never executed (the execution status of this line is deduced): QString itemText;
-
1381 QSizeF size;
never executed (the execution status of this line is deduced): QSizeF size;
-
1382 -
1383 if (blockFormat.hasProperty(QTextFormat::ListStyle))
never evaluated: blockFormat.hasProperty(QTextFormat::ListStyle)
0
1384 style = QTextListFormat::Style(blockFormat.intProperty(QTextFormat::ListStyle));
never executed: style = QTextListFormat::Style(blockFormat.intProperty(QTextFormat::ListStyle));
0
1385 -
1386 QTextLayout *layout = bl.layout();
never executed (the execution status of this line is deduced): QTextLayout *layout = bl.layout();
-
1387 if (layout->lineCount() == 0)
never evaluated: layout->lineCount() == 0
0
1388 return;
never executed: return;
0
1389 QTextLine firstLine = layout->lineAt(0);
never executed (the execution status of this line is deduced): QTextLine firstLine = layout->lineAt(0);
-
1390 Q_ASSERT(firstLine.isValid());
never executed (the execution status of this line is deduced): qt_noop();
-
1391 QPointF pos = (offset + layout->position()).toPoint();
never executed (the execution status of this line is deduced): QPointF pos = (offset + layout->position()).toPoint();
-
1392 Qt::LayoutDirection dir = bl.textDirection();
never executed (the execution status of this line is deduced): Qt::LayoutDirection dir = bl.textDirection();
-
1393 { -
1394 QRectF textRect = firstLine.naturalTextRect();
never executed (the execution status of this line is deduced): QRectF textRect = firstLine.naturalTextRect();
-
1395 pos += textRect.topLeft().toPoint();
never executed (the execution status of this line is deduced): pos += textRect.topLeft().toPoint();
-
1396 if (dir == Qt::RightToLeft)
never evaluated: dir == Qt::RightToLeft
0
1397 pos.rx() += textRect.width();
never executed: pos.rx() += textRect.width();
0
1398 } -
1399 -
1400 switch (style) { -
1401 case QTextListFormat::ListDecimal: -
1402 case QTextListFormat::ListLowerAlpha: -
1403 case QTextListFormat::ListUpperAlpha: -
1404 case QTextListFormat::ListLowerRoman: -
1405 case QTextListFormat::ListUpperRoman: -
1406 itemText = static_cast<QTextList *>(object)->itemText(bl);
never executed (the execution status of this line is deduced): itemText = static_cast<QTextList *>(object)->itemText(bl);
-
1407 size.setWidth(fontMetrics.width(itemText));
never executed (the execution status of this line is deduced): size.setWidth(fontMetrics.width(itemText));
-
1408 size.setHeight(fontMetrics.height());
never executed (the execution status of this line is deduced): size.setHeight(fontMetrics.height());
-
1409 break;
never executed: break;
0
1410 -
1411 case QTextListFormat::ListSquare: -
1412 case QTextListFormat::ListCircle: -
1413 case QTextListFormat::ListDisc: -
1414 size.setWidth(fontMetrics.lineSpacing() / 3);
never executed (the execution status of this line is deduced): size.setWidth(fontMetrics.lineSpacing() / 3);
-
1415 size.setHeight(size.width());
never executed (the execution status of this line is deduced): size.setHeight(size.width());
-
1416 break;
never executed: break;
0
1417 -
1418 case QTextListFormat::ListStyleUndefined: -
1419 return;
never executed: return;
0
1420 default: return;
never executed: return;
0
1421 } -
1422 -
1423 QRectF r(pos, size);
never executed (the execution status of this line is deduced): QRectF r(pos, size);
-
1424 -
1425 qreal xoff = fontMetrics.width(QLatin1Char(' '));
never executed (the execution status of this line is deduced): qreal xoff = fontMetrics.width(QLatin1Char(' '));
-
1426 if (dir == Qt::LeftToRight)
never evaluated: dir == Qt::LeftToRight
0
1427 xoff = -xoff - size.width();
never executed: xoff = -xoff - size.width();
0
1428 r.translate( xoff, (fontMetrics.height() / 2 - size.height() / 2));
never executed (the execution status of this line is deduced): r.translate( xoff, (fontMetrics.height() / 2 - size.height() / 2));
-
1429 -
1430 painter->save();
never executed (the execution status of this line is deduced): painter->save();
-
1431 -
1432 painter->setRenderHint(QPainter::Antialiasing);
never executed (the execution status of this line is deduced): painter->setRenderHint(QPainter::Antialiasing);
-
1433 -
1434 if (selectionFormat) {
never evaluated: selectionFormat
0
1435 painter->setPen(QPen(selectionFormat->foreground(), 0));
never executed (the execution status of this line is deduced): painter->setPen(QPen(selectionFormat->foreground(), 0));
-
1436 painter->fillRect(r, selectionFormat->background());
never executed (the execution status of this line is deduced): painter->fillRect(r, selectionFormat->background());
-
1437 } else {
never executed: }
0
1438 QBrush fg = charFormat.foreground();
never executed (the execution status of this line is deduced): QBrush fg = charFormat.foreground();
-
1439 if (fg == Qt::NoBrush)
never evaluated: fg == Qt::NoBrush
0
1440 fg = context.palette.text();
never executed: fg = context.palette.text();
0
1441 painter->setPen(QPen(fg, 0));
never executed (the execution status of this line is deduced): painter->setPen(QPen(fg, 0));
-
1442 }
never executed: }
0
1443 -
1444 QBrush brush = context.palette.brush(QPalette::Text);
never executed (the execution status of this line is deduced): QBrush brush = context.palette.brush(QPalette::Text);
-
1445 -
1446 switch (style) { -
1447 case QTextListFormat::ListDecimal: -
1448 case QTextListFormat::ListLowerAlpha: -
1449 case QTextListFormat::ListUpperAlpha: -
1450 case QTextListFormat::ListLowerRoman: -
1451 case QTextListFormat::ListUpperRoman: { -
1452 QTextLayout layout(itemText, font, q->paintDevice());
never executed (the execution status of this line is deduced): QTextLayout layout(itemText, font, q->paintDevice());
-
1453 layout.setCacheEnabled(true);
never executed (the execution status of this line is deduced): layout.setCacheEnabled(true);
-
1454 QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute);
never executed (the execution status of this line is deduced): QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute);
-
1455 option.setTextDirection(dir);
never executed (the execution status of this line is deduced): option.setTextDirection(dir);
-
1456 layout.setTextOption(option);
never executed (the execution status of this line is deduced): layout.setTextOption(option);
-
1457 layout.beginLayout();
never executed (the execution status of this line is deduced): layout.beginLayout();
-
1458 QTextLine line = layout.createLine();
never executed (the execution status of this line is deduced): QTextLine line = layout.createLine();
-
1459 if (line.isValid())
never evaluated: line.isValid()
0
1460 line.setLeadingIncluded(true);
never executed: line.setLeadingIncluded(true);
0
1461 layout.endLayout();
never executed (the execution status of this line is deduced): layout.endLayout();
-
1462 layout.draw(painter, QPointF(r.left(), pos.y()));
never executed (the execution status of this line is deduced): layout.draw(painter, QPointF(r.left(), pos.y()));
-
1463 break;
never executed: break;
0
1464 } -
1465 case QTextListFormat::ListSquare: -
1466 painter->fillRect(r, brush);
never executed (the execution status of this line is deduced): painter->fillRect(r, brush);
-
1467 break;
never executed: break;
0
1468 case QTextListFormat::ListCircle: -
1469 painter->setPen(QPen(brush, 0));
never executed (the execution status of this line is deduced): painter->setPen(QPen(brush, 0));
-
1470 painter->drawEllipse(r.translated(0.5, 0.5)); // pixel align for sharper rendering
never executed (the execution status of this line is deduced): painter->drawEllipse(r.translated(0.5, 0.5));
-
1471 break;
never executed: break;
0
1472 case QTextListFormat::ListDisc: -
1473 painter->setBrush(brush);
never executed (the execution status of this line is deduced): painter->setBrush(brush);
-
1474 painter->setPen(Qt::NoPen);
never executed (the execution status of this line is deduced): painter->setPen(Qt::NoPen);
-
1475 painter->drawEllipse(r);
never executed (the execution status of this line is deduced): painter->drawEllipse(r);
-
1476 break;
never executed: break;
0
1477 case QTextListFormat::ListStyleUndefined: -
1478 break;
never executed: break;
0
1479 default: -
1480 break;
never executed: break;
0
1481 } -
1482 -
1483 painter->restore();
never executed (the execution status of this line is deduced): painter->restore();
-
1484}
never executed: }
0
1485 -
1486static QFixed flowPosition(const QTextFrame::iterator it) -
1487{ -
1488 if (it.atEnd())
partially evaluated: it.atEnd()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:357
0-357
1489 return 0;
never executed: return 0;
0
1490 -
1491 if (it.currentFrame()) {
partially evaluated: it.currentFrame()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:357
0-357
1492 return data(it.currentFrame())->position.y;
never executed: return data(it.currentFrame())->position.y;
0
1493 } else { -
1494 QTextBlock block = it.currentBlock();
executed (the execution status of this line is deduced): QTextBlock block = it.currentBlock();
-
1495 QTextLayout *layout = block.layout();
executed (the execution status of this line is deduced): QTextLayout *layout = block.layout();
-
1496 if (layout->lineCount() == 0)
partially evaluated: layout->lineCount() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:357
0-357
1497 return QFixed::fromReal(layout->position().y());
never executed: return QFixed::fromReal(layout->position().y());
0
1498 else -
1499 return QFixed::fromReal(layout->position().y() + layout->lineAt(0).y());
executed: return QFixed::fromReal(layout->position().y() + layout->lineAt(0).y());
Execution Count:357
357
1500 } -
1501} -
1502 -
1503static QFixed firstChildPos(const QTextFrame *f) -
1504{ -
1505 return flowPosition(f->begin());
never executed: return flowPosition(f->begin());
0
1506} -
1507 -
1508QTextLayoutStruct QTextDocumentLayoutPrivate::layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width, -
1509 int layoutFrom, int layoutTo, QTextTableData *td, -
1510 QFixed absoluteTableY, bool withPageBreaks) -
1511{ -
1512 LDEBUG << "layoutCell";
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 1512, __PRETTY_FUNCTION__).debug() << "layoutCell";
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:830
0-830
1513 QTextLayoutStruct layoutStruct;
executed (the execution status of this line is deduced): QTextLayoutStruct layoutStruct;
-
1514 layoutStruct.frame = t;
executed (the execution status of this line is deduced): layoutStruct.frame = t;
-
1515 layoutStruct.minimumWidth = 0;
executed (the execution status of this line is deduced): layoutStruct.minimumWidth = 0;
-
1516 layoutStruct.maximumWidth = QFIXED_MAX;
executed (the execution status of this line is deduced): layoutStruct.maximumWidth = (2147483647/256);
-
1517 layoutStruct.y = 0;
executed (the execution status of this line is deduced): layoutStruct.y = 0;
-
1518 -
1519 const QTextFormat fmt = cell.format();
executed (the execution status of this line is deduced): const QTextFormat fmt = cell.format();
-
1520 const QFixed topPadding = td->topPadding(fmt);
executed (the execution status of this line is deduced): const QFixed topPadding = td->topPadding(fmt);
-
1521 if (withPageBreaks) {
evaluated: withPageBreaks
TRUEFALSE
yes
Evaluation Count:357
yes
Evaluation Count:473
357-473
1522 layoutStruct.frameY = absoluteTableY + td->rowPositions.at(cell.row()) + topPadding;
executed (the execution status of this line is deduced): layoutStruct.frameY = absoluteTableY + td->rowPositions.at(cell.row()) + topPadding;
-
1523 }
executed: }
Execution Count:357
357
1524 layoutStruct.x_left = 0;
executed (the execution status of this line is deduced): layoutStruct.x_left = 0;
-
1525 layoutStruct.x_right = width;
executed (the execution status of this line is deduced): layoutStruct.x_right = width;
-
1526 // we get called with different widths all the time (for example for figuring -
1527 // out the min/max widths), so we always have to do the full layout ;( -
1528 // also when for example in a table layoutFrom/layoutTo affect only one cell, -
1529 // making that one cell grow the available width of the other cells may change -
1530 // (shrink) and therefore when layoutCell gets called for them they have to -
1531 // be re-laid out, even if layoutFrom/layoutTo is not in their range. Hence -
1532 // this line: -
1533 -
1534 layoutStruct.pageHeight = QFixed::fromReal(document->pageSize().height());
executed (the execution status of this line is deduced): layoutStruct.pageHeight = QFixed::fromReal(document->pageSize().height());
-
1535 if (layoutStruct.pageHeight < 0 || !withPageBreaks)
evaluated: layoutStruct.pageHeight < 0
TRUEFALSE
yes
Evaluation Count:620
yes
Evaluation Count:210
evaluated: !withPageBreaks
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:106
104-620
1536 layoutStruct.pageHeight = QFIXED_MAX;
executed: layoutStruct.pageHeight = (2147483647/256);
Execution Count:724
724
1537 const int currentPage = layoutStruct.currentPage();
executed (the execution status of this line is deduced): const int currentPage = layoutStruct.currentPage();
-
1538 layoutStruct.pageTopMargin = td->effectiveTopMargin + td->cellSpacing + td->border + topPadding;
executed (the execution status of this line is deduced): layoutStruct.pageTopMargin = td->effectiveTopMargin + td->cellSpacing + td->border + topPadding;
-
1539 layoutStruct.pageBottomMargin = td->effectiveBottomMargin + td->cellSpacing + td->border + td->bottomPadding(fmt);
executed (the execution status of this line is deduced): layoutStruct.pageBottomMargin = td->effectiveBottomMargin + td->cellSpacing + td->border + td->bottomPadding(fmt);
-
1540 layoutStruct.pageBottom = (currentPage + 1) * layoutStruct.pageHeight - layoutStruct.pageBottomMargin;
executed (the execution status of this line is deduced): layoutStruct.pageBottom = (currentPage + 1) * layoutStruct.pageHeight - layoutStruct.pageBottomMargin;
-
1541 -
1542 layoutStruct.fullLayout = true;
executed (the execution status of this line is deduced): layoutStruct.fullLayout = true;
-
1543 -
1544 QFixed pageTop = currentPage * layoutStruct.pageHeight + layoutStruct.pageTopMargin - layoutStruct.frameY;
executed (the execution status of this line is deduced): QFixed pageTop = currentPage * layoutStruct.pageHeight + layoutStruct.pageTopMargin - layoutStruct.frameY;
-
1545 layoutStruct.y = qMax(layoutStruct.y, pageTop);
executed (the execution status of this line is deduced): layoutStruct.y = qMax(layoutStruct.y, pageTop);
-
1546 -
1547 const QList<QTextFrame *> childFrames = td->childFrameMap.values(cell.row() + cell.column() * t->rows());
executed (the execution status of this line is deduced): const QList<QTextFrame *> childFrames = td->childFrameMap.values(cell.row() + cell.column() * t->rows());
-
1548 for (int i = 0; i < childFrames.size(); ++i) {
partially evaluated: i < childFrames.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:830
0-830
1549 QTextFrame *frame = childFrames.at(i);
never executed (the execution status of this line is deduced): QTextFrame *frame = childFrames.at(i);
-
1550 QTextFrameData *cd = data(frame);
never executed (the execution status of this line is deduced): QTextFrameData *cd = data(frame);
-
1551 cd->sizeDirty = true;
never executed (the execution status of this line is deduced): cd->sizeDirty = true;
-
1552 }
never executed: }
0
1553 -
1554 layoutFlow(cell.begin(), &layoutStruct, layoutFrom, layoutTo, width);
executed (the execution status of this line is deduced): layoutFlow(cell.begin(), &layoutStruct, layoutFrom, layoutTo, width);
-
1555 -
1556 QFixed floatMinWidth;
executed (the execution status of this line is deduced): QFixed floatMinWidth;
-
1557 -
1558 // floats that are located inside the text (like inline images) aren't taken into account by -
1559 // layoutFlow with regards to the cell height (layoutStruct->y), so for a safety measure we -
1560 // do that here. For example with <td><img align="right" src="..." />blah</td> -
1561 // when the image happens to be higher than the text -
1562 for (int i = 0; i < childFrames.size(); ++i) {
partially evaluated: i < childFrames.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:830
0-830
1563 QTextFrame *frame = childFrames.at(i);
never executed (the execution status of this line is deduced): QTextFrame *frame = childFrames.at(i);
-
1564 QTextFrameData *cd = data(frame);
never executed (the execution status of this line is deduced): QTextFrameData *cd = data(frame);
-
1565 -
1566 if (frame->frameFormat().position() != QTextFrameFormat::InFlow)
never evaluated: frame->frameFormat().position() != QTextFrameFormat::InFlow
0
1567 layoutStruct.y = qMax(layoutStruct.y, cd->position.y + cd->size.height);
never executed: layoutStruct.y = qMax(layoutStruct.y, cd->position.y + cd->size.height);
0
1568 -
1569 floatMinWidth = qMax(floatMinWidth, cd->minimumWidth);
never executed (the execution status of this line is deduced): floatMinWidth = qMax(floatMinWidth, cd->minimumWidth);
-
1570 }
never executed: }
0
1571 -
1572 // constraint the maximumWidth by the minimum width of the fixed size floats, to -
1573 // keep them visible -
1574 layoutStruct.maximumWidth = qMax(layoutStruct.maximumWidth, floatMinWidth);
executed (the execution status of this line is deduced): layoutStruct.maximumWidth = qMax(layoutStruct.maximumWidth, floatMinWidth);
-
1575 -
1576 // as floats in cells get added to the table's float list but must not affect -
1577 // floats in other cells we must clear the list here. -
1578 data(t)->floats.clear();
executed (the execution status of this line is deduced): data(t)->floats.clear();
-
1579 -
1580// qDebug() << "layoutCell done"; -
1581 -
1582 return layoutStruct;
executed: return layoutStruct;
Execution Count:830
830
1583} -
1584 -
1585QRectF QTextDocumentLayoutPrivate::layoutTable(QTextTable *table, int layoutFrom, int layoutTo, QFixed parentY) -
1586{ -
1587 LDEBUG << "layoutTable";
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 1587, __PRETTY_FUNCTION__).debug() << "layoutTable";
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
1588 QTextTableData *td = static_cast<QTextTableData *>(data(table));
executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(table));
-
1589 Q_ASSERT(td->sizeDirty);
executed (the execution status of this line is deduced): qt_noop();
-
1590 const int rows = table->rows();
executed (the execution status of this line is deduced): const int rows = table->rows();
-
1591 const int columns = table->columns();
executed (the execution status of this line is deduced): const int columns = table->columns();
-
1592 -
1593 const QTextTableFormat fmt = table->format();
executed (the execution status of this line is deduced): const QTextTableFormat fmt = table->format();
-
1594 -
1595 td->childFrameMap.clear();
executed (the execution status of this line is deduced): td->childFrameMap.clear();
-
1596 { -
1597 const QList<QTextFrame *> children = table->childFrames();
executed (the execution status of this line is deduced): const QList<QTextFrame *> children = table->childFrames();
-
1598 for (int i = 0; i < children.count(); ++i) {
partially evaluated: i < children.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
1599 QTextFrame *frame = children.at(i);
never executed (the execution status of this line is deduced): QTextFrame *frame = children.at(i);
-
1600 QTextTableCell cell = table->cellAt(frame->firstPosition());
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(frame->firstPosition());
-
1601 td->childFrameMap.insertMulti(cell.row() + cell.column() * rows, frame);
never executed (the execution status of this line is deduced): td->childFrameMap.insertMulti(cell.row() + cell.column() * rows, frame);
-
1602 }
never executed: }
0
1603 } -
1604 -
1605 QVector<QTextLength> columnWidthConstraints = fmt.columnWidthConstraints();
executed (the execution status of this line is deduced): QVector<QTextLength> columnWidthConstraints = fmt.columnWidthConstraints();
-
1606 if (columnWidthConstraints.size() != columns)
evaluated: columnWidthConstraints.size() != columns
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:6
6-23
1607 columnWidthConstraints.resize(columns);
executed: columnWidthConstraints.resize(columns);
Execution Count:23
23
1608 Q_ASSERT(columnWidthConstraints.count() == columns);
executed (the execution status of this line is deduced): qt_noop();
-
1609 -
1610 const QFixed cellSpacing = td->cellSpacing = QFixed::fromReal(scaleToDevice(fmt.cellSpacing()));
executed (the execution status of this line is deduced): const QFixed cellSpacing = td->cellSpacing = QFixed::fromReal(scaleToDevice(fmt.cellSpacing()));
-
1611 td->deviceScale = scaleToDevice(qreal(1));
executed (the execution status of this line is deduced): td->deviceScale = scaleToDevice(qreal(1));
-
1612 td->cellPadding = QFixed::fromReal(scaleToDevice(fmt.cellPadding()));
executed (the execution status of this line is deduced): td->cellPadding = QFixed::fromReal(scaleToDevice(fmt.cellPadding()));
-
1613 const QFixed leftMargin = td->leftMargin + td->border + td->padding;
executed (the execution status of this line is deduced): const QFixed leftMargin = td->leftMargin + td->border + td->padding;
-
1614 const QFixed rightMargin = td->rightMargin + td->border + td->padding;
executed (the execution status of this line is deduced): const QFixed rightMargin = td->rightMargin + td->border + td->padding;
-
1615 const QFixed topMargin = td->topMargin + td->border + td->padding;
executed (the execution status of this line is deduced): const QFixed topMargin = td->topMargin + td->border + td->padding;
-
1616 -
1617 const QFixed absoluteTableY = parentY + td->position.y;
executed (the execution status of this line is deduced): const QFixed absoluteTableY = parentY + td->position.y;
-
1618 -
1619 const QTextOption::WrapMode oldDefaultWrapMode = docPrivate->defaultTextOption.wrapMode();
executed (the execution status of this line is deduced): const QTextOption::WrapMode oldDefaultWrapMode = docPrivate->defaultTextOption.wrapMode();
-
1620 -
1621recalc_minmax_widths:
code before this statement executed: recalc_minmax_widths:
Execution Count:29
29
1622 -
1623 QFixed remainingWidth = td->contentsWidth;
executed (the execution status of this line is deduced): QFixed remainingWidth = td->contentsWidth;
-
1624 // two (vertical) borders per cell per column -
1625 remainingWidth -= columns * 2 * td->border;
executed (the execution status of this line is deduced): remainingWidth -= columns * 2 * td->border;
-
1626 // inter-cell spacing -
1627 remainingWidth -= (columns - 1) * cellSpacing;
executed (the execution status of this line is deduced): remainingWidth -= (columns - 1) * cellSpacing;
-
1628 // cell spacing at the left and right hand side -
1629 remainingWidth -= 2 * cellSpacing;
executed (the execution status of this line is deduced): remainingWidth -= 2 * cellSpacing;
-
1630 // remember the width used to distribute to percentaged columns -
1631 const QFixed initialTotalWidth = remainingWidth;
executed (the execution status of this line is deduced): const QFixed initialTotalWidth = remainingWidth;
-
1632 -
1633 td->widths.resize(columns);
executed (the execution status of this line is deduced): td->widths.resize(columns);
-
1634 td->widths.fill(0);
executed (the execution status of this line is deduced): td->widths.fill(0);
-
1635 -
1636 td->minWidths.resize(columns);
executed (the execution status of this line is deduced): td->minWidths.resize(columns);
-
1637 // start with a minimum width of 0. totally empty -
1638 // cells of default created tables are invisible otherwise -
1639 // and therefore hardly editable -
1640 td->minWidths.fill(1);
executed (the execution status of this line is deduced): td->minWidths.fill(1);
-
1641 -
1642 td->maxWidths.resize(columns);
executed (the execution status of this line is deduced): td->maxWidths.resize(columns);
-
1643 td->maxWidths.fill(QFIXED_MAX);
executed (the execution status of this line is deduced): td->maxWidths.fill((2147483647/256));
-
1644 -
1645 // calculate minimum and maximum sizes of the columns -
1646 for (int i = 0; i < columns; ++i) {
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:38
38-109
1647 for (int row = 0; row < rows; ++row) {
evaluated: row < rows
TRUEFALSE
yes
Evaluation Count:511
yes
Evaluation Count:109
109-511
1648 const QTextTableCell cell = table->cellAt(row, i);
executed (the execution status of this line is deduced): const QTextTableCell cell = table->cellAt(row, i);
-
1649 const int cspan = cell.columnSpan();
executed (the execution status of this line is deduced): const int cspan = cell.columnSpan();
-
1650 -
1651 if (cspan > 1 && i != cell.column())
evaluated: cspan > 1
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:445
evaluated: i != cell.column()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:28
28-445
1652 continue;
executed: continue;
Execution Count:38
38
1653 -
1654 const QTextFormat fmt = cell.format();
executed (the execution status of this line is deduced): const QTextFormat fmt = cell.format();
-
1655 const QFixed leftPadding = td->leftPadding(fmt);
executed (the execution status of this line is deduced): const QFixed leftPadding = td->leftPadding(fmt);
-
1656 const QFixed rightPadding = td->rightPadding(fmt);
executed (the execution status of this line is deduced): const QFixed rightPadding = td->rightPadding(fmt);
-
1657 const QFixed widthPadding = leftPadding + rightPadding;
executed (the execution status of this line is deduced): const QFixed widthPadding = leftPadding + rightPadding;
-
1658 -
1659 // to figure out the min and the max width lay out the cell at -
1660 // maximum width. otherwise the maxwidth calculation sometimes -
1661 // returns wrong values -
1662 QTextLayoutStruct layoutStruct = layoutCell(table, cell, QFIXED_MAX, layoutFrom,
executed (the execution status of this line is deduced): QTextLayoutStruct layoutStruct = layoutCell(table, cell, (2147483647/256), layoutFrom,
-
1663 layoutTo, td, absoluteTableY,
executed (the execution status of this line is deduced): layoutTo, td, absoluteTableY,
-
1664 /*withPageBreaks =*/false);
executed (the execution status of this line is deduced): false);
-
1665 -
1666 // distribute the minimum width over all columns the cell spans -
1667 QFixed widthToDistribute = layoutStruct.minimumWidth + widthPadding;
executed (the execution status of this line is deduced): QFixed widthToDistribute = layoutStruct.minimumWidth + widthPadding;
-
1668 for (int n = 0; n < cspan; ++n) {
partially evaluated: n < cspan
TRUEFALSE
yes
Evaluation Count:479
no
Evaluation Count:0
0-479
1669 const int col = i + n;
executed (the execution status of this line is deduced): const int col = i + n;
-
1670 QFixed w = widthToDistribute / (cspan - n);
executed (the execution status of this line is deduced): QFixed w = widthToDistribute / (cspan - n);
-
1671 td->minWidths[col] = qMax(td->minWidths.at(col), w);
executed (the execution status of this line is deduced): td->minWidths[col] = qMax(td->minWidths.at(col), w);
-
1672 widthToDistribute -= td->minWidths.at(col);
executed (the execution status of this line is deduced): widthToDistribute -= td->minWidths.at(col);
-
1673 if (widthToDistribute <= 0)
evaluated: widthToDistribute <= 0
TRUEFALSE
yes
Evaluation Count:473
yes
Evaluation Count:6
6-473
1674 break;
executed: break;
Execution Count:473
473
1675 }
executed: }
Execution Count:6
6
1676 -
1677 QFixed maxW = td->maxWidths.at(i);
executed (the execution status of this line is deduced): QFixed maxW = td->maxWidths.at(i);
-
1678 if (layoutStruct.maximumWidth != QFIXED_MAX) {
evaluated: layoutStruct.maximumWidth != (2147483647/256)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:461
12-461
1679 if (maxW == QFIXED_MAX)
evaluated: maxW == (2147483647/256)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
1680 maxW = layoutStruct.maximumWidth + widthPadding;
executed: maxW = layoutStruct.maximumWidth + widthPadding;
Execution Count:10
10
1681 else -
1682 maxW = qMax(maxW, layoutStruct.maximumWidth + widthPadding);
executed: maxW = qMax(maxW, layoutStruct.maximumWidth + widthPadding);
Execution Count:2
2
1683 } -
1684 if (maxW == QFIXED_MAX)
evaluated: maxW == (2147483647/256)
TRUEFALSE
yes
Evaluation Count:461
yes
Evaluation Count:12
12-461
1685 continue;
executed: continue;
Execution Count:461
461
1686 -
1687 widthToDistribute = maxW;
executed (the execution status of this line is deduced): widthToDistribute = maxW;
-
1688 for (int n = 0; n < cspan; ++n) {
partially evaluated: n < cspan
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
1689 const int col = i + n;
executed (the execution status of this line is deduced): const int col = i + n;
-
1690 QFixed w = widthToDistribute / (cspan - n);
executed (the execution status of this line is deduced): QFixed w = widthToDistribute / (cspan - n);
-
1691 td->maxWidths[col] = qMax(td->minWidths.at(col), w);
executed (the execution status of this line is deduced): td->maxWidths[col] = qMax(td->minWidths.at(col), w);
-
1692 widthToDistribute -= td->maxWidths.at(col);
executed (the execution status of this line is deduced): widthToDistribute -= td->maxWidths.at(col);
-
1693 if (widthToDistribute <= 0)
evaluated: widthToDistribute <= 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:6
6-12
1694 break;
executed: break;
Execution Count:12
12
1695 }
executed: }
Execution Count:6
6
1696 }
executed: }
Execution Count:12
12
1697 }
executed: }
Execution Count:109
109
1698 -
1699 // set fixed values, figure out total percentages used and number of -
1700 // variable length cells. Also assign the minimum width for variable columns. -
1701 QFixed totalPercentage;
executed (the execution status of this line is deduced): QFixed totalPercentage;
-
1702 int variableCols = 0;
executed (the execution status of this line is deduced): int variableCols = 0;
-
1703 QFixed totalMinWidth = 0;
executed (the execution status of this line is deduced): QFixed totalMinWidth = 0;
-
1704 for (int i = 0; i < columns; ++i) {
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:38
38-109
1705 const QTextLength &length = columnWidthConstraints.at(i);
executed (the execution status of this line is deduced): const QTextLength &length = columnWidthConstraints.at(i);
-
1706 if (length.type() == QTextLength::FixedLength) {
evaluated: length.type() == QTextLength::FixedLength
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:101
8-101
1707 td->minWidths[i] = td->widths[i] = qMax(scaleToDevice(QFixed::fromReal(length.rawValue())), td->minWidths.at(i));
executed (the execution status of this line is deduced): td->minWidths[i] = td->widths[i] = qMax(scaleToDevice(QFixed::fromReal(length.rawValue())), td->minWidths.at(i));
-
1708 remainingWidth -= td->widths.at(i);
executed (the execution status of this line is deduced): remainingWidth -= td->widths.at(i);
-
1709 } else if (length.type() == QTextLength::PercentageLength) {
executed: }
Execution Count:8
partially evaluated: length.type() == QTextLength::PercentageLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:101
0-101
1710 totalPercentage += QFixed::fromReal(length.rawValue());
never executed (the execution status of this line is deduced): totalPercentage += QFixed::fromReal(length.rawValue());
-
1711 } else if (length.type() == QTextLength::VariableLength) {
never executed: }
partially evaluated: length.type() == QTextLength::VariableLength
TRUEFALSE
yes
Evaluation Count:101
no
Evaluation Count:0
0-101
1712 variableCols++;
executed (the execution status of this line is deduced): variableCols++;
-
1713 -
1714 td->widths[i] = td->minWidths.at(i);
executed (the execution status of this line is deduced): td->widths[i] = td->minWidths.at(i);
-
1715 remainingWidth -= td->minWidths.at(i);
executed (the execution status of this line is deduced): remainingWidth -= td->minWidths.at(i);
-
1716 }
executed: }
Execution Count:101
101
1717 totalMinWidth += td->minWidths.at(i);
executed (the execution status of this line is deduced): totalMinWidth += td->minWidths.at(i);
-
1718 }
executed: }
Execution Count:109
109
1719 -
1720 // set percentage values -
1721 { -
1722 const QFixed totalPercentagedWidth = initialTotalWidth * totalPercentage / 100;
executed (the execution status of this line is deduced): const QFixed totalPercentagedWidth = initialTotalWidth * totalPercentage / 100;
-
1723 QFixed remainingMinWidths = totalMinWidth;
executed (the execution status of this line is deduced): QFixed remainingMinWidths = totalMinWidth;
-
1724 for (int i = 0; i < columns; ++i) {
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:38
38-109
1725 remainingMinWidths -= td->minWidths.at(i);
executed (the execution status of this line is deduced): remainingMinWidths -= td->minWidths.at(i);
-
1726 if (columnWidthConstraints.at(i).type() == QTextLength::PercentageLength) {
partially evaluated: columnWidthConstraints.at(i).type() == QTextLength::PercentageLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1727 const QFixed allottedPercentage = QFixed::fromReal(columnWidthConstraints.at(i).rawValue());
never executed (the execution status of this line is deduced): const QFixed allottedPercentage = QFixed::fromReal(columnWidthConstraints.at(i).rawValue());
-
1728 -
1729 const QFixed percentWidth = totalPercentagedWidth * allottedPercentage / totalPercentage;
never executed (the execution status of this line is deduced): const QFixed percentWidth = totalPercentagedWidth * allottedPercentage / totalPercentage;
-
1730 if (percentWidth >= td->minWidths.at(i)) {
never evaluated: percentWidth >= td->minWidths.at(i)
0
1731 td->widths[i] = qBound(td->minWidths.at(i), percentWidth, remainingWidth - remainingMinWidths);
never executed (the execution status of this line is deduced): td->widths[i] = qBound(td->minWidths.at(i), percentWidth, remainingWidth - remainingMinWidths);
-
1732 } else {
never executed: }
0
1733 td->widths[i] = td->minWidths.at(i);
never executed (the execution status of this line is deduced): td->widths[i] = td->minWidths.at(i);
-
1734 }
never executed: }
0
1735 remainingWidth -= td->widths.at(i);
never executed (the execution status of this line is deduced): remainingWidth -= td->widths.at(i);
-
1736 }
never executed: }
0
1737 }
executed: }
Execution Count:109
109
1738 } -
1739 -
1740 // for variable columns distribute the remaining space -
1741 if (variableCols > 0 && remainingWidth > 0) {
evaluated: variableCols > 0
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:2
evaluated: remainingWidth > 0
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:16
2-36
1742 QVarLengthArray<int> columnsWithProperMaxSize;
executed (the execution status of this line is deduced): QVarLengthArray<int> columnsWithProperMaxSize;
-
1743 for (int i = 0; i < columns; ++i)
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:20
20-65
1744 if (columnWidthConstraints.at(i).type() == QTextLength::VariableLength
partially evaluated: columnWidthConstraints.at(i).type() == QTextLength::VariableLength
TRUEFALSE
yes
Evaluation Count:65
no
Evaluation Count:0
0-65
1745 && td->maxWidths.at(i) != QFIXED_MAX)
evaluated: td->maxWidths.at(i) != (2147483647/256)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:61
4-61
1746 columnsWithProperMaxSize.append(i);
executed: columnsWithProperMaxSize.append(i);
Execution Count:4
4
1747 -
1748 QFixed lastRemainingWidth = remainingWidth;
executed (the execution status of this line is deduced): QFixed lastRemainingWidth = remainingWidth;
-
1749 while (remainingWidth > 0) {
evaluated: remainingWidth > 0
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:2
2-22
1750 for (int k = 0; k < columnsWithProperMaxSize.count(); ++k) {
evaluated: k < columnsWithProperMaxSize.count()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:22
6-22
1751 const int col = columnsWithProperMaxSize[k];
executed (the execution status of this line is deduced): const int col = columnsWithProperMaxSize[k];
-
1752 const int colsLeft = columnsWithProperMaxSize.count() - k;
executed (the execution status of this line is deduced): const int colsLeft = columnsWithProperMaxSize.count() - k;
-
1753 const QFixed w = qMin(td->maxWidths.at(col) - td->widths.at(col), remainingWidth / colsLeft);
executed (the execution status of this line is deduced): const QFixed w = qMin(td->maxWidths.at(col) - td->widths.at(col), remainingWidth / colsLeft);
-
1754 td->widths[col] += w;
executed (the execution status of this line is deduced): td->widths[col] += w;
-
1755 remainingWidth -= w;
executed (the execution status of this line is deduced): remainingWidth -= w;
-
1756 }
executed: }
Execution Count:6
6
1757 if (remainingWidth == lastRemainingWidth)
evaluated: remainingWidth == lastRemainingWidth
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:4
4-18
1758 break;
executed: break;
Execution Count:18
18
1759 lastRemainingWidth = remainingWidth;
executed (the execution status of this line is deduced): lastRemainingWidth = remainingWidth;
-
1760 }
executed: }
Execution Count:4
4
1761 -
1762 if (remainingWidth > 0
evaluated: remainingWidth > 0
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:2
2-18
1763 // don't unnecessarily grow variable length sized tables
executed (the execution status of this line is deduced):
-
1764 && fmt.width().type() != QTextLength::VariableLength) {
partially evaluated: fmt.width().type() != QTextLength::VariableLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
1765 const QFixed widthPerAnySizedCol = remainingWidth / variableCols;
never executed (the execution status of this line is deduced): const QFixed widthPerAnySizedCol = remainingWidth / variableCols;
-
1766 for (int col = 0; col < columns; ++col) {
never evaluated: col < columns
0
1767 if (columnWidthConstraints.at(col).type() == QTextLength::VariableLength)
never evaluated: columnWidthConstraints.at(col).type() == QTextLength::VariableLength
0
1768 td->widths[col] += widthPerAnySizedCol;
never executed: td->widths[col] += widthPerAnySizedCol;
0
1769 }
never executed: }
0
1770 }
never executed: }
0
1771 }
executed: }
Execution Count:20
20
1772 -
1773 td->columnPositions.resize(columns);
executed (the execution status of this line is deduced): td->columnPositions.resize(columns);
-
1774 td->columnPositions[0] = leftMargin /*includes table border*/ + cellSpacing + td->border;
executed (the execution status of this line is deduced): td->columnPositions[0] = leftMargin + cellSpacing + td->border;
-
1775 -
1776 for (int i = 1; i < columns; ++i)
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:38
38-71
1777 td->columnPositions[i] = td->columnPositions.at(i-1) + td->widths.at(i-1) + 2 * td->border + cellSpacing;
executed: td->columnPositions[i] = td->columnPositions.at(i-1) + td->widths.at(i-1) + 2 * td->border + cellSpacing;
Execution Count:71
71
1778 -
1779 // - margin to compensate the + margin in columnPositions[0] -
1780 const QFixed contentsWidth = td->columnPositions.last() + td->widths.last() + td->padding + td->border + cellSpacing - leftMargin;
executed (the execution status of this line is deduced): const QFixed contentsWidth = td->columnPositions.last() + td->widths.last() + td->padding + td->border + cellSpacing - leftMargin;
-
1781 -
1782 // if the table is too big and causes an overflow re-do the layout with WrapAnywhere as wrap -
1783 // mode -
1784 if (docPrivate->defaultTextOption.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere
evaluated: docPrivate->defaultTextOption.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:9
9-29
1785 && contentsWidth > td->contentsWidth) {
evaluated: contentsWidth > td->contentsWidth
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:20
9-20
1786 docPrivate->defaultTextOption.setWrapMode(QTextOption::WrapAnywhere);
executed (the execution status of this line is deduced): docPrivate->defaultTextOption.setWrapMode(QTextOption::WrapAnywhere);
-
1787 // go back to the top of the function -
1788 goto recalc_minmax_widths;
executed: goto recalc_minmax_widths;
Execution Count:9
9
1789 } -
1790 -
1791 td->contentsWidth = contentsWidth;
executed (the execution status of this line is deduced): td->contentsWidth = contentsWidth;
-
1792 -
1793 docPrivate->defaultTextOption.setWrapMode(oldDefaultWrapMode);
executed (the execution status of this line is deduced): docPrivate->defaultTextOption.setWrapMode(oldDefaultWrapMode);
-
1794 -
1795 td->heights.resize(rows);
executed (the execution status of this line is deduced): td->heights.resize(rows);
-
1796 td->heights.fill(0);
executed (the execution status of this line is deduced): td->heights.fill(0);
-
1797 -
1798 td->rowPositions.resize(rows);
executed (the execution status of this line is deduced): td->rowPositions.resize(rows);
-
1799 td->rowPositions[0] = topMargin /*includes table border*/ + cellSpacing + td->border;
executed (the execution status of this line is deduced): td->rowPositions[0] = topMargin + cellSpacing + td->border;
-
1800 -
1801 bool haveRowSpannedCells = false;
executed (the execution status of this line is deduced): bool haveRowSpannedCells = false;
-
1802 -
1803 // need to keep track of cell heights for vertical alignment -
1804 QVector<QFixed> cellHeights;
executed (the execution status of this line is deduced): QVector<QFixed> cellHeights;
-
1805 cellHeights.reserve(rows * columns);
executed (the execution status of this line is deduced): cellHeights.reserve(rows * columns);
-
1806 -
1807 QFixed pageHeight = QFixed::fromReal(document->pageSize().height());
executed (the execution status of this line is deduced): QFixed pageHeight = QFixed::fromReal(document->pageSize().height());
-
1808 if (pageHeight <= 0)
evaluated: pageHeight <= 0
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:4
4-25
1809 pageHeight = QFIXED_MAX;
executed: pageHeight = (2147483647/256);
Execution Count:25
25
1810 -
1811 QVector<QFixed> heightToDistribute;
executed (the execution status of this line is deduced): QVector<QFixed> heightToDistribute;
-
1812 heightToDistribute.resize(columns);
executed (the execution status of this line is deduced): heightToDistribute.resize(columns);
-
1813 -
1814 td->headerHeight = 0;
executed (the execution status of this line is deduced): td->headerHeight = 0;
-
1815 const int headerRowCount = qMin(table->format().headerRowCount(), rows - 1);
executed (the execution status of this line is deduced): const int headerRowCount = qMin(table->format().headerRowCount(), rows - 1);
-
1816 const QFixed originalTopMargin = td->effectiveTopMargin;
executed (the execution status of this line is deduced): const QFixed originalTopMargin = td->effectiveTopMargin;
-
1817 bool hasDroppedTable = false;
executed (the execution status of this line is deduced): bool hasDroppedTable = false;
-
1818 -
1819 // now that we have the column widths we can lay out all cells with the right width. -
1820 // spanning cells are only allowed to grow the last row spanned by the cell. -
1821 // -
1822 // ### this could be made faster by iterating over the cells array of QTextTable -
1823 for (int r = 0; r < rows; ++r) {
evaluated: r < rows
TRUEFALSE
yes
Evaluation Count:223
yes
Evaluation Count:29
29-223
1824 td->calcRowPosition(r);
executed (the execution status of this line is deduced): td->calcRowPosition(r);
-
1825 -
1826 const int tableStartPage = (absoluteTableY / pageHeight).truncate();
executed (the execution status of this line is deduced): const int tableStartPage = (absoluteTableY / pageHeight).truncate();
-
1827 const int currentPage = ((td->rowPositions[r] + absoluteTableY) / pageHeight).truncate();
executed (the execution status of this line is deduced): const int currentPage = ((td->rowPositions[r] + absoluteTableY) / pageHeight).truncate();
-
1828 const QFixed pageBottom = (currentPage + 1) * pageHeight - td->effectiveBottomMargin - absoluteTableY - cellSpacing - td->border;
executed (the execution status of this line is deduced): const QFixed pageBottom = (currentPage + 1) * pageHeight - td->effectiveBottomMargin - absoluteTableY - cellSpacing - td->border;
-
1829 const QFixed pageTop = currentPage * pageHeight + td->effectiveTopMargin - absoluteTableY + cellSpacing + td->border;
executed (the execution status of this line is deduced): const QFixed pageTop = currentPage * pageHeight + td->effectiveTopMargin - absoluteTableY + cellSpacing + td->border;
-
1830 const QFixed nextPageTop = pageTop + pageHeight;
executed (the execution status of this line is deduced): const QFixed nextPageTop = pageTop + pageHeight;
-
1831 -
1832 if (td->rowPositions[r] > pageBottom)
partially evaluated: td->rowPositions[r] > pageBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:223
0-223
1833 td->rowPositions[r] = nextPageTop;
never executed: td->rowPositions[r] = nextPageTop;
0
1834 else if (td->rowPositions[r] < pageTop)
evaluated: td->rowPositions[r] < pageTop
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:222
1-222
1835 td->rowPositions[r] = pageTop;
executed: td->rowPositions[r] = pageTop;
Execution Count:1
1
1836 -
1837 bool dropRowToNextPage = true;
executed (the execution status of this line is deduced): bool dropRowToNextPage = true;
-
1838 int cellCountBeforeRow = cellHeights.size();
executed (the execution status of this line is deduced): int cellCountBeforeRow = cellHeights.size();
-
1839 -
1840 // if we drop the row to the next page we need to subtract the drop -
1841 // distance from any row spanning cells -
1842 QFixed dropDistance = 0;
executed (the execution status of this line is deduced): QFixed dropDistance = 0;
-
1843 -
1844relayout:
code before this statement executed: relayout:
Execution Count:223
223
1845 const int rowStartPage = ((td->rowPositions[r] + absoluteTableY) / pageHeight).truncate();
executed (the execution status of this line is deduced): const int rowStartPage = ((td->rowPositions[r] + absoluteTableY) / pageHeight).truncate();
-
1846 // if any of the header rows or the first non-header row start on the next page -
1847 // then the entire header should be dropped -
1848 if (r <= headerRowCount && rowStartPage > tableStartPage && !hasDroppedTable) {
evaluated: r <= headerRowCount
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:196
partially evaluated: rowStartPage > tableStartPage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
never evaluated: !hasDroppedTable
0-196
1849 td->rowPositions[0] = nextPageTop;
never executed (the execution status of this line is deduced): td->rowPositions[0] = nextPageTop;
-
1850 cellHeights.clear();
never executed (the execution status of this line is deduced): cellHeights.clear();
-
1851 td->effectiveTopMargin = originalTopMargin;
never executed (the execution status of this line is deduced): td->effectiveTopMargin = originalTopMargin;
-
1852 hasDroppedTable = true;
never executed (the execution status of this line is deduced): hasDroppedTable = true;
-
1853 r = -1;
never executed (the execution status of this line is deduced): r = -1;
-
1854 continue;
never executed: continue;
0
1855 } -
1856 -
1857 int rowCellCount = 0;
executed (the execution status of this line is deduced): int rowCellCount = 0;
-
1858 for (int c = 0; c < columns; ++c) {
evaluated: c < columns
TRUEFALSE
yes
Evaluation Count:410
yes
Evaluation Count:225
225-410
1859 QTextTableCell cell = table->cellAt(r, c);
executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(r, c);
-
1860 const int rspan = cell.rowSpan();
executed (the execution status of this line is deduced): const int rspan = cell.rowSpan();
-
1861 const int cspan = cell.columnSpan();
executed (the execution status of this line is deduced): const int cspan = cell.columnSpan();
-
1862 -
1863 if (cspan > 1 && cell.column() != c)
evaluated: cspan > 1
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:348
evaluated: cell.column() != c
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:27
27-348
1864 continue;
executed: continue;
Execution Count:35
35
1865 -
1866 if (rspan > 1) {
evaluated: rspan > 1
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:349
26-349
1867 haveRowSpannedCells = true;
executed (the execution status of this line is deduced): haveRowSpannedCells = true;
-
1868 -
1869 const int cellRow = cell.row();
executed (the execution status of this line is deduced): const int cellRow = cell.row();
-
1870 if (cellRow != r) {
evaluated: cellRow != r
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:8
8-18
1871 // the last row gets all the remaining space -
1872 if (cellRow + rspan - 1 == r)
evaluated: cellRow + rspan - 1 == r
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:10
8-10
1873 td->heights[r] = qMax(td->heights.at(r), heightToDistribute.at(c) - dropDistance);
executed: td->heights[r] = qMax(td->heights.at(r), heightToDistribute.at(c) - dropDistance);
Execution Count:8
8
1874 continue;
executed: continue;
Execution Count:18
18
1875 } -
1876 }
executed: }
Execution Count:8
8
1877 -
1878 const QTextFormat fmt = cell.format();
executed (the execution status of this line is deduced): const QTextFormat fmt = cell.format();
-
1879 -
1880 const QFixed topPadding = td->topPadding(fmt);
executed (the execution status of this line is deduced): const QFixed topPadding = td->topPadding(fmt);
-
1881 const QFixed bottomPadding = td->bottomPadding(fmt);
executed (the execution status of this line is deduced): const QFixed bottomPadding = td->bottomPadding(fmt);
-
1882 const QFixed leftPadding = td->leftPadding(fmt);
executed (the execution status of this line is deduced): const QFixed leftPadding = td->leftPadding(fmt);
-
1883 const QFixed rightPadding = td->rightPadding(fmt);
executed (the execution status of this line is deduced): const QFixed rightPadding = td->rightPadding(fmt);
-
1884 const QFixed widthPadding = leftPadding + rightPadding;
executed (the execution status of this line is deduced): const QFixed widthPadding = leftPadding + rightPadding;
-
1885 -
1886 ++rowCellCount;
executed (the execution status of this line is deduced): ++rowCellCount;
-
1887 -
1888 const QFixed width = td->cellWidth(c, cspan) - widthPadding;
executed (the execution status of this line is deduced): const QFixed width = td->cellWidth(c, cspan) - widthPadding;
-
1889 QTextLayoutStruct layoutStruct = layoutCell(table, cell, width,
executed (the execution status of this line is deduced): QTextLayoutStruct layoutStruct = layoutCell(table, cell, width,
-
1890 layoutFrom, layoutTo,
executed (the execution status of this line is deduced): layoutFrom, layoutTo,
-
1891 td, absoluteTableY,
executed (the execution status of this line is deduced): td, absoluteTableY,
-
1892 /*withPageBreaks =*/true);
executed (the execution status of this line is deduced): true);
-
1893 -
1894 const QFixed height = layoutStruct.y + bottomPadding + topPadding;
executed (the execution status of this line is deduced): const QFixed height = layoutStruct.y + bottomPadding + topPadding;
-
1895 -
1896 if (rspan > 1)
evaluated: rspan > 1
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:349
8-349
1897 heightToDistribute[c] = height + dropDistance;
executed: heightToDistribute[c] = height + dropDistance;
Execution Count:8
8
1898 else -
1899 td->heights[r] = qMax(td->heights.at(r), height);
executed: td->heights[r] = qMax(td->heights.at(r), height);
Execution Count:349
349
1900 -
1901 cellHeights.append(layoutStruct.y);
executed (the execution status of this line is deduced): cellHeights.append(layoutStruct.y);
-
1902 -
1903 QFixed childPos = td->rowPositions.at(r) + topPadding + flowPosition(cell.begin());
executed (the execution status of this line is deduced): QFixed childPos = td->rowPositions.at(r) + topPadding + flowPosition(cell.begin());
-
1904 if (childPos < pageBottom)
evaluated: childPos < pageBottom
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:4
4-353
1905 dropRowToNextPage = false;
executed: dropRowToNextPage = false;
Execution Count:353
353
1906 }
executed: }
Execution Count:357
357
1907 -
1908 if (rowCellCount > 0 && dropRowToNextPage) {
partially evaluated: rowCellCount > 0
TRUEFALSE
yes
Evaluation Count:225
no
Evaluation Count:0
evaluated: dropRowToNextPage
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:223
0-225
1909 dropDistance = nextPageTop - td->rowPositions[r];
executed (the execution status of this line is deduced): dropDistance = nextPageTop - td->rowPositions[r];
-
1910 td->rowPositions[r] = nextPageTop;
executed (the execution status of this line is deduced): td->rowPositions[r] = nextPageTop;
-
1911 td->heights[r] = 0;
executed (the execution status of this line is deduced): td->heights[r] = 0;
-
1912 dropRowToNextPage = false;
executed (the execution status of this line is deduced): dropRowToNextPage = false;
-
1913 cellHeights.resize(cellCountBeforeRow);
executed (the execution status of this line is deduced): cellHeights.resize(cellCountBeforeRow);
-
1914 if (r > headerRowCount)
partially evaluated: r > headerRowCount
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1915 td->heights[r-1] = pageBottom - td->rowPositions[r-1];
executed: td->heights[r-1] = pageBottom - td->rowPositions[r-1];
Execution Count:2
2
1916 goto relayout;
executed: goto relayout;
Execution Count:2
2
1917 } -
1918 -
1919 if (haveRowSpannedCells) {
evaluated: haveRowSpannedCells
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:197
26-197
1920 const QFixed effectiveHeight = td->heights.at(r) + td->border + cellSpacing + td->border;
executed (the execution status of this line is deduced): const QFixed effectiveHeight = td->heights.at(r) + td->border + cellSpacing + td->border;
-
1921 for (int c = 0; c < columns; ++c)
evaluated: c < columns
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:26
26-109
1922 heightToDistribute[c] = qMax(heightToDistribute.at(c) - effectiveHeight - dropDistance, QFixed(0));
executed: heightToDistribute[c] = qMax(heightToDistribute.at(c) - effectiveHeight - dropDistance, QFixed(0));
Execution Count:109
109
1923 }
executed: }
Execution Count:26
26
1924 -
1925 if (r == headerRowCount - 1) {
partially evaluated: r == headerRowCount - 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:223
0-223
1926 td->headerHeight = td->rowPositions[r] + td->heights[r] - td->rowPositions[0] + td->cellSpacing + 2 * td->border;
never executed (the execution status of this line is deduced): td->headerHeight = td->rowPositions[r] + td->heights[r] - td->rowPositions[0] + td->cellSpacing + 2 * td->border;
-
1927 td->headerHeight -= td->headerHeight * (td->headerHeight / pageHeight).truncate();
never executed (the execution status of this line is deduced): td->headerHeight -= td->headerHeight * (td->headerHeight / pageHeight).truncate();
-
1928 td->effectiveTopMargin += td->headerHeight;
never executed (the execution status of this line is deduced): td->effectiveTopMargin += td->headerHeight;
-
1929 }
never executed: }
0
1930 }
executed: }
Execution Count:223
223
1931 -
1932 td->effectiveTopMargin = originalTopMargin;
executed (the execution status of this line is deduced): td->effectiveTopMargin = originalTopMargin;
-
1933 -
1934 // now that all cells have been properly laid out, we can compute the -
1935 // vertical offsets for vertical alignment -
1936 td->cellVerticalOffsets.resize(rows * columns);
executed (the execution status of this line is deduced): td->cellVerticalOffsets.resize(rows * columns);
-
1937 int cellIndex = 0;
executed (the execution status of this line is deduced): int cellIndex = 0;
-
1938 for (int r = 0; r < rows; ++r) {
evaluated: r < rows
TRUEFALSE
yes
Evaluation Count:223
yes
Evaluation Count:29
29-223
1939 for (int c = 0; c < columns; ++c) {
evaluated: c < columns
TRUEFALSE
yes
Evaluation Count:408
yes
Evaluation Count:223
223-408
1940 QTextTableCell cell = table->cellAt(r, c);
executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(r, c);
-
1941 if (cell.row() != r || cell.column() != c)
evaluated: cell.row() != r
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:368
evaluated: cell.column() != c
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:355
13-368
1942 continue;
executed: continue;
Execution Count:53
53
1943 -
1944 const int rowSpan = cell.rowSpan();
executed (the execution status of this line is deduced): const int rowSpan = cell.rowSpan();
-
1945 const QFixed availableHeight = td->rowPositions.at(r + rowSpan - 1) + td->heights.at(r + rowSpan - 1) - td->rowPositions.at(r);
executed (the execution status of this line is deduced): const QFixed availableHeight = td->rowPositions.at(r + rowSpan - 1) + td->heights.at(r + rowSpan - 1) - td->rowPositions.at(r);
-
1946 -
1947 const QTextCharFormat cellFormat = cell.format();
executed (the execution status of this line is deduced): const QTextCharFormat cellFormat = cell.format();
-
1948 const QFixed cellHeight = cellHeights.at(cellIndex++) + td->topPadding(cellFormat) + td->bottomPadding(cellFormat);
executed (the execution status of this line is deduced): const QFixed cellHeight = cellHeights.at(cellIndex++) + td->topPadding(cellFormat) + td->bottomPadding(cellFormat);
-
1949 -
1950 QFixed offset = 0;
executed (the execution status of this line is deduced): QFixed offset = 0;
-
1951 switch (cellFormat.verticalAlignment()) { -
1952 case QTextCharFormat::AlignMiddle: -
1953 offset = (availableHeight - cellHeight) / 2;
never executed (the execution status of this line is deduced): offset = (availableHeight - cellHeight) / 2;
-
1954 break;
never executed: break;
0
1955 case QTextCharFormat::AlignBottom: -
1956 offset = availableHeight - cellHeight;
never executed (the execution status of this line is deduced): offset = availableHeight - cellHeight;
-
1957 break;
never executed: break;
0
1958 default: -
1959 break;
executed: break;
Execution Count:355
355
1960 }; -
1961 -
1962 for (int rd = 0; rd < cell.rowSpan(); ++rd) {
evaluated: rd < cell.rowSpan()
TRUEFALSE
yes
Evaluation Count:373
yes
Evaluation Count:355
355-373
1963 for (int cd = 0; cd < cell.columnSpan(); ++cd) {
evaluated: cd < cell.columnSpan()
TRUEFALSE
yes
Evaluation Count:408
yes
Evaluation Count:373
373-408
1964 const int index = (c + cd) + (r + rd) * columns;
executed (the execution status of this line is deduced): const int index = (c + cd) + (r + rd) * columns;
-
1965 td->cellVerticalOffsets[index] = offset;
executed (the execution status of this line is deduced): td->cellVerticalOffsets[index] = offset;
-
1966 }
executed: }
Execution Count:408
408
1967 }
executed: }
Execution Count:373
373
1968 }
executed: }
Execution Count:355
355
1969 }
executed: }
Execution Count:223
223
1970 -
1971 td->minimumWidth = td->columnPositions.at(0);
executed (the execution status of this line is deduced): td->minimumWidth = td->columnPositions.at(0);
-
1972 for (int i = 0; i < columns; ++i) {
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:29
29-87
1973 td->minimumWidth += td->minWidths.at(i) + 2 * td->border + cellSpacing;
executed (the execution status of this line is deduced): td->minimumWidth += td->minWidths.at(i) + 2 * td->border + cellSpacing;
-
1974 }
executed: }
Execution Count:87
87
1975 td->minimumWidth += rightMargin - td->border;
executed (the execution status of this line is deduced): td->minimumWidth += rightMargin - td->border;
-
1976 -
1977 td->maximumWidth = td->columnPositions.at(0);
executed (the execution status of this line is deduced): td->maximumWidth = td->columnPositions.at(0);
-
1978 for (int i = 0; i < columns; ++i)
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:29
29-87
1979 if (td->maxWidths.at(i) != QFIXED_MAX)
evaluated: td->maxWidths.at(i) != (2147483647/256)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:78
9-78
1980 td->maximumWidth += td->maxWidths.at(i) + 2 * td->border + cellSpacing;
executed: td->maximumWidth += td->maxWidths.at(i) + 2 * td->border + cellSpacing;
Execution Count:9
9
1981 td->maximumWidth += rightMargin - td->border;
executed (the execution status of this line is deduced): td->maximumWidth += rightMargin - td->border;
-
1982 -
1983 td->updateTableSize();
executed (the execution status of this line is deduced): td->updateTableSize();
-
1984 td->sizeDirty = false;
executed (the execution status of this line is deduced): td->sizeDirty = false;
-
1985 return QRectF(); // invalid rect -> update everything
executed: return QRectF();
Execution Count:29
29
1986} -
1987 -
1988void QTextDocumentLayoutPrivate::positionFloat(QTextFrame *frame, QTextLine *currentLine) -
1989{ -
1990 QTextFrameData *fd = data(frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(frame);
-
1991 -
1992 QTextFrame *parent = frame->parentFrame();
executed (the execution status of this line is deduced): QTextFrame *parent = frame->parentFrame();
-
1993 Q_ASSERT(parent);
executed (the execution status of this line is deduced): qt_noop();
-
1994 QTextFrameData *pd = data(parent);
executed (the execution status of this line is deduced): QTextFrameData *pd = data(parent);
-
1995 Q_ASSERT(pd && pd->currentLayoutStruct);
executed (the execution status of this line is deduced): qt_noop();
-
1996 -
1997 QTextLayoutStruct *layoutStruct = pd->currentLayoutStruct;
executed (the execution status of this line is deduced): QTextLayoutStruct *layoutStruct = pd->currentLayoutStruct;
-
1998 -
1999 if (!pd->floats.contains(frame))
evaluated: !pd->floats.contains(frame)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2000 pd->floats.append(frame);
executed: pd->floats.append(frame);
Execution Count:2
2
2001 fd->layoutDirty = true;
executed (the execution status of this line is deduced): fd->layoutDirty = true;
-
2002 Q_ASSERT(!fd->sizeDirty);
executed (the execution status of this line is deduced): qt_noop();
-
2003 -
2004// qDebug() << "positionFloat:" << frame << "width=" << fd->size.width; -
2005 QFixed y = layoutStruct->y;
executed (the execution status of this line is deduced): QFixed y = layoutStruct->y;
-
2006 if (currentLine) {
evaluated: currentLine
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2007 QFixed left, right;
executed (the execution status of this line is deduced): QFixed left, right;
-
2008 floatMargins(y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(y, layoutStruct, &left, &right);
-
2009// qDebug() << "have line: right=" << right << "left=" << left << "textWidth=" << currentLine->width(); -
2010 if (right - left < QFixed::fromReal(currentLine->naturalTextWidth()) + fd->size.width) {
partially evaluated: right - left < QFixed::fromReal(currentLine->naturalTextWidth()) + fd->size.width
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2011 layoutStruct->pendingFloats.append(frame);
never executed (the execution status of this line is deduced): layoutStruct->pendingFloats.append(frame);
-
2012// qDebug() << " adding to pending list"; -
2013 return;
never executed: return;
0
2014 } -
2015 }
executed: }
Execution Count:2
2
2016 -
2017 bool frameSpansIntoNextPage = (y + layoutStruct->frameY + fd->size.height > layoutStruct->pageBottom);
executed (the execution status of this line is deduced): bool frameSpansIntoNextPage = (y + layoutStruct->frameY + fd->size.height > layoutStruct->pageBottom);
-
2018 if (frameSpansIntoNextPage && fd->size.height <= layoutStruct->pageHeight) {
evaluated: frameSpansIntoNextPage
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
partially evaluated: fd->size.height <= layoutStruct->pageHeight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-3
2019 layoutStruct->newPage();
never executed (the execution status of this line is deduced): layoutStruct->newPage();
-
2020 y = layoutStruct->y;
never executed (the execution status of this line is deduced): y = layoutStruct->y;
-
2021 -
2022 frameSpansIntoNextPage = false;
never executed (the execution status of this line is deduced): frameSpansIntoNextPage = false;
-
2023 }
never executed: }
0
2024 -
2025 y = findY(y, layoutStruct, fd->size.width);
executed (the execution status of this line is deduced): y = findY(y, layoutStruct, fd->size.width);
-
2026 -
2027 QFixed left, right;
executed (the execution status of this line is deduced): QFixed left, right;
-
2028 floatMargins(y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(y, layoutStruct, &left, &right);
-
2029 -
2030 if (frame->frameFormat().position() == QTextFrameFormat::FloatLeft) {
evaluated: frame->frameFormat().position() == QTextFrameFormat::FloatLeft
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2031 fd->position.x = left;
executed (the execution status of this line is deduced): fd->position.x = left;
-
2032 fd->position.y = y;
executed (the execution status of this line is deduced): fd->position.y = y;
-
2033 } else {
executed: }
Execution Count:2
2
2034 fd->position.x = right - fd->size.width;
executed (the execution status of this line is deduced): fd->position.x = right - fd->size.width;
-
2035 fd->position.y = y;
executed (the execution status of this line is deduced): fd->position.y = y;
-
2036 }
executed: }
Execution Count:2
2
2037 -
2038 layoutStruct->minimumWidth = qMax(layoutStruct->minimumWidth, fd->minimumWidth);
executed (the execution status of this line is deduced): layoutStruct->minimumWidth = qMax(layoutStruct->minimumWidth, fd->minimumWidth);
-
2039 layoutStruct->maximumWidth = qMin(layoutStruct->maximumWidth, fd->maximumWidth);
executed (the execution status of this line is deduced): layoutStruct->maximumWidth = qMin(layoutStruct->maximumWidth, fd->maximumWidth);
-
2040 -
2041// qDebug()<< "float positioned at " << fd->position.x << fd->position.y; -
2042 fd->layoutDirty = false;
executed (the execution status of this line is deduced): fd->layoutDirty = false;
-
2043 -
2044 // If the frame is a table, then positioning it will affect the size if it covers more than -
2045 // one page, because of page breaks and repeating the header. -
2046 if (qobject_cast<QTextTable *>(frame) != 0)
evaluated: qobject_cast<QTextTable *>(frame) != 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2047 fd->sizeDirty = frameSpansIntoNextPage;
executed: fd->sizeDirty = frameSpansIntoNextPage;
Execution Count:2
2
2048}
executed: }
Execution Count:4
4
2049 -
2050QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed parentY) -
2051{ -
2052 LDEBUG << "layoutFrame (pre)";
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2052, __PRETTY_FUNCTION__).debug() << "layoutFrame (pre)";
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1969
0-1969
2053 Q_ASSERT(data(f)->sizeDirty);
executed (the execution status of this line is deduced): qt_noop();
-
2054// qDebug("layouting frame (%d--%d), parent=%p", f->firstPosition(), f->lastPosition(), f->parentFrame()); -
2055 -
2056 QTextFrameFormat fformat = f->frameFormat();
executed (the execution status of this line is deduced): QTextFrameFormat fformat = f->frameFormat();
-
2057 -
2058 QTextFrame *parent = f->parentFrame();
executed (the execution status of this line is deduced): QTextFrame *parent = f->parentFrame();
-
2059 const QTextFrameData *pd = parent ? data(parent) : 0;
evaluated: parent
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1940
29-1940
2060 -
2061 const qreal maximumWidth = qMax(qreal(0), pd ? pd->contentsWidth.toReal() : document->pageSize().width());
executed (the execution status of this line is deduced): const qreal maximumWidth = qMax(qreal(0), pd ? pd->contentsWidth.toReal() : document->pageSize().width());
-
2062 QFixed width = QFixed::fromReal(fformat.width().value(maximumWidth));
executed (the execution status of this line is deduced): QFixed width = QFixed::fromReal(fformat.width().value(maximumWidth));
-
2063 if (fformat.width().type() == QTextLength::FixedLength)
partially evaluated: fformat.width().type() == QTextLength::FixedLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1969
0-1969
2064 width = scaleToDevice(width);
never executed: width = scaleToDevice(width);
0
2065 -
2066 const QFixed maximumHeight = pd ? pd->contentsHeight : -1;
evaluated: pd
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1940
29-1940
2067 const QFixed height = (maximumHeight != -1 || fformat.height().type() != QTextLength::PercentageLength)
partially evaluated: maximumHeight != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1969
partially evaluated: fformat.height().type() != QTextLength::PercentageLength
TRUEFALSE
yes
Evaluation Count:1969
no
Evaluation Count:0
0-1969
2068 ? QFixed::fromReal(fformat.height().value(maximumHeight.toReal()))
executed (the execution status of this line is deduced): ? QFixed::fromReal(fformat.height().value(maximumHeight.toReal()))
-
2069 : -1;
executed (the execution status of this line is deduced): : -1;
-
2070 -
2071 return layoutFrame(f, layoutFrom, layoutTo, width, height, parentY);
executed: return layoutFrame(f, layoutFrom, layoutTo, width, height, parentY);
Execution Count:1969
1969
2072} -
2073 -
2074QRectF QTextDocumentLayoutPrivate::layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed frameWidth, QFixed frameHeight, QFixed parentY) -
2075{ -
2076 LDEBUG << "layoutFrame from=" << layoutFrom << "to=" << layoutTo;
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2076, __PRETTY_FUNCTION__).debug() << "layoutFrame from=" << layoutFrom << "to=" << layoutTo;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1969
0-1969
2077 Q_ASSERT(data(f)->sizeDirty);
executed (the execution status of this line is deduced): qt_noop();
-
2078// qDebug("layouting frame (%d--%d), parent=%p", f->firstPosition(), f->lastPosition(), f->parentFrame()); -
2079 -
2080 QTextFrameData *fd = data(f);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(f);
-
2081 QFixed newContentsWidth;
executed (the execution status of this line is deduced): QFixed newContentsWidth;
-
2082 -
2083 { -
2084 QTextFrameFormat fformat = f->frameFormat();
executed (the execution status of this line is deduced): QTextFrameFormat fformat = f->frameFormat();
-
2085 // set sizes of this frame from the format -
2086 fd->topMargin = QFixed::fromReal(fformat.topMargin());
executed (the execution status of this line is deduced): fd->topMargin = QFixed::fromReal(fformat.topMargin());
-
2087 fd->bottomMargin = QFixed::fromReal(fformat.bottomMargin());
executed (the execution status of this line is deduced): fd->bottomMargin = QFixed::fromReal(fformat.bottomMargin());
-
2088 fd->leftMargin = QFixed::fromReal(fformat.leftMargin());
executed (the execution status of this line is deduced): fd->leftMargin = QFixed::fromReal(fformat.leftMargin());
-
2089 fd->rightMargin = QFixed::fromReal(fformat.rightMargin());
executed (the execution status of this line is deduced): fd->rightMargin = QFixed::fromReal(fformat.rightMargin());
-
2090 fd->border = QFixed::fromReal(fformat.border());
executed (the execution status of this line is deduced): fd->border = QFixed::fromReal(fformat.border());
-
2091 fd->padding = QFixed::fromReal(fformat.padding());
executed (the execution status of this line is deduced): fd->padding = QFixed::fromReal(fformat.padding());
-
2092 -
2093 QTextFrame *parent = f->parentFrame();
executed (the execution status of this line is deduced): QTextFrame *parent = f->parentFrame();
-
2094 const QTextFrameData *pd = parent ? data(parent) : 0;
evaluated: parent
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1940
29-1940
2095 -
2096 // accumulate top and bottom margins -
2097 if (parent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1940
29-1940
2098 fd->effectiveTopMargin = pd->effectiveTopMargin + fd->topMargin + fd->border + fd->padding;
executed (the execution status of this line is deduced): fd->effectiveTopMargin = pd->effectiveTopMargin + fd->topMargin + fd->border + fd->padding;
-
2099 fd->effectiveBottomMargin = pd->effectiveBottomMargin + fd->topMargin + fd->border + fd->padding;
executed (the execution status of this line is deduced): fd->effectiveBottomMargin = pd->effectiveBottomMargin + fd->topMargin + fd->border + fd->padding;
-
2100 -
2101 if (qobject_cast<QTextTable *>(parent)) {
partially evaluated: qobject_cast<QTextTable *>(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
0-29
2102 const QTextTableData *td = static_cast<const QTextTableData *>(pd);
never executed (the execution status of this line is deduced): const QTextTableData *td = static_cast<const QTextTableData *>(pd);
-
2103 fd->effectiveTopMargin += td->cellSpacing + td->border + td->cellPadding;
never executed (the execution status of this line is deduced): fd->effectiveTopMargin += td->cellSpacing + td->border + td->cellPadding;
-
2104 fd->effectiveBottomMargin += td->cellSpacing + td->border + td->cellPadding;
never executed (the execution status of this line is deduced): fd->effectiveBottomMargin += td->cellSpacing + td->border + td->cellPadding;
-
2105 }
never executed: }
0
2106 } else {
executed: }
Execution Count:29
29
2107 fd->effectiveTopMargin = fd->topMargin + fd->border + fd->padding;
executed (the execution status of this line is deduced): fd->effectiveTopMargin = fd->topMargin + fd->border + fd->padding;
-
2108 fd->effectiveBottomMargin = fd->bottomMargin + fd->border + fd->padding;
executed (the execution status of this line is deduced): fd->effectiveBottomMargin = fd->bottomMargin + fd->border + fd->padding;
-
2109 }
executed: }
Execution Count:1940
1940
2110 -
2111 newContentsWidth = frameWidth - 2*(fd->border + fd->padding)
executed (the execution status of this line is deduced): newContentsWidth = frameWidth - 2*(fd->border + fd->padding)
-
2112 - fd->leftMargin - fd->rightMargin;
executed (the execution status of this line is deduced): - fd->leftMargin - fd->rightMargin;
-
2113 -
2114 if (frameHeight != -1) {
partially evaluated: frameHeight != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1969
0-1969
2115 fd->contentsHeight = frameHeight - 2*(fd->border + fd->padding)
never executed (the execution status of this line is deduced): fd->contentsHeight = frameHeight - 2*(fd->border + fd->padding)
-
2116 - fd->topMargin - fd->bottomMargin;
never executed (the execution status of this line is deduced): - fd->topMargin - fd->bottomMargin;
-
2117 } else {
never executed: }
0
2118 fd->contentsHeight = frameHeight;
executed (the execution status of this line is deduced): fd->contentsHeight = frameHeight;
-
2119 }
executed: }
Execution Count:1969
1969
2120 } -
2121 -
2122 if (isFrameFromInlineObject(f)) {
partially evaluated: isFrameFromInlineObject(f)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1969
0-1969
2123 // never reached, handled in resizeInlineObject/positionFloat instead -
2124 return QRectF();
never executed: return QRectF();
0
2125 } -
2126 -
2127 if (QTextTable *table = qobject_cast<QTextTable *>(f)) {
evaluated: QTextTable *table = qobject_cast<QTextTable *>(f)
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1940
29-1940
2128 fd->contentsWidth = newContentsWidth;
executed (the execution status of this line is deduced): fd->contentsWidth = newContentsWidth;
-
2129 return layoutTable(table, layoutFrom, layoutTo, parentY);
executed: return layoutTable(table, layoutFrom, layoutTo, parentY);
Execution Count:29
29
2130 } -
2131 -
2132 // set fd->contentsWidth temporarily, so that layoutFrame for the children -
2133 // picks the right width. We'll initialize it properly at the end of this -
2134 // function. -
2135 fd->contentsWidth = newContentsWidth;
executed (the execution status of this line is deduced): fd->contentsWidth = newContentsWidth;
-
2136 -
2137 QTextLayoutStruct layoutStruct;
executed (the execution status of this line is deduced): QTextLayoutStruct layoutStruct;
-
2138 layoutStruct.frame = f;
executed (the execution status of this line is deduced): layoutStruct.frame = f;
-
2139 layoutStruct.x_left = fd->leftMargin + fd->border + fd->padding;
executed (the execution status of this line is deduced): layoutStruct.x_left = fd->leftMargin + fd->border + fd->padding;
-
2140 layoutStruct.x_right = layoutStruct.x_left + newContentsWidth;
executed (the execution status of this line is deduced): layoutStruct.x_right = layoutStruct.x_left + newContentsWidth;
-
2141 layoutStruct.y = fd->topMargin + fd->border + fd->padding;
executed (the execution status of this line is deduced): layoutStruct.y = fd->topMargin + fd->border + fd->padding;
-
2142 layoutStruct.frameY = parentY + fd->position.y;
executed (the execution status of this line is deduced): layoutStruct.frameY = parentY + fd->position.y;
-
2143 layoutStruct.contentsWidth = 0;
executed (the execution status of this line is deduced): layoutStruct.contentsWidth = 0;
-
2144 layoutStruct.minimumWidth = 0;
executed (the execution status of this line is deduced): layoutStruct.minimumWidth = 0;
-
2145 layoutStruct.maximumWidth = QFIXED_MAX;
executed (the execution status of this line is deduced): layoutStruct.maximumWidth = (2147483647/256);
-
2146 layoutStruct.fullLayout = fd->oldContentsWidth != newContentsWidth;
executed (the execution status of this line is deduced): layoutStruct.fullLayout = fd->oldContentsWidth != newContentsWidth;
-
2147 layoutStruct.updateRect = QRectF(QPointF(0, 0), QSizeF(qreal(INT_MAX), qreal(INT_MAX)));
executed (the execution status of this line is deduced): layoutStruct.updateRect = QRectF(QPointF(0, 0), QSizeF(qreal(2147483647), qreal(2147483647)));
-
2148 LDEBUG << "layoutStruct: x_left" << layoutStruct.x_left << "x_right" << layoutStruct.x_right
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2148, __PRETTY_FUNCTION__).debug() << "layoutStruct: x_left" << layoutStruct.x_left << "x_right" << layoutStruct.x_right << "fullLayout" << layoutStruct.fullLayout;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1940
0-1940
2149 << "fullLayout" << layoutStruct.fullLayout;
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2148, __PRETTY_FUNCTION__).debug() << "layoutStruct: x_left" << layoutStruct.x_left << "x_right" << layoutStruct.x_right << "fullLayout" << layoutStruct.fullLayout;
0
2150 fd->oldContentsWidth = newContentsWidth;
executed (the execution status of this line is deduced): fd->oldContentsWidth = newContentsWidth;
-
2151 -
2152 layoutStruct.pageHeight = QFixed::fromReal(document->pageSize().height());
executed (the execution status of this line is deduced): layoutStruct.pageHeight = QFixed::fromReal(document->pageSize().height());
-
2153 if (layoutStruct.pageHeight < 0)
evaluated: layoutStruct.pageHeight < 0
TRUEFALSE
yes
Evaluation Count:1935
yes
Evaluation Count:5
5-1935
2154 layoutStruct.pageHeight = QFIXED_MAX;
executed: layoutStruct.pageHeight = (2147483647/256);
Execution Count:1935
1935
2155 -
2156 const int currentPage = layoutStruct.pageHeight == 0 ? 0 : (layoutStruct.frameY / layoutStruct.pageHeight).truncate();
partially evaluated: layoutStruct.pageHeight == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1940
0-1940
2157 layoutStruct.pageTopMargin = fd->effectiveTopMargin;
executed (the execution status of this line is deduced): layoutStruct.pageTopMargin = fd->effectiveTopMargin;
-
2158 layoutStruct.pageBottomMargin = fd->effectiveBottomMargin;
executed (the execution status of this line is deduced): layoutStruct.pageBottomMargin = fd->effectiveBottomMargin;
-
2159 layoutStruct.pageBottom = (currentPage + 1) * layoutStruct.pageHeight - layoutStruct.pageBottomMargin;
executed (the execution status of this line is deduced): layoutStruct.pageBottom = (currentPage + 1) * layoutStruct.pageHeight - layoutStruct.pageBottomMargin;
-
2160 -
2161 if (!f->parentFrame())
partially evaluated: !f->parentFrame()
TRUEFALSE
yes
Evaluation Count:1940
no
Evaluation Count:0
0-1940
2162 idealWidth = 0; // reset
executed: idealWidth = 0;
Execution Count:1940
1940
2163 -
2164 QTextFrame::Iterator it = f->begin();
executed (the execution status of this line is deduced): QTextFrame::Iterator it = f->begin();
-
2165 layoutFlow(it, &layoutStruct, layoutFrom, layoutTo);
executed (the execution status of this line is deduced): layoutFlow(it, &layoutStruct, layoutFrom, layoutTo);
-
2166 -
2167 QFixed maxChildFrameWidth = 0;
executed (the execution status of this line is deduced): QFixed maxChildFrameWidth = 0;
-
2168 QList<QTextFrame *> children = f->childFrames();
executed (the execution status of this line is deduced): QList<QTextFrame *> children = f->childFrames();
-
2169 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:1940
31-1940
2170 QTextFrame *c = children.at(i);
executed (the execution status of this line is deduced): QTextFrame *c = children.at(i);
-
2171 QTextFrameData *cd = data(c);
executed (the execution status of this line is deduced): QTextFrameData *cd = data(c);
-
2172 maxChildFrameWidth = qMax(maxChildFrameWidth, cd->size.width);
executed (the execution status of this line is deduced): maxChildFrameWidth = qMax(maxChildFrameWidth, cd->size.width);
-
2173 }
executed: }
Execution Count:31
31
2174 -
2175 const QFixed marginWidth = 2*(fd->border + fd->padding) + fd->leftMargin + fd->rightMargin;
executed (the execution status of this line is deduced): const QFixed marginWidth = 2*(fd->border + fd->padding) + fd->leftMargin + fd->rightMargin;
-
2176 if (!f->parentFrame()) {
partially evaluated: !f->parentFrame()
TRUEFALSE
yes
Evaluation Count:1940
no
Evaluation Count:0
0-1940
2177 idealWidth = qMax(maxChildFrameWidth, layoutStruct.contentsWidth).toReal();
executed (the execution status of this line is deduced): idealWidth = qMax(maxChildFrameWidth, layoutStruct.contentsWidth).toReal();
-
2178 idealWidth += marginWidth.toReal();
executed (the execution status of this line is deduced): idealWidth += marginWidth.toReal();
-
2179 }
executed: }
Execution Count:1940
1940
2180 -
2181 QFixed actualWidth = qMax(newContentsWidth, qMax(maxChildFrameWidth, layoutStruct.contentsWidth));
executed (the execution status of this line is deduced): QFixed actualWidth = qMax(newContentsWidth, qMax(maxChildFrameWidth, layoutStruct.contentsWidth));
-
2182 fd->contentsWidth = actualWidth;
executed (the execution status of this line is deduced): fd->contentsWidth = actualWidth;
-
2183 if (newContentsWidth <= 0) { // nowrap layout?
evaluated: newContentsWidth <= 0
TRUEFALSE
yes
Evaluation Count:1365
yes
Evaluation Count:575
575-1365
2184 fd->contentsWidth = newContentsWidth;
executed (the execution status of this line is deduced): fd->contentsWidth = newContentsWidth;
-
2185 }
executed: }
Execution Count:1365
1365
2186 -
2187 fd->minimumWidth = layoutStruct.minimumWidth;
executed (the execution status of this line is deduced): fd->minimumWidth = layoutStruct.minimumWidth;
-
2188 fd->maximumWidth = layoutStruct.maximumWidth;
executed (the execution status of this line is deduced): fd->maximumWidth = layoutStruct.maximumWidth;
-
2189 -
2190 fd->size.height = fd->contentsHeight == -1
partially evaluated: fd->contentsHeight == -1
TRUEFALSE
yes
Evaluation Count:1940
no
Evaluation Count:0
0-1940
2191 ? layoutStruct.y + fd->border + fd->padding + fd->bottomMargin
executed (the execution status of this line is deduced): ? layoutStruct.y + fd->border + fd->padding + fd->bottomMargin
-
2192 : fd->contentsHeight + 2*(fd->border + fd->padding) + fd->topMargin + fd->bottomMargin;
executed (the execution status of this line is deduced): : fd->contentsHeight + 2*(fd->border + fd->padding) + fd->topMargin + fd->bottomMargin;
-
2193 fd->size.width = actualWidth + marginWidth;
executed (the execution status of this line is deduced): fd->size.width = actualWidth + marginWidth;
-
2194 fd->sizeDirty = false;
executed (the execution status of this line is deduced): fd->sizeDirty = false;
-
2195 if (layoutStruct.updateRectForFloats.isValid())
evaluated: layoutStruct.updateRectForFloats.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1938
2-1938
2196 layoutStruct.updateRect |= layoutStruct.updateRectForFloats;
executed: layoutStruct.updateRect |= layoutStruct.updateRectForFloats;
Execution Count:2
2
2197 return layoutStruct.updateRect;
executed: return layoutStruct.updateRect;
Execution Count:1940
1940
2198} -
2199 -
2200void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, -
2201 int layoutFrom, int layoutTo, QFixed width) -
2202{ -
2203 LDEBUG << "layoutFlow from=" << layoutFrom << "to=" << layoutTo;
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2203, __PRETTY_FUNCTION__).debug() << "layoutFlow from=" << layoutFrom << "to=" << layoutTo;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2770
0-2770
2204 QTextFrameData *fd = data(layoutStruct->frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(layoutStruct->frame);
-
2205 -
2206 fd->currentLayoutStruct = layoutStruct;
executed (the execution status of this line is deduced): fd->currentLayoutStruct = layoutStruct;
-
2207 -
2208 QTextFrame::Iterator previousIt;
executed (the execution status of this line is deduced): QTextFrame::Iterator previousIt;
-
2209 -
2210 const bool inRootFrame = (it.parentFrame() == document->rootFrame());
executed (the execution status of this line is deduced): const bool inRootFrame = (it.parentFrame() == document->rootFrame());
-
2211 if (inRootFrame) {
evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:1940
yes
Evaluation Count:830
830-1940
2212 bool redoCheckPoints = layoutStruct->fullLayout || checkPoints.isEmpty();
evaluated: layoutStruct->fullLayout
TRUEFALSE
yes
Evaluation Count:1187
yes
Evaluation Count:753
evaluated: checkPoints.isEmpty()
TRUEFALSE
yes
Evaluation Count:389
yes
Evaluation Count:364
364-1187
2213 -
2214 if (!redoCheckPoints) {
evaluated: !redoCheckPoints
TRUEFALSE
yes
Evaluation Count:364
yes
Evaluation Count:1576
364-1576
2215 QVector<QCheckPoint>::Iterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), layoutFrom);
executed (the execution status of this line is deduced): QVector<QCheckPoint>::Iterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), layoutFrom);
-
2216 if (checkPoint != checkPoints.end()) {
partially evaluated: checkPoint != checkPoints.end()
TRUEFALSE
yes
Evaluation Count:364
no
Evaluation Count:0
0-364
2217 if (checkPoint != checkPoints.begin())
evaluated: checkPoint != checkPoints.begin()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:339
25-339
2218 --checkPoint;
executed: --checkPoint;
Execution Count:25
25
2219 -
2220 layoutStruct->y = checkPoint->y;
executed (the execution status of this line is deduced): layoutStruct->y = checkPoint->y;
-
2221 layoutStruct->frameY = checkPoint->frameY;
executed (the execution status of this line is deduced): layoutStruct->frameY = checkPoint->frameY;
-
2222 layoutStruct->minimumWidth = checkPoint->minimumWidth;
executed (the execution status of this line is deduced): layoutStruct->minimumWidth = checkPoint->minimumWidth;
-
2223 layoutStruct->maximumWidth = checkPoint->maximumWidth;
executed (the execution status of this line is deduced): layoutStruct->maximumWidth = checkPoint->maximumWidth;
-
2224 layoutStruct->contentsWidth = checkPoint->contentsWidth;
executed (the execution status of this line is deduced): layoutStruct->contentsWidth = checkPoint->contentsWidth;
-
2225 -
2226 if (layoutStruct->pageHeight > 0) {
partially evaluated: layoutStruct->pageHeight > 0
TRUEFALSE
yes
Evaluation Count:364
no
Evaluation Count:0
0-364
2227 int page = layoutStruct->currentPage();
executed (the execution status of this line is deduced): int page = layoutStruct->currentPage();
-
2228 layoutStruct->pageBottom = (page + 1) * layoutStruct->pageHeight - layoutStruct->pageBottomMargin;
executed (the execution status of this line is deduced): layoutStruct->pageBottom = (page + 1) * layoutStruct->pageHeight - layoutStruct->pageBottomMargin;
-
2229 }
executed: }
Execution Count:364
364
2230 -
2231 it = frameIteratorForTextPosition(checkPoint->positionInFrame);
executed (the execution status of this line is deduced): it = frameIteratorForTextPosition(checkPoint->positionInFrame);
-
2232 checkPoints.resize(checkPoint - checkPoints.begin() + 1);
executed (the execution status of this line is deduced): checkPoints.resize(checkPoint - checkPoints.begin() + 1);
-
2233 -
2234 if (checkPoint != checkPoints.begin()) {
evaluated: checkPoint != checkPoints.begin()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:362
2-362
2235 previousIt = it;
executed (the execution status of this line is deduced): previousIt = it;
-
2236 --previousIt;
executed (the execution status of this line is deduced): --previousIt;
-
2237 }
executed: }
Execution Count:2
2
2238 } else {
executed: }
Execution Count:364
364
2239 redoCheckPoints = true;
never executed (the execution status of this line is deduced): redoCheckPoints = true;
-
2240 }
never executed: }
0
2241 } -
2242 -
2243 if (redoCheckPoints) {
evaluated: redoCheckPoints
TRUEFALSE
yes
Evaluation Count:1576
yes
Evaluation Count:364
364-1576
2244 checkPoints.clear();
executed (the execution status of this line is deduced): checkPoints.clear();
-
2245 QCheckPoint cp;
executed (the execution status of this line is deduced): QCheckPoint cp;
-
2246 cp.y = layoutStruct->y;
executed (the execution status of this line is deduced): cp.y = layoutStruct->y;
-
2247 cp.frameY = layoutStruct->frameY;
executed (the execution status of this line is deduced): cp.frameY = layoutStruct->frameY;
-
2248 cp.positionInFrame = 0;
executed (the execution status of this line is deduced): cp.positionInFrame = 0;
-
2249 cp.minimumWidth = layoutStruct->minimumWidth;
executed (the execution status of this line is deduced): cp.minimumWidth = layoutStruct->minimumWidth;
-
2250 cp.maximumWidth = layoutStruct->maximumWidth;
executed (the execution status of this line is deduced): cp.maximumWidth = layoutStruct->maximumWidth;
-
2251 cp.contentsWidth = layoutStruct->contentsWidth;
executed (the execution status of this line is deduced): cp.contentsWidth = layoutStruct->contentsWidth;
-
2252 checkPoints.append(cp);
executed (the execution status of this line is deduced): checkPoints.append(cp);
-
2253 }
executed: }
Execution Count:1576
1576
2254 }
executed: }
Execution Count:1940
1940
2255 -
2256 QTextBlockFormat previousBlockFormat = previousIt.currentBlock().blockFormat();
executed (the execution status of this line is deduced): QTextBlockFormat previousBlockFormat = previousIt.currentBlock().blockFormat();
-
2257 -
2258 QFixed maximumBlockWidth = 0;
executed (the execution status of this line is deduced): QFixed maximumBlockWidth = 0;
-
2259 while (!it.atEnd()) {
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:3691
yes
Evaluation Count:2749
2749-3691
2260 QTextFrame *c = it.currentFrame();
executed (the execution status of this line is deduced): QTextFrame *c = it.currentFrame();
-
2261 -
2262 int docPos;
executed (the execution status of this line is deduced): int docPos;
-
2263 if (it.currentFrame())
evaluated: it.currentFrame()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:3663
28-3663
2264 docPos = it.currentFrame()->firstPosition();
executed: docPos = it.currentFrame()->firstPosition();
Execution Count:28
28
2265 else -
2266 docPos = it.currentBlock().position();
executed: docPos = it.currentBlock().position();
Execution Count:3663
3663
2267 -
2268 if (inRootFrame) {
evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:2861
yes
Evaluation Count:830
830-2861
2269 if (qAbs(layoutStruct->y - checkPoints.last().y) > 2000) {
evaluated: qAbs(layoutStruct->y - checkPoints.last().y) > 2000
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:2833
28-2833
2270 QFixed left, right;
executed (the execution status of this line is deduced): QFixed left, right;
-
2271 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2272 if (left == layoutStruct->x_left && right == layoutStruct->x_right) {
partially evaluated: left == layoutStruct->x_left
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
partially evaluated: right == layoutStruct->x_right
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
0-28
2273 QCheckPoint p;
executed (the execution status of this line is deduced): QCheckPoint p;
-
2274 p.y = layoutStruct->y;
executed (the execution status of this line is deduced): p.y = layoutStruct->y;
-
2275 p.frameY = layoutStruct->frameY;
executed (the execution status of this line is deduced): p.frameY = layoutStruct->frameY;
-
2276 p.positionInFrame = docPos;
executed (the execution status of this line is deduced): p.positionInFrame = docPos;
-
2277 p.minimumWidth = layoutStruct->minimumWidth;
executed (the execution status of this line is deduced): p.minimumWidth = layoutStruct->minimumWidth;
-
2278 p.maximumWidth = layoutStruct->maximumWidth;
executed (the execution status of this line is deduced): p.maximumWidth = layoutStruct->maximumWidth;
-
2279 p.contentsWidth = layoutStruct->contentsWidth;
executed (the execution status of this line is deduced): p.contentsWidth = layoutStruct->contentsWidth;
-
2280 checkPoints.append(p);
executed (the execution status of this line is deduced): checkPoints.append(p);
-
2281 -
2282 if (currentLazyLayoutPosition != -1
partially evaluated: currentLazyLayoutPosition != -1
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
0-28
2283 && docPos > currentLazyLayoutPosition + lazyLayoutStepSize)
evaluated: docPos > currentLazyLayoutPosition + lazyLayoutStepSize
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:7
7-21
2284 break;
executed: break;
Execution Count:21
21
2285 -
2286 }
executed: }
Execution Count:7
7
2287 }
executed: }
Execution Count:7
7
2288 }
executed: }
Execution Count:2840
2840
2289 -
2290 if (c) {
evaluated: c
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:3642
28-3642
2291 // position child frame -
2292 QTextFrameData *cd = data(c);
executed (the execution status of this line is deduced): QTextFrameData *cd = data(c);
-
2293 -
2294 QTextFrameFormat fformat = c->frameFormat();
executed (the execution status of this line is deduced): QTextFrameFormat fformat = c->frameFormat();
-
2295 -
2296 if (fformat.position() == QTextFrameFormat::InFlow) {
evaluated: fformat.position() == QTextFrameFormat::InFlow
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:2
2-26
2297 if (fformat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore)
partially evaluated: fformat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2298 layoutStruct->newPage();
never executed: layoutStruct->newPage();
0
2299 -
2300 QFixed left, right;
executed (the execution status of this line is deduced): QFixed left, right;
-
2301 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2302 left = qMax(left, layoutStruct->x_left);
executed (the execution status of this line is deduced): left = qMax(left, layoutStruct->x_left);
-
2303 right = qMin(right, layoutStruct->x_right);
executed (the execution status of this line is deduced): right = qMin(right, layoutStruct->x_right);
-
2304 -
2305 if (right - left < cd->size.width) {
evaluated: right - left < cd->size.width
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:19
7-19
2306 layoutStruct->y = findY(layoutStruct->y, layoutStruct, cd->size.width);
executed (the execution status of this line is deduced): layoutStruct->y = findY(layoutStruct->y, layoutStruct, cd->size.width);
-
2307 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2308 }
executed: }
Execution Count:7
7
2309 -
2310 QFixedPoint pos(left, layoutStruct->y);
executed (the execution status of this line is deduced): QFixedPoint pos(left, layoutStruct->y);
-
2311 -
2312 Qt::Alignment align = Qt::AlignLeft;
executed (the execution status of this line is deduced): Qt::Alignment align = Qt::AlignLeft;
-
2313 -
2314 QTextTable *table = qobject_cast<QTextTable *>(c);
executed (the execution status of this line is deduced): QTextTable *table = qobject_cast<QTextTable *>(c);
-
2315 -
2316 if (table)
partially evaluated: table
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
2317 align = table->format().alignment() & Qt::AlignHorizontal_Mask;
executed: align = table->format().alignment() & Qt::AlignHorizontal_Mask;
Execution Count:26
26
2318 -
2319 // detect whether we have any alignment in the document that disallows optimizations, -
2320 // such as not laying out the document again in a textedit with wrapping disabled. -
2321 if (inRootFrame && !(align & Qt::AlignLeft))
partially evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
partially evaluated: !(align & Qt::AlignLeft)
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
2322 contentHasAlignment = true;
executed: contentHasAlignment = true;
Execution Count:26
26
2323 -
2324 cd->position = pos;
executed (the execution status of this line is deduced): cd->position = pos;
-
2325 -
2326 if (document->pageSize().height() > 0.0f)
evaluated: document->pageSize().height() > 0.0f
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:24
2-24
2327 cd->sizeDirty = true;
executed: cd->sizeDirty = true;
Execution Count:2
2
2328 -
2329 if (cd->sizeDirty) {
partially evaluated: cd->sizeDirty
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
2330 if (width != 0)
partially evaluated: width != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2331 layoutFrame(c, layoutFrom, layoutTo, width, -1, layoutStruct->frameY);
never executed: layoutFrame(c, layoutFrom, layoutTo, width, -1, layoutStruct->frameY);
0
2332 else -
2333 layoutFrame(c, layoutFrom, layoutTo, layoutStruct->frameY);
executed: layoutFrame(c, layoutFrom, layoutTo, layoutStruct->frameY);
Execution Count:26
26
2334 -
2335 QFixed absoluteChildPos = table ? pos.y + static_cast<QTextTableData *>(data(table))->rowPositions.at(0) : pos.y + firstChildPos(c);
partially evaluated: table
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
2336 absoluteChildPos += layoutStruct->frameY;
executed (the execution status of this line is deduced): absoluteChildPos += layoutStruct->frameY;
-
2337 -
2338 // drop entire frame to next page if first child of frame is on next page -
2339 if (absoluteChildPos > layoutStruct->pageBottom) {
partially evaluated: absoluteChildPos > layoutStruct->pageBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2340 layoutStruct->newPage();
never executed (the execution status of this line is deduced): layoutStruct->newPage();
-
2341 pos.y = layoutStruct->y;
never executed (the execution status of this line is deduced): pos.y = layoutStruct->y;
-
2342 -
2343 cd->position = pos;
never executed (the execution status of this line is deduced): cd->position = pos;
-
2344 cd->sizeDirty = true;
never executed (the execution status of this line is deduced): cd->sizeDirty = true;
-
2345 -
2346 if (width != 0)
never evaluated: width != 0
0
2347 layoutFrame(c, layoutFrom, layoutTo, width, -1, layoutStruct->frameY);
never executed: layoutFrame(c, layoutFrom, layoutTo, width, -1, layoutStruct->frameY);
0
2348 else -
2349 layoutFrame(c, layoutFrom, layoutTo, layoutStruct->frameY);
never executed: layoutFrame(c, layoutFrom, layoutTo, layoutStruct->frameY);
0
2350 } -
2351 }
executed: }
Execution Count:26
26
2352 -
2353 // align only if there is space for alignment -
2354 if (right - left > cd->size.width) {
evaluated: right - left > cd->size.width
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:8
8-18
2355 if (align & Qt::AlignRight)
partially evaluated: align & Qt::AlignRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
2356 pos.x += layoutStruct->x_right - cd->size.width;
never executed: pos.x += layoutStruct->x_right - cd->size.width;
0
2357 else if (align & Qt::AlignHCenter)
partially evaluated: align & Qt::AlignHCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
2358 pos.x += (layoutStruct->x_right - cd->size.width) / 2;
never executed: pos.x += (layoutStruct->x_right - cd->size.width) / 2;
0
2359 } -
2360 -
2361 cd->position = pos;
executed (the execution status of this line is deduced): cd->position = pos;
-
2362 -
2363 layoutStruct->y += cd->size.height;
executed (the execution status of this line is deduced): layoutStruct->y += cd->size.height;
-
2364 const int page = layoutStruct->currentPage();
executed (the execution status of this line is deduced): const int page = layoutStruct->currentPage();
-
2365 layoutStruct->pageBottom = (page + 1) * layoutStruct->pageHeight - layoutStruct->pageBottomMargin;
executed (the execution status of this line is deduced): layoutStruct->pageBottom = (page + 1) * layoutStruct->pageHeight - layoutStruct->pageBottomMargin;
-
2366 -
2367 cd->layoutDirty = false;
executed (the execution status of this line is deduced): cd->layoutDirty = false;
-
2368 -
2369 if (c->frameFormat().pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)
partially evaluated: c->frameFormat().pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2370 layoutStruct->newPage();
never executed: layoutStruct->newPage();
0
2371 } else {
executed: }
Execution Count:26
26
2372 QRectF oldFrameRect(cd->position.toPointF(), cd->size.toSizeF());
executed (the execution status of this line is deduced): QRectF oldFrameRect(cd->position.toPointF(), cd->size.toSizeF());
-
2373 QRectF updateRect;
executed (the execution status of this line is deduced): QRectF updateRect;
-
2374 -
2375 if (cd->sizeDirty)
partially evaluated: cd->sizeDirty
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2376 updateRect = layoutFrame(c, layoutFrom, layoutTo);
executed: updateRect = layoutFrame(c, layoutFrom, layoutTo);
Execution Count:2
2
2377 -
2378 positionFloat(c);
executed (the execution status of this line is deduced): positionFloat(c);
-
2379 -
2380 // If the size was made dirty when the position was set, layout again -
2381 if (cd->sizeDirty)
evaluated: cd->sizeDirty
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2382 updateRect = layoutFrame(c, layoutFrom, layoutTo);
executed: updateRect = layoutFrame(c, layoutFrom, layoutTo);
Execution Count:1
1
2383 -
2384 QRectF frameRect(cd->position.toPointF(), cd->size.toSizeF());
executed (the execution status of this line is deduced): QRectF frameRect(cd->position.toPointF(), cd->size.toSizeF());
-
2385 -
2386 if (frameRect == oldFrameRect && updateRect.isValid())
partially evaluated: frameRect == oldFrameRect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: updateRect.isValid()
0-2
2387 updateRect.translate(cd->position.toPointF());
never executed: updateRect.translate(cd->position.toPointF());
0
2388 else -
2389 updateRect = frameRect;
executed: updateRect = frameRect;
Execution Count:2
2
2390 -
2391 layoutStruct->addUpdateRectForFloat(updateRect);
executed (the execution status of this line is deduced): layoutStruct->addUpdateRectForFloat(updateRect);
-
2392 if (oldFrameRect.isValid())
evaluated: oldFrameRect.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2393 layoutStruct->addUpdateRectForFloat(oldFrameRect);
executed: layoutStruct->addUpdateRectForFloat(oldFrameRect);
Execution Count:1
1
2394 }
executed: }
Execution Count:2
2
2395 -
2396 layoutStruct->minimumWidth = qMax(layoutStruct->minimumWidth, cd->minimumWidth);
executed (the execution status of this line is deduced): layoutStruct->minimumWidth = qMax(layoutStruct->minimumWidth, cd->minimumWidth);
-
2397 layoutStruct->maximumWidth = qMin(layoutStruct->maximumWidth, cd->maximumWidth);
executed (the execution status of this line is deduced): layoutStruct->maximumWidth = qMin(layoutStruct->maximumWidth, cd->maximumWidth);
-
2398 -
2399 previousIt = it;
executed (the execution status of this line is deduced): previousIt = it;
-
2400 ++it;
executed (the execution status of this line is deduced): ++it;
-
2401 } else {
executed: }
Execution Count:28
28
2402 QTextFrame::Iterator lastIt;
executed (the execution status of this line is deduced): QTextFrame::Iterator lastIt;
-
2403 if (!previousIt.atEnd())
evaluated: !previousIt.atEnd()
TRUEFALSE
yes
Evaluation Count:874
yes
Evaluation Count:2768
874-2768
2404 lastIt = previousIt;
executed: lastIt = previousIt;
Execution Count:874
874
2405 previousIt = it;
executed (the execution status of this line is deduced): previousIt = it;
-
2406 QTextBlock block = it.currentBlock();
executed (the execution status of this line is deduced): QTextBlock block = it.currentBlock();
-
2407 ++it;
executed (the execution status of this line is deduced): ++it;
-
2408 -
2409 const QTextBlockFormat blockFormat = block.blockFormat();
executed (the execution status of this line is deduced): const QTextBlockFormat blockFormat = block.blockFormat();
-
2410 -
2411 if (blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore)
partially evaluated: blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysBefore
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3642
0-3642
2412 layoutStruct->newPage();
never executed: layoutStruct->newPage();
0
2413 -
2414 const QFixed origY = layoutStruct->y;
executed (the execution status of this line is deduced): const QFixed origY = layoutStruct->y;
-
2415 const QFixed origPageBottom = layoutStruct->pageBottom;
executed (the execution status of this line is deduced): const QFixed origPageBottom = layoutStruct->pageBottom;
-
2416 const QFixed origMaximumWidth = layoutStruct->maximumWidth;
executed (the execution status of this line is deduced): const QFixed origMaximumWidth = layoutStruct->maximumWidth;
-
2417 layoutStruct->maximumWidth = 0;
executed (the execution status of this line is deduced): layoutStruct->maximumWidth = 0;
-
2418 -
2419 const QTextBlockFormat *previousBlockFormatPtr = 0;
executed (the execution status of this line is deduced): const QTextBlockFormat *previousBlockFormatPtr = 0;
-
2420 if (lastIt.currentBlock().isValid())
evaluated: lastIt.currentBlock().isValid()
TRUEFALSE
yes
Evaluation Count:846
yes
Evaluation Count:2796
846-2796
2421 previousBlockFormatPtr = &previousBlockFormat;
executed: previousBlockFormatPtr = &previousBlockFormat;
Execution Count:846
846
2422 -
2423 // layout and position child block -
2424 layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
executed (the execution status of this line is deduced): layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
-
2425 -
2426 // detect whether we have any alignment in the document that disallows optimizations, -
2427 // such as not laying out the document again in a textedit with wrapping disabled. -
2428 if (inRootFrame && !(block.layout()->textOption().alignment() & Qt::AlignLeft))
evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:2812
yes
Evaluation Count:830
evaluated: !(block.layout()->textOption().alignment() & Qt::AlignLeft)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2806
6-2812
2429 contentHasAlignment = true;
executed: contentHasAlignment = true;
Execution Count:6
6
2430 -
2431 // if the block right before a table is empty 'hide' it by -
2432 // positioning it into the table border -
2433 if (isEmptyBlockBeforeTable(block, blockFormat, it)) {
evaluated: isEmptyBlockBeforeTable(block, blockFormat, it)
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:3615
27-3615
2434 const QTextBlock lastBlock = lastIt.currentBlock();
executed (the execution status of this line is deduced): const QTextBlock lastBlock = lastIt.currentBlock();
-
2435 const qreal lastBlockBottomMargin = lastBlock.isValid() ? lastBlock.blockFormat().bottomMargin() : 0.0f;
partially evaluated: lastBlock.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
2436 layoutStruct->y = origY + QFixed::fromReal(qMax(lastBlockBottomMargin, block.blockFormat().topMargin()));
executed (the execution status of this line is deduced): layoutStruct->y = origY + QFixed::fromReal(qMax(lastBlockBottomMargin, block.blockFormat().topMargin()));
-
2437 layoutStruct->pageBottom = origPageBottom;
executed (the execution status of this line is deduced): layoutStruct->pageBottom = origPageBottom;
-
2438 } else {
executed: }
Execution Count:27
27
2439 // if the block right after a table is empty then 'hide' it, too -
2440 if (isEmptyBlockAfterTable(block, lastIt.currentFrame())) {
evaluated: isEmptyBlockAfterTable(block, lastIt.currentFrame())
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:3588
27-3588
2441 QTextTableData *td = static_cast<QTextTableData *>(data(lastIt.currentFrame()));
executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(lastIt.currentFrame()));
-
2442 QTextLayout *layout = block.layout();
executed (the execution status of this line is deduced): QTextLayout *layout = block.layout();
-
2443 -
2444 QPointF pos((td->position.x + td->size.width).toReal(),
executed (the execution status of this line is deduced): QPointF pos((td->position.x + td->size.width).toReal(),
-
2445 (td->position.y + td->size.height).toReal() - layout->boundingRect().height());
executed (the execution status of this line is deduced): (td->position.y + td->size.height).toReal() - layout->boundingRect().height());
-
2446 -
2447 layout->setPosition(pos);
executed (the execution status of this line is deduced): layout->setPosition(pos);
-
2448 layoutStruct->y = origY;
executed (the execution status of this line is deduced): layoutStruct->y = origY;
-
2449 layoutStruct->pageBottom = origPageBottom;
executed (the execution status of this line is deduced): layoutStruct->pageBottom = origPageBottom;
-
2450 }
executed: }
Execution Count:27
27
2451 -
2452 // if the block right after a table starts with a line separator, shift it up by one line -
2453 if (isLineSeparatorBlockAfterTable(block, lastIt.currentFrame())) {
evaluated: isLineSeparatorBlockAfterTable(block, lastIt.currentFrame())
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3614
1-3614
2454 QTextTableData *td = static_cast<QTextTableData *>(data(lastIt.currentFrame()));
executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(lastIt.currentFrame()));
-
2455 QTextLayout *layout = block.layout();
executed (the execution status of this line is deduced): QTextLayout *layout = block.layout();
-
2456 -
2457 QFixed height = QFixed::fromReal(layout->lineAt(0).height());
executed (the execution status of this line is deduced): QFixed height = QFixed::fromReal(layout->lineAt(0).height());
-
2458 -
2459 if (layoutStruct->pageBottom == origPageBottom) {
partially evaluated: layoutStruct->pageBottom == origPageBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2460 layoutStruct->y -= height;
never executed (the execution status of this line is deduced): layoutStruct->y -= height;
-
2461 layout->setPosition(layout->position() - QPointF(0, height.toReal()));
never executed (the execution status of this line is deduced): layout->setPosition(layout->position() - QPointF(0, height.toReal()));
-
2462 } else {
never executed: }
0
2463 // relayout block to correctly handle page breaks -
2464 layoutStruct->y = origY - height;
executed (the execution status of this line is deduced): layoutStruct->y = origY - height;
-
2465 layoutStruct->pageBottom = origPageBottom;
executed (the execution status of this line is deduced): layoutStruct->pageBottom = origPageBottom;
-
2466 layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
executed (the execution status of this line is deduced): layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
-
2467 }
executed: }
Execution Count:1
1
2468 -
2469 QPointF linePos((td->position.x + td->size.width).toReal(),
executed (the execution status of this line is deduced): QPointF linePos((td->position.x + td->size.width).toReal(),
-
2470 (td->position.y + td->size.height - height).toReal());
executed (the execution status of this line is deduced): (td->position.y + td->size.height - height).toReal());
-
2471 -
2472 layout->lineAt(0).setPosition(linePos - layout->position());
executed (the execution status of this line is deduced): layout->lineAt(0).setPosition(linePos - layout->position());
-
2473 }
executed: }
Execution Count:1
1
2474 -
2475 if (blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)
partially evaluated: blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3615
0-3615
2476 layoutStruct->newPage();
never executed: layoutStruct->newPage();
0
2477 }
executed: }
Execution Count:3615
3615
2478 -
2479 maximumBlockWidth = qMax(maximumBlockWidth, layoutStruct->maximumWidth);
executed (the execution status of this line is deduced): maximumBlockWidth = qMax(maximumBlockWidth, layoutStruct->maximumWidth);
-
2480 layoutStruct->maximumWidth = origMaximumWidth;
executed (the execution status of this line is deduced): layoutStruct->maximumWidth = origMaximumWidth;
-
2481 previousBlockFormat = blockFormat;
executed (the execution status of this line is deduced): previousBlockFormat = blockFormat;
-
2482 }
executed: }
Execution Count:3642
3642
2483 } -
2484 if (layoutStruct->maximumWidth == QFIXED_MAX && maximumBlockWidth > 0)
evaluated: layoutStruct->maximumWidth == (2147483647/256)
TRUEFALSE
yes
Evaluation Count:2743
yes
Evaluation Count:27
evaluated: maximumBlockWidth > 0
TRUEFALSE
yes
Evaluation Count:624
yes
Evaluation Count:2119
27-2743
2485 layoutStruct->maximumWidth = maximumBlockWidth;
executed: layoutStruct->maximumWidth = maximumBlockWidth;
Execution Count:624
624
2486 else -
2487 layoutStruct->maximumWidth = qMax(layoutStruct->maximumWidth, maximumBlockWidth);
executed: layoutStruct->maximumWidth = qMax(layoutStruct->maximumWidth, maximumBlockWidth);
Execution Count:2146
2146
2488 -
2489 // a float at the bottom of a frame may make it taller, hence the qMax() for layoutStruct->y. -
2490 // we don't need to do it for tables though because floats in tables are per table -
2491 // and not per cell and layoutCell already takes care of doing the same as we do here -
2492 if (!qobject_cast<QTextTable *>(layoutStruct->frame)) {
evaluated: !qobject_cast<QTextTable *>(layoutStruct->frame)
TRUEFALSE
yes
Evaluation Count:1940
yes
Evaluation Count:830
830-1940
2493 QList<QTextFrame *> children = layoutStruct->frame->childFrames();
executed (the execution status of this line is deduced): QList<QTextFrame *> children = layoutStruct->frame->childFrames();
-
2494 for (int i = 0; i < children.count(); ++i) {
evaluated: i < children.count()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:1940
31-1940
2495 QTextFrameData *fd = data(children.at(i));
executed (the execution status of this line is deduced): QTextFrameData *fd = data(children.at(i));
-
2496 if (!fd->layoutDirty && children.at(i)->frameFormat().position() != QTextFrameFormat::InFlow)
evaluated: !fd->layoutDirty
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:2
evaluated: children.at(i)->frameFormat().position() != QTextFrameFormat::InFlow
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:26
2-29
2497 layoutStruct->y = qMax(layoutStruct->y, fd->position.y + fd->size.height);
executed: layoutStruct->y = qMax(layoutStruct->y, fd->position.y + fd->size.height);
Execution Count:3
3
2498 }
executed: }
Execution Count:31
31
2499 }
executed: }
Execution Count:1940
1940
2500 -
2501 if (inRootFrame) {
evaluated: inRootFrame
TRUEFALSE
yes
Evaluation Count:1940
yes
Evaluation Count:830
830-1940
2502 // we assume that any float is aligned in a way that disallows the optimizations that rely -
2503 // on unaligned content. -
2504 if (!fd->floats.isEmpty())
evaluated: !fd->floats.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1937
3-1937
2505 contentHasAlignment = true;
executed: contentHasAlignment = true;
Execution Count:3
3
2506 -
2507 if (it.atEnd()) {
evaluated: it.atEnd()
TRUEFALSE
yes
Evaluation Count:1919
yes
Evaluation Count:21
21-1919
2508 //qDebug() << "layout done!"; -
2509 currentLazyLayoutPosition = -1;
executed (the execution status of this line is deduced): currentLazyLayoutPosition = -1;
-
2510 QCheckPoint cp;
executed (the execution status of this line is deduced): QCheckPoint cp;
-
2511 cp.y = layoutStruct->y;
executed (the execution status of this line is deduced): cp.y = layoutStruct->y;
-
2512 cp.positionInFrame = docPrivate->length();
executed (the execution status of this line is deduced): cp.positionInFrame = docPrivate->length();
-
2513 cp.minimumWidth = layoutStruct->minimumWidth;
executed (the execution status of this line is deduced): cp.minimumWidth = layoutStruct->minimumWidth;
-
2514 cp.maximumWidth = layoutStruct->maximumWidth;
executed (the execution status of this line is deduced): cp.maximumWidth = layoutStruct->maximumWidth;
-
2515 cp.contentsWidth = layoutStruct->contentsWidth;
executed (the execution status of this line is deduced): cp.contentsWidth = layoutStruct->contentsWidth;
-
2516 checkPoints.append(cp);
executed (the execution status of this line is deduced): checkPoints.append(cp);
-
2517 checkPoints.reserve(checkPoints.size());
executed (the execution status of this line is deduced): checkPoints.reserve(checkPoints.size());
-
2518 } else {
executed: }
Execution Count:1919
1919
2519 currentLazyLayoutPosition = checkPoints.last().positionInFrame;
executed (the execution status of this line is deduced): currentLazyLayoutPosition = checkPoints.last().positionInFrame;
-
2520 // ####### -
2521 //checkPoints.last().positionInFrame = q->document()->docHandle()->length(); -
2522 }
executed: }
Execution Count:21
21
2523 } -
2524 -
2525 -
2526 fd->currentLayoutStruct = 0;
executed (the execution status of this line is deduced): fd->currentLayoutStruct = 0;
-
2527}
executed: }
Execution Count:2770
2770
2528 -
2529static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling, -
2530 QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight) -
2531{ -
2532 *lineHeight = QFixed::fromReal(blockFormat.lineHeight(line.height(), scaling));
executed (the execution status of this line is deduced): *lineHeight = QFixed::fromReal(blockFormat.lineHeight(line.height(), scaling));
-
2533 -
2534 if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::MinimumHeight) {
partially evaluated: blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29597
partially evaluated: blockFormat.lineHeightType() == QTextBlockFormat::MinimumHeight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29597
0-29597
2535 *lineBreakHeight = *lineHeight;
never executed (the execution status of this line is deduced): *lineBreakHeight = *lineHeight;
-
2536 if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight)
never evaluated: blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight
0
2537 *lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), qreal(0.0))) - ((*lineHeight * 4) / 5);
never executed: *lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), qreal(0.0))) - ((*lineHeight * 4) / 5);
0
2538 else -
2539 *lineAdjustment = QFixed::fromReal(line.height()) - *lineHeight;
never executed: *lineAdjustment = QFixed::fromReal(line.height()) - *lineHeight;
0
2540 } -
2541 else { -
2542 *lineBreakHeight = QFixed::fromReal(line.height());
executed (the execution status of this line is deduced): *lineBreakHeight = QFixed::fromReal(line.height());
-
2543 *lineAdjustment = 0;
executed (the execution status of this line is deduced): *lineAdjustment = 0;
-
2544 }
executed: }
Execution Count:29597
29597
2545} -
2546 -
2547void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat, -
2548 QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat) -
2549{ -
2550 Q_Q(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayout * const q = q_func();
-
2551 -
2552 QTextLayout *tl = bl.layout();
executed (the execution status of this line is deduced): QTextLayout *tl = bl.layout();
-
2553 const int blockLength = bl.length();
executed (the execution status of this line is deduced): const int blockLength = bl.length();
-
2554 -
2555 LDEBUG << "layoutBlock from=" << layoutFrom << "to=" << layoutTo;
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2555, __PRETTY_FUNCTION__).debug() << "layoutBlock from=" << layoutFrom << "to=" << layoutTo;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3643
0-3643
2556 -
2557// qDebug() << "layoutBlock; width" << layoutStruct->x_right - layoutStruct->x_left << "(maxWidth is btw" << tl->maximumWidth() << ')'; -
2558 -
2559 if (previousBlockFormat) {
evaluated: previousBlockFormat
TRUEFALSE
yes
Evaluation Count:846
yes
Evaluation Count:2797
846-2797
2560 qreal margin = qMax(blockFormat.topMargin(), previousBlockFormat->bottomMargin());
executed (the execution status of this line is deduced): qreal margin = qMax(blockFormat.topMargin(), previousBlockFormat->bottomMargin());
-
2561 if (margin > 0 && q->paintDevice()) {
evaluated: margin > 0
TRUEFALSE
yes
Evaluation Count:814
yes
Evaluation Count:32
evaluated: q->paintDevice()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:793
21-814
2562 margin *= qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi());
executed (the execution status of this line is deduced): margin *= qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi());
-
2563 }
executed: }
Execution Count:21
21
2564 layoutStruct->y += QFixed::fromReal(margin);
executed (the execution status of this line is deduced): layoutStruct->y += QFixed::fromReal(margin);
-
2565 }
executed: }
Execution Count:846
846
2566 -
2567 //QTextFrameData *fd = data(layoutStruct->frame); -
2568 -
2569 Qt::LayoutDirection dir = bl.textDirection();
executed (the execution status of this line is deduced): Qt::LayoutDirection dir = bl.textDirection();
-
2570 -
2571 QFixed extraMargin;
executed (the execution status of this line is deduced): QFixed extraMargin;
-
2572 if (docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
partially evaluated: docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3643
0-3643
2573 QFontMetricsF fm(bl.charFormat().font());
never executed (the execution status of this line is deduced): QFontMetricsF fm(bl.charFormat().font());
-
2574 extraMargin = QFixed::fromReal(fm.width(QChar(QChar(0x21B5))));
never executed (the execution status of this line is deduced): extraMargin = QFixed::fromReal(fm.width(QChar(QChar(0x21B5))));
-
2575 }
never executed: }
0
2576 -
2577 const QFixed indent = this->blockIndent(blockFormat);
executed (the execution status of this line is deduced): const QFixed indent = this->blockIndent(blockFormat);
-
2578 const QFixed totalLeftMargin = QFixed::fromReal(blockFormat.leftMargin()) + (dir == Qt::RightToLeft ? extraMargin : indent);
partially evaluated: dir == Qt::RightToLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3643
0-3643
2579 const QFixed totalRightMargin = QFixed::fromReal(blockFormat.rightMargin()) + (dir == Qt::RightToLeft ? indent : extraMargin);
partially evaluated: dir == Qt::RightToLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3643
0-3643
2580 -
2581 const QPointF oldPosition = tl->position();
executed (the execution status of this line is deduced): const QPointF oldPosition = tl->position();
-
2582 tl->setPosition(QPointF(layoutStruct->x_left.toReal(), layoutStruct->y.toReal()));
executed (the execution status of this line is deduced): tl->setPosition(QPointF(layoutStruct->x_left.toReal(), layoutStruct->y.toReal()));
-
2583 -
2584 if (layoutStruct->fullLayout
evaluated: layoutStruct->fullLayout
TRUEFALSE
yes
Evaluation Count:2483
yes
Evaluation Count:1160
1160-2483
2585 || (blockPosition + blockLength > layoutFrom && blockPosition <= layoutTo)
evaluated: blockPosition + blockLength > layoutFrom
TRUEFALSE
yes
Evaluation Count:1142
yes
Evaluation Count:18
evaluated: blockPosition <= layoutTo
TRUEFALSE
yes
Evaluation Count:1130
yes
Evaluation Count:12
12-1142
2586 // force relayout if we cross a page boundary
executed (the execution status of this line is deduced):
-
2587 || (layoutStruct->pageHeight != QFIXED_MAX && layoutStruct->absoluteY() + QFixed::fromReal(tl->boundingRect().height()) > layoutStruct->pageBottom)) {
partially evaluated: layoutStruct->pageHeight != (2147483647/256)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
never evaluated: layoutStruct->absoluteY() + QFixed::fromReal(tl->boundingRect().height()) > layoutStruct->pageBottom
0-30
2588 -
2589 LDEBUG << " do layout";
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2589, __PRETTY_FUNCTION__).debug() << " do layout";
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3613
0-3613
2590 QTextOption option = docPrivate->defaultTextOption;
executed (the execution status of this line is deduced): QTextOption option = docPrivate->defaultTextOption;
-
2591 option.setTextDirection(dir);
executed (the execution status of this line is deduced): option.setTextDirection(dir);
-
2592 option.setTabs( blockFormat.tabPositions() );
executed (the execution status of this line is deduced): option.setTabs( blockFormat.tabPositions() );
-
2593 -
2594 Qt::Alignment align = docPrivate->defaultTextOption.alignment();
executed (the execution status of this line is deduced): Qt::Alignment align = docPrivate->defaultTextOption.alignment();
-
2595 if (blockFormat.hasProperty(QTextFormat::BlockAlignment))
evaluated: blockFormat.hasProperty(QTextFormat::BlockAlignment)
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:3587
26-3587
2596 align = blockFormat.alignment();
executed: align = blockFormat.alignment();
Execution Count:26
26
2597 option.setAlignment(QGuiApplicationPrivate::visualAlignment(dir, align)); // for paragraph that are RTL, alignment is auto-reversed;
executed (the execution status of this line is deduced): option.setAlignment(QGuiApplicationPrivate::visualAlignment(dir, align));
-
2598 -
2599 if (blockFormat.nonBreakableLines() || document->pageSize().width() < 0) {
partially evaluated: blockFormat.nonBreakableLines()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3613
evaluated: document->pageSize().width() < 0
TRUEFALSE
yes
Evaluation Count:1718
yes
Evaluation Count:1895
0-3613
2600 option.setWrapMode(QTextOption::ManualWrap);
executed (the execution status of this line is deduced): option.setWrapMode(QTextOption::ManualWrap);
-
2601 }
executed: }
Execution Count:1718
1718
2602 -
2603 tl->setTextOption(option);
executed (the execution status of this line is deduced): tl->setTextOption(option);
-
2604 -
2605 const bool haveWordOrAnyWrapMode = (option.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere);
executed (the execution status of this line is deduced): const bool haveWordOrAnyWrapMode = (option.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere);
-
2606 -
2607// qDebug() << " layouting block at" << bl.position(); -
2608 const QFixed cy = layoutStruct->y;
executed (the execution status of this line is deduced): const QFixed cy = layoutStruct->y;
-
2609 const QFixed l = layoutStruct->x_left + totalLeftMargin;
executed (the execution status of this line is deduced): const QFixed l = layoutStruct->x_left + totalLeftMargin;
-
2610 const QFixed r = layoutStruct->x_right - totalRightMargin;
executed (the execution status of this line is deduced): const QFixed r = layoutStruct->x_right - totalRightMargin;
-
2611 -
2612 tl->beginLayout();
executed (the execution status of this line is deduced): tl->beginLayout();
-
2613 bool firstLine = true;
executed (the execution status of this line is deduced): bool firstLine = true;
-
2614 while (1) {
partially evaluated: 1
TRUEFALSE
yes
Evaluation Count:31094
no
Evaluation Count:0
0-31094
2615 QTextLine line = tl->createLine();
executed (the execution status of this line is deduced): QTextLine line = tl->createLine();
-
2616 if (!line.isValid())
evaluated: !line.isValid()
TRUEFALSE
yes
Evaluation Count:3613
yes
Evaluation Count:27481
3613-27481
2617 break;
executed: break;
Execution Count:3613
3613
2618 line.setLeadingIncluded(true);
executed (the execution status of this line is deduced): line.setLeadingIncluded(true);
-
2619 -
2620 QFixed left, right;
executed (the execution status of this line is deduced): QFixed left, right;
-
2621 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2622 left = qMax(left, l);
executed (the execution status of this line is deduced): left = qMax(left, l);
-
2623 right = qMin(right, r);
executed (the execution status of this line is deduced): right = qMin(right, r);
-
2624 QFixed text_indent;
executed (the execution status of this line is deduced): QFixed text_indent;
-
2625 if (firstLine) {
evaluated: firstLine
TRUEFALSE
yes
Evaluation Count:3613
yes
Evaluation Count:23868
3613-23868
2626 text_indent = QFixed::fromReal(blockFormat.textIndent());
executed (the execution status of this line is deduced): text_indent = QFixed::fromReal(blockFormat.textIndent());
-
2627 if (dir == Qt::LeftToRight)
partially evaluated: dir == Qt::LeftToRight
TRUEFALSE
yes
Evaluation Count:3613
no
Evaluation Count:0
0-3613
2628 left += text_indent;
executed: left += text_indent;
Execution Count:3613
3613
2629 else -
2630 right -= text_indent;
never executed: right -= text_indent;
0
2631 firstLine = false;
executed (the execution status of this line is deduced): firstLine = false;
-
2632 }
executed: }
Execution Count:3613
3613
2633// qDebug() << "layout line y=" << currentYPos << "left=" << left << "right=" <<right; -
2634 -
2635 if (fixedColumnWidth != -1)
partially evaluated: fixedColumnWidth != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27481
0-27481
2636 line.setNumColumns(fixedColumnWidth, (right - left).toReal());
never executed: line.setNumColumns(fixedColumnWidth, (right - left).toReal());
0
2637 else -
2638 line.setLineWidth((right - left).toReal());
executed: line.setLineWidth((right - left).toReal());
Execution Count:27481
27481
2639 -
2640// qDebug() << "layoutBlock; layouting line with width" << right - left << "->textWidth" << line.textWidth(); -
2641 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2642 left = qMax(left, l);
executed (the execution status of this line is deduced): left = qMax(left, l);
-
2643 right = qMin(right, r);
executed (the execution status of this line is deduced): right = qMin(right, r);
-
2644 if (dir == Qt::LeftToRight)
partially evaluated: dir == Qt::LeftToRight
TRUEFALSE
yes
Evaluation Count:27481
no
Evaluation Count:0
0-27481
2645 left += text_indent;
executed: left += text_indent;
Execution Count:27481
27481
2646 else -
2647 right -= text_indent;
never executed: right -= text_indent;
0
2648 -
2649 if (fixedColumnWidth == -1 && QFixed::fromReal(line.naturalTextWidth()) > right-left) {
partially evaluated: fixedColumnWidth == -1
TRUEFALSE
yes
Evaluation Count:27481
no
Evaluation Count:0
evaluated: QFixed::fromReal(line.naturalTextWidth()) > right-left
TRUEFALSE
yes
Evaluation Count:2673
yes
Evaluation Count:24808
0-27481
2650 // float has been added in the meantime, redo -
2651 layoutStruct->pendingFloats.clear();
executed (the execution status of this line is deduced): layoutStruct->pendingFloats.clear();
-
2652 -
2653 line.setLineWidth((right-left).toReal());
executed (the execution status of this line is deduced): line.setLineWidth((right-left).toReal());
-
2654 if (QFixed::fromReal(line.naturalTextWidth()) > right-left) {
evaluated: QFixed::fromReal(line.naturalTextWidth()) > right-left
TRUEFALSE
yes
Evaluation Count:2672
yes
Evaluation Count:1
1-2672
2655 if (haveWordOrAnyWrapMode) {
evaluated: haveWordOrAnyWrapMode
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2670
2-2670
2656 option.setWrapMode(QTextOption::WrapAnywhere);
executed (the execution status of this line is deduced): option.setWrapMode(QTextOption::WrapAnywhere);
-
2657 tl->setTextOption(option);
executed (the execution status of this line is deduced): tl->setTextOption(option);
-
2658 }
executed: }
Execution Count:2
2
2659 -
2660 layoutStruct->pendingFloats.clear();
executed (the execution status of this line is deduced): layoutStruct->pendingFloats.clear();
-
2661 // lines min width more than what we have -
2662 layoutStruct->y = findY(layoutStruct->y, layoutStruct, QFixed::fromReal(line.naturalTextWidth()));
executed (the execution status of this line is deduced): layoutStruct->y = findY(layoutStruct->y, layoutStruct, QFixed::fromReal(line.naturalTextWidth()));
-
2663 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2664 left = qMax(left, l);
executed (the execution status of this line is deduced): left = qMax(left, l);
-
2665 right = qMin(right, r);
executed (the execution status of this line is deduced): right = qMin(right, r);
-
2666 if (dir == Qt::LeftToRight)
partially evaluated: dir == Qt::LeftToRight
TRUEFALSE
yes
Evaluation Count:2672
no
Evaluation Count:0
0-2672
2667 left += text_indent;
executed: left += text_indent;
Execution Count:2672
2672
2668 else -
2669 right -= text_indent;
never executed: right -= text_indent;
0
2670 line.setLineWidth(qMax<qreal>(line.naturalTextWidth(), (right-left).toReal()));
executed (the execution status of this line is deduced): line.setLineWidth(qMax<qreal>(line.naturalTextWidth(), (right-left).toReal()));
-
2671 -
2672 if (haveWordOrAnyWrapMode) {
evaluated: haveWordOrAnyWrapMode
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2670
2-2670
2673 option.setWrapMode(QTextOption::WordWrap);
executed (the execution status of this line is deduced): option.setWrapMode(QTextOption::WordWrap);
-
2674 tl->setTextOption(option);
executed (the execution status of this line is deduced): tl->setTextOption(option);
-
2675 }
executed: }
Execution Count:2
2
2676 }
executed: }
Execution Count:2672
2672
2677 -
2678 }
executed: }
Execution Count:2673
2673
2679 -
2680 QFixed lineBreakHeight, lineHeight, lineAdjustment;
executed (the execution status of this line is deduced): QFixed lineBreakHeight, lineHeight, lineAdjustment;
-
2681 qreal scaling = (q->paintDevice() && q->paintDevice()->logicalDpiY() != qt_defaultDpi()) ?
evaluated: q->paintDevice()
TRUEFALSE
yes
Evaluation Count:22261
yes
Evaluation Count:5220
partially evaluated: q->paintDevice()->logicalDpiY() != qt_defaultDpi()
TRUEFALSE
yes
Evaluation Count:22261
no
Evaluation Count:0
0-22261
2682 qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1;
executed (the execution status of this line is deduced): qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1;
-
2683 getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight);
executed (the execution status of this line is deduced): getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight);
-
2684 -
2685 if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom) {
partially evaluated: layoutStruct->pageHeight > 0
TRUEFALSE
yes
Evaluation Count:27481
no
Evaluation Count:0
evaluated: layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:27477
0-27481
2686 layoutStruct->newPage();
executed (the execution status of this line is deduced): layoutStruct->newPage();
-
2687 -
2688 floatMargins(layoutStruct->y, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(layoutStruct->y, layoutStruct, &left, &right);
-
2689 left = qMax(left, l);
executed (the execution status of this line is deduced): left = qMax(left, l);
-
2690 right = qMin(right, r);
executed (the execution status of this line is deduced): right = qMin(right, r);
-
2691 if (dir == Qt::LeftToRight)
partially evaluated: dir == Qt::LeftToRight
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2692 left += text_indent;
executed: left += text_indent;
Execution Count:4
4
2693 else -
2694 right -= text_indent;
never executed: right -= text_indent;
0
2695 } -
2696 -
2697 line.setPosition(QPointF((left - layoutStruct->x_left).toReal(), (layoutStruct->y - cy - lineAdjustment).toReal()));
executed (the execution status of this line is deduced): line.setPosition(QPointF((left - layoutStruct->x_left).toReal(), (layoutStruct->y - cy - lineAdjustment).toReal()));
-
2698 layoutStruct->y += lineHeight;
executed (the execution status of this line is deduced): layoutStruct->y += lineHeight;
-
2699 layoutStruct->contentsWidth
executed (the execution status of this line is deduced): layoutStruct->contentsWidth
-
2700 = qMax<QFixed>(layoutStruct->contentsWidth, QFixed::fromReal(line.x() + line.naturalTextWidth()) + totalRightMargin);
executed (the execution status of this line is deduced): = qMax<QFixed>(layoutStruct->contentsWidth, QFixed::fromReal(line.x() + line.naturalTextWidth()) + totalRightMargin);
-
2701 -
2702 // position floats -
2703 for (int i = 0; i < layoutStruct->pendingFloats.size(); ++i) {
partially evaluated: i < layoutStruct->pendingFloats.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27481
0-27481
2704 QTextFrame *f = layoutStruct->pendingFloats.at(i);
never executed (the execution status of this line is deduced): QTextFrame *f = layoutStruct->pendingFloats.at(i);
-
2705 positionFloat(f);
never executed (the execution status of this line is deduced): positionFloat(f);
-
2706 }
never executed: }
0
2707 layoutStruct->pendingFloats.clear();
executed (the execution status of this line is deduced): layoutStruct->pendingFloats.clear();
-
2708 }
executed: }
Execution Count:27481
27481
2709 tl->endLayout();
executed (the execution status of this line is deduced): tl->endLayout();
-
2710 } else {
executed: }
Execution Count:3613
3613
2711 const int cnt = tl->lineCount();
executed (the execution status of this line is deduced): const int cnt = tl->lineCount();
-
2712 for (int i = 0; i < cnt; ++i) {
evaluated: i < cnt
TRUEFALSE
yes
Evaluation Count:2116
yes
Evaluation Count:30
30-2116
2713 LDEBUG << "going to move text line" << i;
never executed: QMessageLogger("text/qtextdocumentlayout.cpp", 2713, __PRETTY_FUNCTION__).debug() << "going to move text line" << i;
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2116
0-2116
2714 QTextLine line = tl->lineAt(i);
executed (the execution status of this line is deduced): QTextLine line = tl->lineAt(i);
-
2715 layoutStruct->contentsWidth
executed (the execution status of this line is deduced): layoutStruct->contentsWidth
-
2716 = qMax(layoutStruct->contentsWidth, QFixed::fromReal(line.x() + tl->lineAt(i).naturalTextWidth()) + totalRightMargin);
executed (the execution status of this line is deduced): = qMax(layoutStruct->contentsWidth, QFixed::fromReal(line.x() + tl->lineAt(i).naturalTextWidth()) + totalRightMargin);
-
2717 -
2718 QFixed lineBreakHeight, lineHeight, lineAdjustment;
executed (the execution status of this line is deduced): QFixed lineBreakHeight, lineHeight, lineAdjustment;
-
2719 qreal scaling = (q->paintDevice() && q->paintDevice()->logicalDpiY() != qt_defaultDpi()) ?
evaluated: q->paintDevice()
TRUEFALSE
yes
Evaluation Count:2088
yes
Evaluation Count:28
partially evaluated: q->paintDevice()->logicalDpiY() != qt_defaultDpi()
TRUEFALSE
yes
Evaluation Count:2088
no
Evaluation Count:0
0-2088
2720 qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1;
executed (the execution status of this line is deduced): qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1;
-
2721 getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight);
executed (the execution status of this line is deduced): getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight);
-
2722 -
2723 if (layoutStruct->pageHeight != QFIXED_MAX) {
partially evaluated: layoutStruct->pageHeight != (2147483647/256)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2116
0-2116
2724 if (layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom)
never evaluated: layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom
0
2725 layoutStruct->newPage();
never executed: layoutStruct->newPage();
0
2726 line.setPosition(QPointF(line.position().x(), (layoutStruct->y - lineAdjustment).toReal() - tl->position().y()));
never executed (the execution status of this line is deduced): line.setPosition(QPointF(line.position().x(), (layoutStruct->y - lineAdjustment).toReal() - tl->position().y()));
-
2727 }
never executed: }
0
2728 layoutStruct->y += lineHeight;
executed (the execution status of this line is deduced): layoutStruct->y += lineHeight;
-
2729 }
executed: }
Execution Count:2116
2116
2730 if (layoutStruct->updateRect.isValid()
partially evaluated: layoutStruct->updateRect.isValid()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
2731 && blockLength > 1) {
evaluated: blockLength > 1
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:18
12-18
2732 if (layoutFrom >= blockPosition + blockLength) {
evaluated: layoutFrom >= blockPosition + blockLength
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
2733 // if our height didn't change and the change in the document is -
2734 // in one of the later paragraphs, then we don't need to repaint -
2735 // this one -
2736 layoutStruct->updateRect.setTop(qMax(layoutStruct->updateRect.top(), layoutStruct->y.toReal()));
executed (the execution status of this line is deduced): layoutStruct->updateRect.setTop(qMax(layoutStruct->updateRect.top(), layoutStruct->y.toReal()));
-
2737 } else if (layoutTo < blockPosition) {
executed: }
Execution Count:10
partially evaluated: layoutTo < blockPosition
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-10
2738 if (oldPosition == tl->position())
partially evaluated: oldPosition == tl->position()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2739 // if the change in the document happened earlier in the document -
2740 // and our position did /not/ change because none of the earlier paragraphs -
2741 // or frames changed their height, then we don't need to repaint -
2742 // this one -
2743 layoutStruct->updateRect.setBottom(qMin(layoutStruct->updateRect.bottom(), tl->position().y()));
executed: layoutStruct->updateRect.setBottom(qMin(layoutStruct->updateRect.bottom(), tl->position().y()));
Execution Count:2
2
2744 else -
2745 layoutStruct->updateRect.setBottom(qreal(INT_MAX)); // reset
never executed: layoutStruct->updateRect.setBottom(qreal(2147483647));
0
2746 } -
2747 } -
2748 }
executed: }
Execution Count:30
30
2749 -
2750 // ### doesn't take floats into account. would need to do it per line. but how to retrieve then? (Simon) -
2751 const QFixed margins = totalLeftMargin + totalRightMargin;
executed (the execution status of this line is deduced): const QFixed margins = totalLeftMargin + totalRightMargin;
-
2752 layoutStruct->minimumWidth = qMax(layoutStruct->minimumWidth, QFixed::fromReal(tl->minimumWidth()) + margins);
executed (the execution status of this line is deduced): layoutStruct->minimumWidth = qMax(layoutStruct->minimumWidth, QFixed::fromReal(tl->minimumWidth()) + margins);
-
2753 -
2754 const QFixed maxW = QFixed::fromReal(tl->maximumWidth()) + margins;
executed (the execution status of this line is deduced): const QFixed maxW = QFixed::fromReal(tl->maximumWidth()) + margins;
-
2755 -
2756 if (maxW > 0) {
evaluated: maxW > 0
TRUEFALSE
yes
Evaluation Count:1461
yes
Evaluation Count:2182
1461-2182
2757 if (layoutStruct->maximumWidth == QFIXED_MAX)
partially evaluated: layoutStruct->maximumWidth == (2147483647/256)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1461
0-1461
2758 layoutStruct->maximumWidth = maxW;
never executed: layoutStruct->maximumWidth = maxW;
0
2759 else -
2760 layoutStruct->maximumWidth = qMax(layoutStruct->maximumWidth, maxW);
executed: layoutStruct->maximumWidth = qMax(layoutStruct->maximumWidth, maxW);
Execution Count:1461
1461
2761 } -
2762}
executed: }
Execution Count:3643
3643
2763 -
2764void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, -
2765 QFixed *left, QFixed *right) const -
2766{ -
2767// qDebug() << "floatMargins y=" << y; -
2768 *left = layoutStruct->x_left;
executed (the execution status of this line is deduced): *left = layoutStruct->x_left;
-
2769 *right = layoutStruct->x_right;
executed (the execution status of this line is deduced): *right = layoutStruct->x_right;
-
2770 QTextFrameData *lfd = data(layoutStruct->frame);
executed (the execution status of this line is deduced): QTextFrameData *lfd = data(layoutStruct->frame);
-
2771 for (int i = 0; i < lfd->floats.size(); ++i) {
evaluated: i < lfd->floats.size()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:60389
26-60389
2772 QTextFrameData *fd = data(lfd->floats.at(i));
executed (the execution status of this line is deduced): QTextFrameData *fd = data(lfd->floats.at(i));
-
2773 if (!fd->layoutDirty) {
evaluated: !fd->layoutDirty
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:12
12-14
2774 if (fd->position.y <= y && fd->position.y + fd->size.height > y) {
partially evaluated: fd->position.y <= y
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
evaluated: fd->position.y + fd->size.height > y
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
0-14
2775// qDebug() << "adjusting with float" << f << fd->position.x()<< fd->size.width(); -
2776 if (lfd->floats.at(i)->frameFormat().position() == QTextFrameFormat::FloatLeft)
evaluated: lfd->floats.at(i)->frameFormat().position() == QTextFrameFormat::FloatLeft
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:7
5-7
2777 *left = qMax(*left, fd->position.x + fd->size.width);
executed: *left = qMax(*left, fd->position.x + fd->size.width);
Execution Count:5
5
2778 else -
2779 *right = qMin(*right, fd->position.x);
executed: *right = qMin(*right, fd->position.x);
Execution Count:7
7
2780 } -
2781 }
executed: }
Execution Count:14
14
2782 }
executed: }
Execution Count:26
26
2783// qDebug() << "floatMargins: left="<<*left<<"right="<<*right<<"y="<<y; -
2784}
executed: }
Execution Count:60389
60389
2785 -
2786QFixed QTextDocumentLayoutPrivate::findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const -
2787{ -
2788 QFixed right, left;
executed (the execution status of this line is deduced): QFixed right, left;
-
2789 requiredWidth = qMin(requiredWidth, layoutStruct->x_right - layoutStruct->x_left);
executed (the execution status of this line is deduced): requiredWidth = qMin(requiredWidth, layoutStruct->x_right - layoutStruct->x_left);
-
2790 -
2791// qDebug() << "findY:" << yFrom; -
2792 while (1) {
partially evaluated: 1
TRUEFALSE
yes
Evaluation Count:2684
no
Evaluation Count:0
0-2684
2793 floatMargins(yFrom, layoutStruct, &left, &right);
executed (the execution status of this line is deduced): floatMargins(yFrom, layoutStruct, &left, &right);
-
2794// qDebug() << " yFrom=" << yFrom<<"right=" << right << "left=" << left << "requiredWidth=" << requiredWidth; -
2795 if (right-left >= requiredWidth)
evaluated: right-left >= requiredWidth
TRUEFALSE
yes
Evaluation Count:2683
yes
Evaluation Count:1
1-2683
2796 break;
executed: break;
Execution Count:2683
2683
2797 -
2798 // move float down until we find enough space -
2799 QFixed newY = QFIXED_MAX;
executed (the execution status of this line is deduced): QFixed newY = (2147483647/256);
-
2800 QTextFrameData *lfd = data(layoutStruct->frame);
executed (the execution status of this line is deduced): QTextFrameData *lfd = data(layoutStruct->frame);
-
2801 for (int i = 0; i < lfd->floats.size(); ++i) {
evaluated: i < lfd->floats.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2802 QTextFrameData *fd = data(lfd->floats.at(i));
executed (the execution status of this line is deduced): QTextFrameData *fd = data(lfd->floats.at(i));
-
2803 if (!fd->layoutDirty) {
partially evaluated: !fd->layoutDirty
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2804 if (fd->position.y <= yFrom && fd->position.y + fd->size.height > yFrom)
partially evaluated: fd->position.y <= yFrom
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: fd->position.y + fd->size.height > yFrom
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2805 newY = qMin(newY, fd->position.y + fd->size.height);
executed: newY = qMin(newY, fd->position.y + fd->size.height);
Execution Count:1
1
2806 }
executed: }
Execution Count:1
1
2807 }
executed: }
Execution Count:1
1
2808 if (newY == QFIXED_MAX)
partially evaluated: newY == (2147483647/256)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2809 break;
never executed: break;
0
2810 yFrom = newY;
executed (the execution status of this line is deduced): yFrom = newY;
-
2811 }
executed: }
Execution Count:1
1
2812 return yFrom;
executed: return yFrom;
Execution Count:2683
2683
2813} -
2814 -
2815QTextDocumentLayout::QTextDocumentLayout(QTextDocument *doc) -
2816 : QAbstractTextDocumentLayout(*new QTextDocumentLayoutPrivate, doc) -
2817{ -
2818 registerHandler(QTextFormat::ImageObject, new QTextImageHandler(this));
executed (the execution status of this line is deduced): registerHandler(QTextFormat::ImageObject, new QTextImageHandler(this));
-
2819}
executed: }
Execution Count:314
314
2820 -
2821 -
2822void QTextDocumentLayout::draw(QPainter *painter, const PaintContext &context) -
2823{ -
2824 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
2825 QTextFrame *frame = d->document->rootFrame();
executed (the execution status of this line is deduced): QTextFrame *frame = d->document->rootFrame();
-
2826 QTextFrameData *fd = data(frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(frame);
-
2827 -
2828 if(fd->sizeDirty)
partially evaluated: fd->sizeDirty
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:298
0-298
2829 return;
never executed: return;
0
2830 -
2831 if (context.clip.isValid()) {
evaluated: context.clip.isValid()
TRUEFALSE
yes
Evaluation Count:273
yes
Evaluation Count:25
25-273
2832 d->ensureLayouted(QFixed::fromReal(context.clip.bottom()));
executed (the execution status of this line is deduced): d->ensureLayouted(QFixed::fromReal(context.clip.bottom()));
-
2833 } else {
executed: }
Execution Count:273
273
2834 d->ensureLayoutFinished();
executed (the execution status of this line is deduced): d->ensureLayoutFinished();
-
2835 }
executed: }
Execution Count:25
25
2836 -
2837 QFixed width = fd->size.width;
executed (the execution status of this line is deduced): QFixed width = fd->size.width;
-
2838 if (d->document->pageSize().width() == 0 && d->viewportRect.isValid()) {
partially evaluated: d->document->pageSize().width() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:298
never evaluated: d->viewportRect.isValid()
0-298
2839 // we're in NoWrap mode, meaning the frame should expand to the viewport -
2840 // so that backgrounds are drawn correctly -
2841 fd->size.width = qMax(width, QFixed::fromReal(d->viewportRect.right()));
never executed (the execution status of this line is deduced): fd->size.width = qMax(width, QFixed::fromReal(d->viewportRect.right()));
-
2842 }
never executed: }
0
2843 -
2844 // Make sure we conform to the root frames bounds when drawing. -
2845 d->clipRect = QRectF(fd->position.toPointF(), fd->size.toSizeF()).adjusted(fd->leftMargin.toReal(), 0, -fd->rightMargin.toReal(), 0);
executed (the execution status of this line is deduced): d->clipRect = QRectF(fd->position.toPointF(), fd->size.toSizeF()).adjusted(fd->leftMargin.toReal(), 0, -fd->rightMargin.toReal(), 0);
-
2846 d->drawFrame(QPointF(), painter, context, frame);
executed (the execution status of this line is deduced): d->drawFrame(QPointF(), painter, context, frame);
-
2847 fd->size.width = width;
executed (the execution status of this line is deduced): fd->size.width = width;
-
2848}
executed: }
Execution Count:298
298
2849 -
2850void QTextDocumentLayout::setViewport(const QRectF &viewport) -
2851{ -
2852 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
2853 d->viewportRect = viewport;
executed (the execution status of this line is deduced): d->viewportRect = viewport;
-
2854}
executed: }
Execution Count:544
544
2855 -
2856static void markFrames(QTextFrame *current, int from, int oldLength, int length) -
2857{ -
2858 int end = qMax(oldLength, length) + from;
executed (the execution status of this line is deduced): int end = qMax(oldLength, length) + from;
-
2859 -
2860 if (current->firstPosition() >= end || current->lastPosition() < from)
evaluated: current->firstPosition() >= end
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1971
partially evaluated: current->lastPosition() < from
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1971
0-1971
2861 return;
executed: return;
Execution Count:6
6
2862 -
2863 QTextFrameData *fd = data(current);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(current);
-
2864 for (int i = 0; i < fd->floats.size(); ++i) {
evaluated: i < fd->floats.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1971
1-1971
2865 QTextFrame *f = fd->floats[i];
executed (the execution status of this line is deduced): QTextFrame *f = fd->floats[i];
-
2866 if (!f) {
partially evaluated: !f
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2867 // float got removed in editing operation -
2868 fd->floats.removeAt(i);
never executed (the execution status of this line is deduced): fd->floats.removeAt(i);
-
2869 --i;
never executed (the execution status of this line is deduced): --i;
-
2870 }
never executed: }
0
2871 }
executed: }
Execution Count:1
1
2872 -
2873 fd->layoutDirty = true;
executed (the execution status of this line is deduced): fd->layoutDirty = true;
-
2874 fd->sizeDirty = true;
executed (the execution status of this line is deduced): fd->sizeDirty = true;
-
2875 -
2876// qDebug(" marking frame (%d--%d) as dirty", current->firstPosition(), current->lastPosition()); -
2877 QList<QTextFrame *> children = current->childFrames();
executed (the execution status of this line is deduced): QList<QTextFrame *> children = current->childFrames();
-
2878 for (int i = 0; i < children.size(); ++i)
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:1971
31-1971
2879 markFrames(children.at(i), from, oldLength, length);
executed: markFrames(children.at(i), from, oldLength, length);
Execution Count:31
31
2880}
executed: }
Execution Count:1971
1971
2881 -
2882void QTextDocumentLayout::documentChanged(int from, int oldLength, int length) -
2883{ -
2884 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
2885 -
2886 QTextBlock blockIt = document()->findBlock(from);
executed (the execution status of this line is deduced): QTextBlock blockIt = document()->findBlock(from);
-
2887 QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1));
executed (the execution status of this line is deduced): QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1));
-
2888 if (endIt.isValid())
partially evaluated: endIt.isValid()
TRUEFALSE
yes
Evaluation Count:2138
no
Evaluation Count:0
0-2138
2889 endIt = endIt.next();
executed: endIt = endIt.next();
Execution Count:2138
2138
2890 for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
evaluated: blockIt.isValid()
TRUEFALSE
yes
Evaluation Count:3313
yes
Evaluation Count:2126
evaluated: blockIt != endIt
TRUEFALSE
yes
Evaluation Count:3301
yes
Evaluation Count:12
12-3313
2891 blockIt.clearLayout();
executed: blockIt.clearLayout();
Execution Count:3301
3301
2892 -
2893 if (d->docPrivate->pageSize.isNull())
evaluated: d->docPrivate->pageSize.isNull()
TRUEFALSE
yes
Evaluation Count:194
yes
Evaluation Count:1944
194-1944
2894 return;
executed: return;
Execution Count:194
194
2895 -
2896 QRectF updateRect;
executed (the execution status of this line is deduced): QRectF updateRect;
-
2897 -
2898 d->lazyLayoutStepSize = 1000;
executed (the execution status of this line is deduced): d->lazyLayoutStepSize = 1000;
-
2899 d->sizeChangedTimer.stop();
executed (the execution status of this line is deduced): d->sizeChangedTimer.stop();
-
2900 d->insideDocumentChange = true;
executed (the execution status of this line is deduced): d->insideDocumentChange = true;
-
2901 -
2902 const int documentLength = d->docPrivate->length();
executed (the execution status of this line is deduced): const int documentLength = d->docPrivate->length();
-
2903 const bool fullLayout = (oldLength == 0 && length == documentLength);
evaluated: oldLength == 0
TRUEFALSE
yes
Evaluation Count:1400
yes
Evaluation Count:544
evaluated: length == documentLength
TRUEFALSE
yes
Evaluation Count:1383
yes
Evaluation Count:17
17-1400
2904 const bool smallChange = documentLength > 0
partially evaluated: documentLength > 0
TRUEFALSE
yes
Evaluation Count:1944
no
Evaluation Count:0
0-1944
2905 && (qMax(length, oldLength) * 100 / documentLength) < 5;
evaluated: (qMax(length, oldLength) * 100 / documentLength) < 5
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1937
7-1937
2906 -
2907 // don't show incremental layout progress (avoid scroll bar flicker) -
2908 // if we see only a small change in the document and we're either starting -
2909 // a layout run or we're already in progress for that and we haven't seen -
2910 // any bigger change previously (showLayoutProgress already false) -
2911 if (smallChange
evaluated: smallChange
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1937
7-1937
2912 && (d->currentLazyLayoutPosition == -1 || d->showLayoutProgress == false))
partially evaluated: d->currentLazyLayoutPosition == -1
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
never evaluated: d->showLayoutProgress == false
0-7
2913 d->showLayoutProgress = false;
executed: d->showLayoutProgress = false;
Execution Count:7
7
2914 else -
2915 d->showLayoutProgress = true;
executed: d->showLayoutProgress = true;
Execution Count:1937
1937
2916 -
2917 if (fullLayout) {
evaluated: fullLayout
TRUEFALSE
yes
Evaluation Count:1383
yes
Evaluation Count:561
561-1383
2918 d->contentHasAlignment = false;
executed (the execution status of this line is deduced): d->contentHasAlignment = false;
-
2919 d->currentLazyLayoutPosition = 0;
executed (the execution status of this line is deduced): d->currentLazyLayoutPosition = 0;
-
2920 d->checkPoints.clear();
executed (the execution status of this line is deduced): d->checkPoints.clear();
-
2921 d->layoutStep();
executed (the execution status of this line is deduced): d->layoutStep();
-
2922 } else {
executed: }
Execution Count:1383
1383
2923 d->ensureLayoutedByPosition(from);
executed (the execution status of this line is deduced): d->ensureLayoutedByPosition(from);
-
2924 updateRect = doLayout(from, oldLength, length);
executed (the execution status of this line is deduced): updateRect = doLayout(from, oldLength, length);
-
2925 }
executed: }
Execution Count:561
561
2926 -
2927 if (!d->layoutTimer.isActive() && d->currentLazyLayoutPosition != -1)
evaluated: !d->layoutTimer.isActive()
TRUEFALSE
yes
Evaluation Count:1930
yes
Evaluation Count:14
evaluated: d->currentLazyLayoutPosition != -1
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1923
7-1930
2928 d->layoutTimer.start(10, this);
executed: d->layoutTimer.start(10, this);
Execution Count:7
7
2929 -
2930 d->insideDocumentChange = false;
executed (the execution status of this line is deduced): d->insideDocumentChange = false;
-
2931 -
2932 if (d->showLayoutProgress) {
partially evaluated: d->showLayoutProgress
TRUEFALSE
yes
Evaluation Count:1944
no
Evaluation Count:0
0-1944
2933 const QSizeF newSize = dynamicDocumentSize();
executed (the execution status of this line is deduced): const QSizeF newSize = dynamicDocumentSize();
-
2934 if (newSize != d->lastReportedSize) {
evaluated: newSize != d->lastReportedSize
TRUEFALSE
yes
Evaluation Count:901
yes
Evaluation Count:1043
901-1043
2935 d->lastReportedSize = newSize;
executed (the execution status of this line is deduced): d->lastReportedSize = newSize;
-
2936 emit documentSizeChanged(newSize);
executed (the execution status of this line is deduced): documentSizeChanged(newSize);
-
2937 }
executed: }
Execution Count:901
901
2938 }
executed: }
Execution Count:1944
1944
2939 -
2940 if (!updateRect.isValid()) {
evaluated: !updateRect.isValid()
TRUEFALSE
yes
Evaluation Count:1389
yes
Evaluation Count:555
555-1389
2941 // don't use the frame size, it might have shrunken -
2942 updateRect = QRectF(QPointF(0, 0), QSizeF(qreal(INT_MAX), qreal(INT_MAX)));
executed (the execution status of this line is deduced): updateRect = QRectF(QPointF(0, 0), QSizeF(qreal(2147483647), qreal(2147483647)));
-
2943 }
executed: }
Execution Count:1389
1389
2944 -
2945 emit update(updateRect);
executed (the execution status of this line is deduced): update(updateRect);
-
2946}
executed: }
Execution Count:1944
1944
2947 -
2948QRectF QTextDocumentLayout::doLayout(int from, int oldLength, int length) -
2949{ -
2950 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
2951 -
2952// qDebug("documentChange: from=%d, oldLength=%d, length=%d", from, oldLength, length); -
2953 -
2954 // mark all frames between f_start and f_end as dirty -
2955 markFrames(d->docPrivate->rootFrame(), from, oldLength, length);
executed (the execution status of this line is deduced): markFrames(d->docPrivate->rootFrame(), from, oldLength, length);
-
2956 -
2957 QRectF updateRect;
executed (the execution status of this line is deduced): QRectF updateRect;
-
2958 -
2959 QTextFrame *root = d->docPrivate->rootFrame();
executed (the execution status of this line is deduced): QTextFrame *root = d->docPrivate->rootFrame();
-
2960 if(data(root)->sizeDirty)
evaluated: data(root)->sizeDirty
TRUEFALSE
yes
Evaluation Count:1940
yes
Evaluation Count:6
6-1940
2961 updateRect = d->layoutFrame(root, from, from + length);
executed: updateRect = d->layoutFrame(root, from, from + length);
Execution Count:1940
1940
2962 data(root)->layoutDirty = false;
executed (the execution status of this line is deduced): data(root)->layoutDirty = false;
-
2963 -
2964 if (d->currentLazyLayoutPosition == -1)
evaluated: d->currentLazyLayoutPosition == -1
TRUEFALSE
yes
Evaluation Count:1925
yes
Evaluation Count:21
21-1925
2965 layoutFinished();
executed: layoutFinished();
Execution Count:1925
1925
2966 else if (d->showLayoutProgress)
partially evaluated: d->showLayoutProgress
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
2967 d->sizeChangedTimer.start(0, this);
executed: d->sizeChangedTimer.start(0, this);
Execution Count:21
21
2968 -
2969 return updateRect;
executed: return updateRect;
Execution Count:1946
1946
2970} -
2971 -
2972int QTextDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const -
2973{ -
2974 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
2975 d->ensureLayouted(QFixed::fromReal(point.y()));
executed (the execution status of this line is deduced): d->ensureLayouted(QFixed::fromReal(point.y()));
-
2976 QTextFrame *f = d->docPrivate->rootFrame();
executed (the execution status of this line is deduced): QTextFrame *f = d->docPrivate->rootFrame();
-
2977 int position = 0;
executed (the execution status of this line is deduced): int position = 0;
-
2978 QTextLayout *l = 0;
executed (the execution status of this line is deduced): QTextLayout *l = 0;
-
2979 QFixedPoint pointf;
executed (the execution status of this line is deduced): QFixedPoint pointf;
-
2980 pointf.x = QFixed::fromReal(point.x());
executed (the execution status of this line is deduced): pointf.x = QFixed::fromReal(point.x());
-
2981 pointf.y = QFixed::fromReal(point.y());
executed (the execution status of this line is deduced): pointf.y = QFixed::fromReal(point.y());
-
2982 QTextDocumentLayoutPrivate::HitPoint p = d->hitTest(f, pointf, &position, &l, accuracy);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate::HitPoint p = d->hitTest(f, pointf, &position, &l, accuracy);
-
2983 if (accuracy == Qt::ExactHit && p < QTextDocumentLayoutPrivate::PointExact)
evaluated: accuracy == Qt::ExactHit
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2
evaluated: p < QTextDocumentLayoutPrivate::PointExact
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-7
2984 return -1;
executed: return -1;
Execution Count:1
1
2985 -
2986 // ensure we stay within document bounds -
2987 int lastPos = f->lastPosition();
executed (the execution status of this line is deduced): int lastPos = f->lastPosition();
-
2988 if (l && !l->preeditAreaText().isEmpty())
partially evaluated: l
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
evaluated: !l->preeditAreaText().isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
0-8
2989 lastPos += l->preeditAreaText().length();
executed: lastPos += l->preeditAreaText().length();
Execution Count:2
2
2990 if (position > lastPos)
partially evaluated: position > lastPos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2991 position = lastPos;
never executed: position = lastPos;
0
2992 else if (position < 0)
partially evaluated: position < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2993 position = 0;
never executed: position = 0;
0
2994 -
2995 return position;
executed: return position;
Execution Count:8
8
2996} -
2997 -
2998void QTextDocumentLayout::resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) -
2999{ -
3000 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3001 QTextCharFormat f = format.toCharFormat();
executed (the execution status of this line is deduced): QTextCharFormat f = format.toCharFormat();
-
3002 Q_ASSERT(f.isValid());
executed (the execution status of this line is deduced): qt_noop();
-
3003 QTextObjectHandler handler = d->handlers.value(f.objectType());
executed (the execution status of this line is deduced): QTextObjectHandler handler = d->handlers.value(f.objectType());
-
3004 if (!handler.component)
partially evaluated: !handler.component
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
3005 return;
never executed: return;
0
3006 -
3007 QSizeF intrinsic = handler.iface->intrinsicSize(d->document, posInDocument, format);
executed (the execution status of this line is deduced): QSizeF intrinsic = handler.iface->intrinsicSize(d->document, posInDocument, format);
-
3008 -
3009 QTextFrameFormat::Position pos = QTextFrameFormat::InFlow;
executed (the execution status of this line is deduced): QTextFrameFormat::Position pos = QTextFrameFormat::InFlow;
-
3010 QTextFrame *frame = qobject_cast<QTextFrame *>(d->document->objectForFormat(f));
executed (the execution status of this line is deduced): QTextFrame *frame = qobject_cast<QTextFrame *>(d->document->objectForFormat(f));
-
3011 if (frame) {
evaluated: frame
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:6
6-10
3012 pos = frame->frameFormat().position();
executed (the execution status of this line is deduced): pos = frame->frameFormat().position();
-
3013 QTextFrameData *fd = data(frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(frame);
-
3014 fd->sizeDirty = false;
executed (the execution status of this line is deduced): fd->sizeDirty = false;
-
3015 fd->size = QFixedSize::fromSizeF(intrinsic);
executed (the execution status of this line is deduced): fd->size = QFixedSize::fromSizeF(intrinsic);
-
3016 fd->minimumWidth = fd->maximumWidth = fd->size.width;
executed (the execution status of this line is deduced): fd->minimumWidth = fd->maximumWidth = fd->size.width;
-
3017 }
executed: }
Execution Count:10
10
3018 -
3019 QSizeF inlineSize = (pos == QTextFrameFormat::InFlow ? intrinsic : QSizeF(0, 0));
evaluated: pos == QTextFrameFormat::InFlow
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:4
4-12
3020 item.setWidth(inlineSize.width());
executed (the execution status of this line is deduced): item.setWidth(inlineSize.width());
-
3021 -
3022 QFontMetrics m(f.font());
executed (the execution status of this line is deduced): QFontMetrics m(f.font());
-
3023 switch (f.verticalAlignment()) -
3024 { -
3025 case QTextCharFormat::AlignMiddle: -
3026 item.setDescent(inlineSize.height() / 2);
never executed (the execution status of this line is deduced): item.setDescent(inlineSize.height() / 2);
-
3027 item.setAscent(inlineSize.height() / 2);
never executed (the execution status of this line is deduced): item.setAscent(inlineSize.height() / 2);
-
3028 break;
never executed: break;
0
3029 case QTextCharFormat::AlignBaseline: -
3030 item.setDescent(m.descent());
never executed (the execution status of this line is deduced): item.setDescent(m.descent());
-
3031 item.setAscent(inlineSize.height() - m.descent());
never executed (the execution status of this line is deduced): item.setAscent(inlineSize.height() - m.descent());
-
3032 break;
never executed: break;
0
3033 default: -
3034 item.setDescent(0);
executed (the execution status of this line is deduced): item.setDescent(0);
-
3035 item.setAscent(inlineSize.height());
executed (the execution status of this line is deduced): item.setAscent(inlineSize.height());
-
3036 }
executed: }
Execution Count:16
16
3037}
executed: }
Execution Count:16
16
3038 -
3039void QTextDocumentLayout::positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) -
3040{ -
3041 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3042 Q_UNUSED(posInDocument);
executed (the execution status of this line is deduced): (void)posInDocument;;
-
3043 if (item.width() != 0)
evaluated: item.width() != 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
3044 // inline -
3045 return;
executed: return;
Execution Count:6
6
3046 -
3047 QTextCharFormat f = format.toCharFormat();
executed (the execution status of this line is deduced): QTextCharFormat f = format.toCharFormat();
-
3048 Q_ASSERT(f.isValid());
executed (the execution status of this line is deduced): qt_noop();
-
3049 QTextObjectHandler handler = d->handlers.value(f.objectType());
executed (the execution status of this line is deduced): QTextObjectHandler handler = d->handlers.value(f.objectType());
-
3050 if (!handler.component)
partially evaluated: !handler.component
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3051 return;
never executed: return;
0
3052 -
3053 QTextFrame *frame = qobject_cast<QTextFrame *>(d->document->objectForFormat(f));
executed (the execution status of this line is deduced): QTextFrame *frame = qobject_cast<QTextFrame *>(d->document->objectForFormat(f));
-
3054 if (!frame)
partially evaluated: !frame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3055 return;
never executed: return;
0
3056 -
3057 QTextBlock b = d->document->findBlock(frame->firstPosition());
executed (the execution status of this line is deduced): QTextBlock b = d->document->findBlock(frame->firstPosition());
-
3058 QTextLine line;
executed (the execution status of this line is deduced): QTextLine line;
-
3059 if (b.position() <= frame->firstPosition() && b.position() + b.length() > frame->lastPosition())
partially evaluated: b.position() <= frame->firstPosition()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: b.position() + b.length() > frame->lastPosition()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3060 line = b.layout()->lineAt(b.layout()->lineCount()-1);
executed: line = b.layout()->lineAt(b.layout()->lineCount()-1);
Execution Count:2
2
3061// qDebug() << "layoutObject: line.isValid" << line.isValid() << b.position() << b.length() << -
3062// frame->firstPosition() << frame->lastPosition(); -
3063 d->positionFloat(frame, line.isValid() ? &line : 0);
executed (the execution status of this line is deduced): d->positionFloat(frame, line.isValid() ? &line : 0);
-
3064}
executed: }
Execution Count:2
2
3065 -
3066void QTextDocumentLayout::drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item, -
3067 int posInDocument, const QTextFormat &format) -
3068{ -
3069 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3070 QTextCharFormat f = format.toCharFormat();
executed (the execution status of this line is deduced): QTextCharFormat f = format.toCharFormat();
-
3071 Q_ASSERT(f.isValid());
executed (the execution status of this line is deduced): qt_noop();
-
3072 QTextFrame *frame = qobject_cast<QTextFrame *>(d->document->objectForFormat(f));
executed (the execution status of this line is deduced): QTextFrame *frame = qobject_cast<QTextFrame *>(d->document->objectForFormat(f));
-
3073 if (frame && frame->frameFormat().position() != QTextFrameFormat::InFlow)
evaluated: frame
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: frame->frameFormat().position() != QTextFrameFormat::InFlow
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3074 return; // don't draw floating frames from inline objects here but in drawFlow instead
executed: return;
Execution Count:1
1
3075 -
3076// qDebug() << "drawObject at" << r; -
3077 QAbstractTextDocumentLayout::drawInlineObject(p, rect, item, posInDocument, format);
executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::drawInlineObject(p, rect, item, posInDocument, format);
-
3078}
executed: }
Execution Count:1
1
3079 -
3080int QTextDocumentLayout::dynamicPageCount() const -
3081{ -
3082 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3083 const QSizeF pgSize = d->document->pageSize();
executed (the execution status of this line is deduced): const QSizeF pgSize = d->document->pageSize();
-
3084 if (pgSize.height() < 0)
evaluated: pgSize.height() < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
3085 return 1;
executed: return 1;
Execution Count:1
1
3086 return qCeil(dynamicDocumentSize().height() / pgSize.height());
executed: return qCeil(dynamicDocumentSize().height() / pgSize.height());
Execution Count:3
3
3087} -
3088 -
3089QSizeF QTextDocumentLayout::dynamicDocumentSize() const -
3090{ -
3091 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3092 return data(d->docPrivate->rootFrame())->size.toSizeF();
executed: return data(d->docPrivate->rootFrame())->size.toSizeF();
Execution Count:2955
2955
3093} -
3094 -
3095int QTextDocumentLayout::pageCount() const -
3096{ -
3097 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3098 d->ensureLayoutFinished();
executed (the execution status of this line is deduced): d->ensureLayoutFinished();
-
3099 return dynamicPageCount();
executed: return dynamicPageCount();
Execution Count:4
4
3100} -
3101 -
3102QSizeF QTextDocumentLayout::documentSize() const -
3103{ -
3104 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3105 d->ensureLayoutFinished();
executed (the execution status of this line is deduced): d->ensureLayoutFinished();
-
3106 return dynamicDocumentSize();
executed: return dynamicDocumentSize();
Execution Count:269
269
3107} -
3108 -
3109void QTextDocumentLayoutPrivate::ensureLayouted(QFixed y) const -
3110{ -
3111 Q_Q(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayout * const q = q_func();
-
3112 if (currentLazyLayoutPosition == -1)
evaluated: currentLazyLayoutPosition == -1
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:14
14-416
3113 return;
executed: return;
Execution Count:416
416
3114 const QSizeF oldSize = q->dynamicDocumentSize();
executed (the execution status of this line is deduced): const QSizeF oldSize = q->dynamicDocumentSize();
-
3115 Q_UNUSED(oldSize);
executed (the execution status of this line is deduced): (void)oldSize;;
-
3116 -
3117 if (checkPoints.isEmpty())
partially evaluated: checkPoints.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
3118 layoutStep();
never executed: layoutStep();
0
3119 -
3120 while (currentLazyLayoutPosition != -1
partially evaluated: currentLazyLayoutPosition != -1
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
3121 && checkPoints.last().y < y)
partially evaluated: checkPoints.last().y < y
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
3122 layoutStep();
never executed: layoutStep();
0
3123}
executed: }
Execution Count:14
14
3124 -
3125void QTextDocumentLayoutPrivate::ensureLayoutedByPosition(int position) const -
3126{ -
3127 if (currentLazyLayoutPosition == -1)
evaluated: currentLazyLayoutPosition == -1
TRUEFALSE
yes
Evaluation Count:2144
yes
Evaluation Count:1395
1395-2144
3128 return;
executed: return;
Execution Count:2144
2144
3129 if (position < currentLazyLayoutPosition)
evaluated: position < currentLazyLayoutPosition
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1392
3-1392
3130 return;
executed: return;
Execution Count:3
3
3131 while (currentLazyLayoutPosition != -1
evaluated: currentLazyLayoutPosition != -1
TRUEFALSE
yes
Evaluation Count:1413
yes
Evaluation Count:1364
1364-1413
3132 && currentLazyLayoutPosition < position) {
evaluated: currentLazyLayoutPosition < position
TRUEFALSE
yes
Evaluation Count:1385
yes
Evaluation Count:28
28-1385
3133 const_cast<QTextDocumentLayout *>(q_func())->doLayout(currentLazyLayoutPosition, 0, INT_MAX - currentLazyLayoutPosition);
executed (the execution status of this line is deduced): const_cast<QTextDocumentLayout *>(q_func())->doLayout(currentLazyLayoutPosition, 0, 2147483647 - currentLazyLayoutPosition);
-
3134 }
executed: }
Execution Count:1385
1385
3135}
executed: }
Execution Count:1392
1392
3136 -
3137void QTextDocumentLayoutPrivate::layoutStep() const -
3138{ -
3139 ensureLayoutedByPosition(currentLazyLayoutPosition + lazyLayoutStepSize);
executed (the execution status of this line is deduced): ensureLayoutedByPosition(currentLazyLayoutPosition + lazyLayoutStepSize);
-
3140 lazyLayoutStepSize = qMin(200000, lazyLayoutStepSize * 2);
executed (the execution status of this line is deduced): lazyLayoutStepSize = qMin(200000, lazyLayoutStepSize * 2);
-
3141}
executed: }
Execution Count:1383
1383
3142 -
3143void QTextDocumentLayout::setCursorWidth(int width) -
3144{ -
3145 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3146 d->cursorWidth = width;
executed (the execution status of this line is deduced): d->cursorWidth = width;
-
3147}
executed: }
Execution Count:291
291
3148 -
3149int QTextDocumentLayout::cursorWidth() const -
3150{ -
3151 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3152 return d->cursorWidth;
executed: return d->cursorWidth;
Execution Count:1263
1263
3153} -
3154 -
3155void QTextDocumentLayout::setFixedColumnWidth(int width) -
3156{ -
3157 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3158 d->fixedColumnWidth = width;
executed (the execution status of this line is deduced): d->fixedColumnWidth = width;
-
3159}
executed: }
Execution Count:148
148
3160 -
3161QRectF QTextDocumentLayout::tableCellBoundingRect(QTextTable *table, const QTextTableCell &cell) const -
3162{ -
3163 if (!cell.isValid())
never evaluated: !cell.isValid()
0
3164 return QRectF();
never executed: return QRectF();
0
3165 -
3166 QTextTableData *td = static_cast<QTextTableData *>(data(table));
never executed (the execution status of this line is deduced): QTextTableData *td = static_cast<QTextTableData *>(data(table));
-
3167 -
3168 QRectF tableRect = tableBoundingRect(table);
never executed (the execution status of this line is deduced): QRectF tableRect = tableBoundingRect(table);
-
3169 QRectF cellRect = td->cellRect(cell);
never executed (the execution status of this line is deduced): QRectF cellRect = td->cellRect(cell);
-
3170 -
3171 return cellRect.translated(tableRect.topLeft());
never executed: return cellRect.translated(tableRect.topLeft());
0
3172} -
3173 -
3174QRectF QTextDocumentLayout::tableBoundingRect(QTextTable *table) const -
3175{ -
3176 Q_D(const QTextDocumentLayout);
never executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3177 if (d->docPrivate->pageSize.isNull())
never evaluated: d->docPrivate->pageSize.isNull()
0
3178 return QRectF();
never executed: return QRectF();
0
3179 d->ensureLayoutFinished();
never executed (the execution status of this line is deduced): d->ensureLayoutFinished();
-
3180 -
3181 QPointF pos;
never executed (the execution status of this line is deduced): QPointF pos;
-
3182 const int framePos = table->firstPosition();
never executed (the execution status of this line is deduced): const int framePos = table->firstPosition();
-
3183 QTextFrame *f = table;
never executed (the execution status of this line is deduced): QTextFrame *f = table;
-
3184 while (f) {
never evaluated: f
0
3185 QTextFrameData *fd = data(f);
never executed (the execution status of this line is deduced): QTextFrameData *fd = data(f);
-
3186 pos += fd->position.toPointF();
never executed (the execution status of this line is deduced): pos += fd->position.toPointF();
-
3187 -
3188 if (f != table) {
never evaluated: f != table
0
3189 if (QTextTable *table = qobject_cast<QTextTable *>(f)) {
never evaluated: QTextTable *table = qobject_cast<QTextTable *>(f)
0
3190 QTextTableCell cell = table->cellAt(framePos);
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(framePos);
-
3191 if (cell.isValid())
never evaluated: cell.isValid()
0
3192 pos += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
never executed: pos += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
0
3193 }
never executed: }
0
3194 }
never executed: }
0
3195 -
3196 f = f->parentFrame();
never executed (the execution status of this line is deduced): f = f->parentFrame();
-
3197 }
never executed: }
0
3198 return QRectF(pos, data(table)->size.toSizeF());
never executed: return QRectF(pos, data(table)->size.toSizeF());
0
3199} -
3200 -
3201QRectF QTextDocumentLayout::frameBoundingRect(QTextFrame *frame) const -
3202{ -
3203 Q_D(const QTextDocumentLayout);
never executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3204 if (d->docPrivate->pageSize.isNull())
never evaluated: d->docPrivate->pageSize.isNull()
0
3205 return QRectF();
never executed: return QRectF();
0
3206 d->ensureLayoutFinished();
never executed (the execution status of this line is deduced): d->ensureLayoutFinished();
-
3207 return d->frameBoundingRectInternal(frame);
never executed: return d->frameBoundingRectInternal(frame);
0
3208} -
3209 -
3210QRectF QTextDocumentLayoutPrivate::frameBoundingRectInternal(QTextFrame *frame) const -
3211{ -
3212 QPointF pos;
executed (the execution status of this line is deduced): QPointF pos;
-
3213 const int framePos = frame->firstPosition();
executed (the execution status of this line is deduced): const int framePos = frame->firstPosition();
-
3214 QTextFrame *f = frame;
executed (the execution status of this line is deduced): QTextFrame *f = frame;
-
3215 while (f) {
evaluated: f
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
3216 QTextFrameData *fd = data(f);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(f);
-
3217 pos += fd->position.toPointF();
executed (the execution status of this line is deduced): pos += fd->position.toPointF();
-
3218 -
3219 if (QTextTable *table = qobject_cast<QTextTable *>(f)) {
partially evaluated: QTextTable *table = qobject_cast<QTextTable *>(f)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3220 QTextTableCell cell = table->cellAt(framePos);
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(framePos);
-
3221 if (cell.isValid())
never evaluated: cell.isValid()
0
3222 pos += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
never executed: pos += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
0
3223 }
never executed: }
0
3224 -
3225 f = f->parentFrame();
executed (the execution status of this line is deduced): f = f->parentFrame();
-
3226 }
executed: }
Execution Count:2
2
3227 return QRectF(pos, data(frame)->size.toSizeF());
executed: return QRectF(pos, data(frame)->size.toSizeF());
Execution Count:1
1
3228} -
3229 -
3230QRectF QTextDocumentLayout::blockBoundingRect(const QTextBlock &block) const -
3231{ -
3232 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3233 if (d->docPrivate->pageSize.isNull() || !block.isValid())
evaluated: d->docPrivate->pageSize.isNull()
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:1284
partially evaluated: !block.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1284
0-1284
3234 return QRectF();
executed: return QRectF();
Execution Count:122
122
3235 d->ensureLayoutedByPosition(block.position() + block.length());
executed (the execution status of this line is deduced): d->ensureLayoutedByPosition(block.position() + block.length());
-
3236 QTextFrame *frame = d->document->frameAt(block.position());
executed (the execution status of this line is deduced): QTextFrame *frame = d->document->frameAt(block.position());
-
3237 QPointF offset;
executed (the execution status of this line is deduced): QPointF offset;
-
3238 const int blockPos = block.position();
executed (the execution status of this line is deduced): const int blockPos = block.position();
-
3239 -
3240 while (frame) {
evaluated: frame
TRUEFALSE
yes
Evaluation Count:1285
yes
Evaluation Count:1284
1284-1285
3241 QTextFrameData *fd = data(frame);
executed (the execution status of this line is deduced): QTextFrameData *fd = data(frame);
-
3242 offset += fd->position.toPointF();
executed (the execution status of this line is deduced): offset += fd->position.toPointF();
-
3243 -
3244 if (QTextTable *table = qobject_cast<QTextTable *>(frame)) {
evaluated: QTextTable *table = qobject_cast<QTextTable *>(frame)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1284
1-1284
3245 QTextTableCell cell = table->cellAt(blockPos);
executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(blockPos);
-
3246 if (cell.isValid())
partially evaluated: cell.isValid()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3247 offset += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
executed: offset += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
Execution Count:1
1
3248 }
executed: }
Execution Count:1
1
3249 -
3250 frame = frame->parentFrame();
executed (the execution status of this line is deduced): frame = frame->parentFrame();
-
3251 }
executed: }
Execution Count:1285
1285
3252 -
3253 const QTextLayout *layout = block.layout();
executed (the execution status of this line is deduced): const QTextLayout *layout = block.layout();
-
3254 QRectF rect = layout->boundingRect();
executed (the execution status of this line is deduced): QRectF rect = layout->boundingRect();
-
3255 rect.moveTopLeft(layout->position() + offset);
executed (the execution status of this line is deduced): rect.moveTopLeft(layout->position() + offset);
-
3256 return rect;
executed: return rect;
Execution Count:1284
1284
3257} -
3258 -
3259int QTextDocumentLayout::layoutStatus() const -
3260{ -
3261 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3262 int pos = d->currentLazyLayoutPosition;
executed (the execution status of this line is deduced): int pos = d->currentLazyLayoutPosition;
-
3263 if (pos == -1)
evaluated: pos == -1
TRUEFALSE
yes
Evaluation Count:408
yes
Evaluation Count:21
21-408
3264 return 100;
executed: return 100;
Execution Count:408
408
3265 return pos * 100 / d->document->docHandle()->length();
executed: return pos * 100 / d->document->docHandle()->length();
Execution Count:21
21
3266} -
3267 -
3268void QTextDocumentLayout::timerEvent(QTimerEvent *e) -
3269{ -
3270 Q_D(QTextDocumentLayout);
never executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3271 if (e->timerId() == d->layoutTimer.timerId()) {
never evaluated: e->timerId() == d->layoutTimer.timerId()
0
3272 if (d->currentLazyLayoutPosition != -1)
never evaluated: d->currentLazyLayoutPosition != -1
0
3273 d->layoutStep();
never executed: d->layoutStep();
0
3274 } else if (e->timerId() == d->sizeChangedTimer.timerId()) {
never executed: }
never evaluated: e->timerId() == d->sizeChangedTimer.timerId()
0
3275 d->lastReportedSize = dynamicDocumentSize();
never executed (the execution status of this line is deduced): d->lastReportedSize = dynamicDocumentSize();
-
3276 emit documentSizeChanged(d->lastReportedSize);
never executed (the execution status of this line is deduced): documentSizeChanged(d->lastReportedSize);
-
3277 d->sizeChangedTimer.stop();
never executed (the execution status of this line is deduced): d->sizeChangedTimer.stop();
-
3278 -
3279 if (d->currentLazyLayoutPosition == -1) {
never evaluated: d->currentLazyLayoutPosition == -1
0
3280 const int newCount = dynamicPageCount();
never executed (the execution status of this line is deduced): const int newCount = dynamicPageCount();
-
3281 if (newCount != d->lastPageCount) {
never evaluated: newCount != d->lastPageCount
0
3282 d->lastPageCount = newCount;
never executed (the execution status of this line is deduced): d->lastPageCount = newCount;
-
3283 emit pageCountChanged(newCount);
never executed (the execution status of this line is deduced): pageCountChanged(newCount);
-
3284 }
never executed: }
0
3285 }
never executed: }
0
3286 } else {
never executed: }
0
3287 QAbstractTextDocumentLayout::timerEvent(e);
never executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::timerEvent(e);
-
3288 }
never executed: }
0
3289} -
3290 -
3291void QTextDocumentLayout::layoutFinished() -
3292{ -
3293 Q_D(QTextDocumentLayout);
executed (the execution status of this line is deduced): QTextDocumentLayoutPrivate * const d = d_func();
-
3294 d->layoutTimer.stop();
executed (the execution status of this line is deduced): d->layoutTimer.stop();
-
3295 if (!d->insideDocumentChange)
evaluated: !d->insideDocumentChange
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1923
2-1923
3296 d->sizeChangedTimer.start(0, this);
executed: d->sizeChangedTimer.start(0, this);
Execution Count:2
2
3297 // reset -
3298 d->showLayoutProgress = true;
executed (the execution status of this line is deduced): d->showLayoutProgress = true;
-
3299}
executed: }
Execution Count:1925
1925
3300 -
3301void QTextDocumentLayout::ensureLayouted(qreal y) -
3302{ -
3303 d_func()->ensureLayouted(QFixed::fromReal(y));
executed (the execution status of this line is deduced): d_func()->ensureLayouted(QFixed::fromReal(y));
-
3304}
executed: }
Execution Count:148
148
3305 -
3306qreal QTextDocumentLayout::idealWidth() const -
3307{ -
3308 Q_D(const QTextDocumentLayout);
executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3309 d->ensureLayoutFinished();
executed (the execution status of this line is deduced): d->ensureLayoutFinished();
-
3310 return d->idealWidth;
executed: return d->idealWidth;
Execution Count:13
13
3311} -
3312 -
3313bool QTextDocumentLayout::contentHasAlignment() const -
3314{ -
3315 Q_D(const QTextDocumentLayout);
never executed (the execution status of this line is deduced): const QTextDocumentLayoutPrivate * const d = d_func();
-
3316 return d->contentHasAlignment;
never executed: return d->contentHasAlignment;
0
3317} -
3318 -
3319qreal QTextDocumentLayoutPrivate::scaleToDevice(qreal value) const -
3320{ -
3321 if (!paintDevice)
evaluated: !paintDevice
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:6
6-81
3322 return value;
executed: return value;
Execution Count:81
81
3323 return value * paintDevice->logicalDpiY() / qreal(qt_defaultDpi());
executed: return value * paintDevice->logicalDpiY() / qreal(qt_defaultDpi());
Execution Count:6
6
3324} -
3325 -
3326QFixed QTextDocumentLayoutPrivate::scaleToDevice(QFixed value) const -
3327{ -
3328 if (!paintDevice)
partially evaluated: !paintDevice
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
3329 return value;
executed: return value;
Execution Count:8
8
3330 return value * QFixed(paintDevice->logicalDpiY()) / QFixed(qt_defaultDpi());
never executed: return value * QFixed(paintDevice->logicalDpiY()) / QFixed(qt_defaultDpi());
0
3331} -
3332 -
3333QT_END_NAMESPACE -
3334 -
3335#include "moc_qtextdocumentlayout_p.cpp" -
3336 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial