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