| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | QRectF QTextInlineObject::rect() const | - |
| 9 | { | - |
| 10 | QScriptItem& si = eng->layoutData->items[itm]; | - |
| 11 | return QRectF(0, -si.ascent.toReal(), si.width.toReal(), si.height().toReal()); never executed: return QRectF(0, -si.ascent.toReal(), si.width.toReal(), si.height().toReal()); | 0 |
| 12 | } | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | qreal QTextInlineObject::width() const | - |
| 20 | { | - |
| 21 | return eng->layoutData->items[itm].width.toReal(); executed: return eng->layoutData->items[itm].width.toReal();Execution Count:8 | 8 |
| 22 | } | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | qreal QTextInlineObject::ascent() const | - |
| 30 | { | - |
| 31 | return eng->layoutData->items[itm].ascent.toReal(); never executed: return eng->layoutData->items[itm].ascent.toReal(); | 0 |
| 32 | } | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | qreal QTextInlineObject::descent() const | - |
| 40 | { | - |
| 41 | return eng->layoutData->items[itm].descent.toReal(); never executed: return eng->layoutData->items[itm].descent.toReal(); | 0 |
| 42 | } | - |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | | - |
| 50 | qreal QTextInlineObject::height() const | - |
| 51 | { | - |
| 52 | return eng->layoutData->items[itm].height().toReal(); never executed: return eng->layoutData->items[itm].height().toReal(); | 0 |
| 53 | } | - |
| 54 | | - |
| 55 | | - |
| 56 | | - |
| 57 | | - |
| 58 | | - |
| 59 | | - |
| 60 | void QTextInlineObject::setWidth(qreal w) | - |
| 61 | { | - |
| 62 | eng->layoutData->items[itm].width = QFixed::fromReal(w); | - |
| 63 | } executed: }Execution Count:16 | 16 |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | void QTextInlineObject::setAscent(qreal a) | - |
| 71 | { | - |
| 72 | eng->layoutData->items[itm].ascent = QFixed::fromReal(a); | - |
| 73 | } executed: }Execution Count:16 | 16 |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | void QTextInlineObject::setDescent(qreal d) | - |
| 81 | { | - |
| 82 | eng->layoutData->items[itm].descent = QFixed::fromReal(d); | - |
| 83 | } executed: }Execution Count:16 | 16 |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | int QTextInlineObject::textPosition() const | - |
| 89 | { | - |
| 90 | return eng->layoutData->items[itm].position; never executed: return eng->layoutData->items[itm].position; | 0 |
| 91 | } | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | int QTextInlineObject::formatIndex() const | - |
| 98 | { | - |
| 99 | return eng->formatIndex(&eng->layoutData->items[itm]); never executed: return eng->formatIndex(&eng->layoutData->items[itm]); | 0 |
| 100 | } | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | QTextFormat QTextInlineObject::format() const | - |
| 106 | { | - |
| 107 | if (!eng->block.docHandle()) never evaluated: !eng->block.docHandle() | 0 |
| 108 | return QTextFormat(); never executed: return QTextFormat(); | 0 |
| 109 | return eng->formats()->format(eng->formatIndex(&eng->layoutData->items[itm])); never executed: return eng->formats()->format(eng->formatIndex(&eng->layoutData->items[itm])); | 0 |
| 110 | } | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | Qt::LayoutDirection QTextInlineObject::textDirection() const | - |
| 116 | { | - |
| 117 | return (eng->layoutData->items[itm].analysis.bidiLevel % 2 ? Qt::RightToLeft : Qt::LeftToRight); never executed: return (eng->layoutData->items[itm].analysis.bidiLevel % 2 ? Qt::RightToLeft : Qt::LeftToRight); | 0 |
| 118 | } | - |
| 119 | QTextLayout::QTextLayout() | - |
| 120 | { d = new QTextEngine(); } executed: }Execution Count:1554 | 1554 |
| 121 | | - |
| 122 | | - |
| 123 | | - |
| 124 | | - |
| 125 | QTextLayout::QTextLayout(const QString& text) | - |
| 126 | { | - |
| 127 | d = new QTextEngine(); | - |
| 128 | d->text = text; | - |
| 129 | } executed: }Execution Count:210 | 210 |
| 130 | QTextLayout::QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice) | - |
| 131 | { | - |
| 132 | QFont f(font); | - |
| 133 | if (paintdevice) partially evaluated: paintdevice| no Evaluation Count:0 | yes Evaluation Count:136900 |
| 0-136900 |
| 134 | f = QFont(font, paintdevice); never executed: f = QFont(font, paintdevice); | 0 |
| 135 | d = new QTextEngine((text.isNull() ? (const QString&)QString::fromLatin1("") : text), f); | - |
| 136 | } executed: }Execution Count:136900 | 136900 |
| 137 | | - |
| 138 | | - |
| 139 | | - |
| 140 | | - |
| 141 | | - |
| 142 | QTextLayout::QTextLayout(const QTextBlock &block) | - |
| 143 | { | - |
| 144 | d = new QTextEngine(); | - |
| 145 | d->block = block; | - |
| 146 | } executed: }Execution Count:15452 | 15452 |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | | - |
| 151 | QTextLayout::~QTextLayout() | - |
| 152 | { | - |
| 153 | if (!d->stackEngine) evaluated: !d->stackEngine| yes Evaluation Count:154097 | yes Evaluation Count:35631 |
| 35631-154097 |
| 154 | delete d; executed: delete d;Execution Count:154097 | 154097 |
| 155 | } executed: }Execution Count:189728 | 189728 |
| 156 | void QTextLayout::setRawFont(const QRawFont &rawFont) | - |
| 157 | { | - |
| 158 | d->rawFont = rawFont; | - |
| 159 | d->useRawFont = true; | - |
| 160 | d->resetFontEngineCache(); | - |
| 161 | } | 0 |
| 162 | void QTextLayout::setFont(const QFont &font) | - |
| 163 | { | - |
| 164 | d->fnt = font; | - |
| 165 | | - |
| 166 | d->useRawFont = false; | - |
| 167 | | - |
| 168 | d->resetFontEngineCache(); | - |
| 169 | } executed: }Execution Count:15060 | 15060 |
| 170 | | - |
| 171 | | - |
| 172 | | - |
| 173 | | - |
| 174 | | - |
| 175 | | - |
| 176 | | - |
| 177 | QFont QTextLayout::font() const | - |
| 178 | { | - |
| 179 | return d->font(); executed: return d->font();Execution Count:28 | 28 |
| 180 | } | - |
| 181 | void QTextLayout::setText(const QString& string) | - |
| 182 | { | - |
| 183 | d->invalidate(); | - |
| 184 | d->clearLineData(); | - |
| 185 | d->text = string; | - |
| 186 | } executed: }Execution Count:24223 | 24223 |
| 187 | | - |
| 188 | | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | QString QTextLayout::text() const | - |
| 194 | { | - |
| 195 | return d->text; executed: return d->text;Execution Count:16647 | 16647 |
| 196 | } | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | | - |
| 201 | | - |
| 202 | | - |
| 203 | | - |
| 204 | void QTextLayout::setTextOption(const QTextOption &option) | - |
| 205 | { | - |
| 206 | d->option = option; | - |
| 207 | } executed: }Execution Count:165697 | 165697 |
| 208 | | - |
| 209 | | - |
| 210 | | - |
| 211 | | - |
| 212 | | - |
| 213 | | - |
| 214 | const QTextOption &QTextLayout::textOption() const | - |
| 215 | { | - |
| 216 | return d->option; executed: return d->option;Execution Count:13346 | 13346 |
| 217 | } | - |
| 218 | void QTextLayout::setPreeditArea(int position, const QString &text) | - |
| 219 | { | - |
| 220 | if (text.isEmpty()) { evaluated: text.isEmpty()| yes Evaluation Count:65 | yes Evaluation Count:4 |
| 4-65 |
| 221 | if (!d->specialData) evaluated: !d->specialData| yes Evaluation Count:64 | yes Evaluation Count:1 |
| 1-64 |
| 222 | return; executed: return;Execution Count:64 | 64 |
| 223 | if (d->specialData->addFormats.isEmpty()) { partially evaluated: d->specialData->addFormats.isEmpty()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 224 | delete d->specialData; | - |
| 225 | d->specialData = 0; | - |
| 226 | } else { executed: }Execution Count:1 | 1 |
| 227 | d->specialData->preeditText = QString(); | - |
| 228 | d->specialData->preeditPosition = -1; | - |
| 229 | } | 0 |
| 230 | } else { | - |
| 231 | if (!d->specialData) evaluated: !d->specialData| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 232 | d->specialData = new QTextEngine::SpecialData; executed: d->specialData = new QTextEngine::SpecialData;Execution Count:2 | 2 |
| 233 | d->specialData->preeditPosition = position; | - |
| 234 | d->specialData->preeditText = text; | - |
| 235 | } executed: }Execution Count:4 | 4 |
| 236 | d->invalidate(); | - |
| 237 | d->clearLineData(); | - |
| 238 | if (d->block.docHandle()) evaluated: d->block.docHandle()| yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
| 239 | d->block.docHandle()->documentChange(d->block.position(), d->block.length()); executed: d->block.docHandle()->documentChange(d->block.position(), d->block.length());Execution Count:3 | 3 |
| 240 | } executed: }Execution Count:5 | 5 |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | | - |
| 246 | | - |
| 247 | | - |
| 248 | int QTextLayout::preeditAreaPosition() const | - |
| 249 | { | - |
| 250 | return d->specialData ? d->specialData->preeditPosition : -1; executed: return d->specialData ? d->specialData->preeditPosition : -1;Execution Count:60 | 60 |
| 251 | } | - |
| 252 | | - |
| 253 | | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | QString QTextLayout::preeditAreaText() const | - |
| 259 | { | - |
| 260 | return d->specialData ? d->specialData->preeditText : QString(); executed: return d->specialData ? d->specialData->preeditText : QString();Execution Count:20756 | 20756 |
| 261 | } | - |
| 262 | void QTextLayout::setAdditionalFormats(const QList<FormatRange> &formatList) | - |
| 263 | { | - |
| 264 | if (formatList.isEmpty()) { evaluated: formatList.isEmpty()| yes Evaluation Count:67 | yes Evaluation Count:7 |
| 7-67 |
| 265 | if (!d->specialData) evaluated: !d->specialData| yes Evaluation Count:65 | yes Evaluation Count:2 |
| 2-65 |
| 266 | return; executed: return;Execution Count:65 | 65 |
| 267 | if (d->specialData->preeditText.isEmpty()) { evaluated: d->specialData->preeditText.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 268 | delete d->specialData; | - |
| 269 | d->specialData = 0; | - |
| 270 | } else { executed: }Execution Count:1 | 1 |
| 271 | d->specialData->addFormats = formatList; | - |
| 272 | d->specialData->addFormatIndices.clear(); | - |
| 273 | } executed: }Execution Count:1 | 1 |
| 274 | } else { | - |
| 275 | if (!d->specialData) { evaluated: !d->specialData| yes Evaluation Count:5 | yes Evaluation Count:2 |
| 2-5 |
| 276 | d->specialData = new QTextEngine::SpecialData; | - |
| 277 | d->specialData->preeditPosition = -1; | - |
| 278 | } executed: }Execution Count:5 | 5 |
| 279 | d->specialData->addFormats = formatList; | - |
| 280 | d->indexAdditionalFormats(); | - |
| 281 | } executed: }Execution Count:7 | 7 |
| 282 | if (d->block.docHandle()) evaluated: d->block.docHandle()| yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-8 |
| 283 | d->block.docHandle()->documentChange(d->block.position(), d->block.length()); executed: d->block.docHandle()->documentChange(d->block.position(), d->block.length());Execution Count:8 | 8 |
| 284 | d->resetFontEngineCache(); | - |
| 285 | } executed: }Execution Count:9 | 9 |
| 286 | | - |
| 287 | | - |
| 288 | | - |
| 289 | | - |
| 290 | | - |
| 291 | | - |
| 292 | QList<QTextLayout::FormatRange> QTextLayout::additionalFormats() const | - |
| 293 | { | - |
| 294 | QList<FormatRange> formats; | - |
| 295 | if (!d->specialData) evaluated: !d->specialData| yes Evaluation Count:57 | yes Evaluation Count:4 |
| 4-57 |
| 296 | return formats; executed: return formats;Execution Count:57 | 57 |
| 297 | | - |
| 298 | formats = d->specialData->addFormats; | - |
| 299 | | - |
| 300 | if (d->specialData->addFormatIndices.isEmpty()) partially evaluated: d->specialData->addFormatIndices.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 301 | return formats; never executed: return formats; | 0 |
| 302 | | - |
| 303 | const QTextFormatCollection *collection = d->formats(); | - |
| 304 | | - |
| 305 | for (int i = 0; i < d->specialData->addFormatIndices.count(); ++i) evaluated: i < d->specialData->addFormatIndices.count()| yes Evaluation Count:8 | yes Evaluation Count:4 |
| 4-8 |
| 306 | formats[i].format = collection->charFormat(d->specialData->addFormatIndices.at(i)); executed: formats[i].format = collection->charFormat(d->specialData->addFormatIndices.at(i));Execution Count:8 | 8 |
| 307 | | - |
| 308 | return formats; executed: return formats;Execution Count:4 | 4 |
| 309 | } | - |
| 310 | | - |
| 311 | | - |
| 312 | | - |
| 313 | | - |
| 314 | | - |
| 315 | | - |
| 316 | void QTextLayout::clearAdditionalFormats() | - |
| 317 | { | - |
| 318 | setAdditionalFormats(QList<FormatRange>()); | - |
| 319 | } executed: }Execution Count:1 | 1 |
| 320 | void QTextLayout::setCacheEnabled(bool enable) | - |
| 321 | { | - |
| 322 | d->cacheGlyphs = enable; | - |
| 323 | } executed: }Execution Count:36821 | 36821 |
| 324 | | - |
| 325 | | - |
| 326 | | - |
| 327 | | - |
| 328 | | - |
| 329 | | - |
| 330 | | - |
| 331 | bool QTextLayout::cacheEnabled() const | - |
| 332 | { | - |
| 333 | return d->cacheGlyphs; never executed: return d->cacheGlyphs; | 0 |
| 334 | } | - |
| 335 | void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style) | - |
| 336 | { | - |
| 337 | d->visualMovement = style == Qt::VisualMoveStyle ? true : false; evaluated: style == Qt::VisualMoveStyle| yes Evaluation Count:95 | yes Evaluation Count:8 |
| 8-95 |
| 338 | } executed: }Execution Count:103 | 103 |
| 339 | | - |
| 340 | | - |
| 341 | | - |
| 342 | | - |
| 343 | | - |
| 344 | | - |
| 345 | | - |
| 346 | Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const | - |
| 347 | { | - |
| 348 | return d->visualMovement ? Qt::VisualMoveStyle : Qt::LogicalMoveStyle; executed: return d->visualMovement ? Qt::VisualMoveStyle : Qt::LogicalMoveStyle;Execution Count:2841 | 2841 |
| 349 | } | - |
| 350 | | - |
| 351 | | - |
| 352 | | - |
| 353 | | - |
| 354 | | - |
| 355 | | - |
| 356 | void QTextLayout::beginLayout() | - |
| 357 | { | - |
| 358 | | - |
| 359 | | - |
| 360 | | - |
| 361 | | - |
| 362 | | - |
| 363 | | - |
| 364 | d->invalidate(); | - |
| 365 | d->clearLineData(); | - |
| 366 | d->itemize(); | - |
| 367 | d->layoutData->layoutState = QTextEngine::InLayout; | - |
| 368 | } executed: }Execution Count:201031 | 201031 |
| 369 | | - |
| 370 | | - |
| 371 | | - |
| 372 | | - |
| 373 | | - |
| 374 | | - |
| 375 | void QTextLayout::endLayout() | - |
| 376 | { | - |
| 377 | | - |
| 378 | | - |
| 379 | | - |
| 380 | | - |
| 381 | | - |
| 382 | | - |
| 383 | int l = d->lines.size(); | - |
| 384 | if (l && d->lines.at(l-1).length < 0) { partially evaluated: l| yes Evaluation Count:201031 | no Evaluation Count:0 |
evaluated: d->lines.at(l-1).length < 0| yes Evaluation Count:10472 | yes Evaluation Count:190559 |
| 0-201031 |
| 385 | QTextLine(l-1, d).setNumColumns(2147483647); | - |
| 386 | } executed: }Execution Count:10472 | 10472 |
| 387 | d->layoutData->layoutState = QTextEngine::LayoutEmpty; | - |
| 388 | if (!d->cacheGlyphs) evaluated: !d->cacheGlyphs| yes Evaluation Count:155170 | yes Evaluation Count:45861 |
| 45861-155170 |
| 389 | d->freeMemory(); executed: d->freeMemory();Execution Count:155170 | 155170 |
| 390 | } executed: }Execution Count:201031 | 201031 |
| 391 | | - |
| 392 | | - |
| 393 | | - |
| 394 | | - |
| 395 | | - |
| 396 | | - |
| 397 | | - |
| 398 | void QTextLayout::clearLayout() | - |
| 399 | { | - |
| 400 | d->clearLineData(); | - |
| 401 | } executed: }Execution Count:13530 | 13530 |
| 402 | int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const | - |
| 403 | { | - |
| 404 | const QCharAttributes *attributes = d->attributes(); | - |
| 405 | int len = d->block.isValid() ? d->block.length() - 1 evaluated: d->block.isValid()| yes Evaluation Count:132 | yes Evaluation Count:1375 |
| 132-1375 |
| 406 | : d->layoutData->string.length(); | - |
| 407 | qt_noop(); | - |
| 408 | if (!attributes || oldPos < 0 || oldPos >= len) evaluated: !attributes| yes Evaluation Count:4 | yes Evaluation Count:1503 |
partially evaluated: oldPos < 0| no Evaluation Count:0 | yes Evaluation Count:1503 |
evaluated: oldPos >= len| yes Evaluation Count:100 | yes Evaluation Count:1403 |
| 0-1503 |
| 409 | return oldPos; executed: return oldPos;Execution Count:104 | 104 |
| 410 | | - |
| 411 | if (mode == SkipCharacters) { evaluated: mode == SkipCharacters| yes Evaluation Count:1386 | yes Evaluation Count:17 |
| 17-1386 |
| 412 | oldPos++; | - |
| 413 | while (oldPos < len && !attributes[oldPos].graphemeBoundary) evaluated: oldPos < len| yes Evaluation Count:1266 | yes Evaluation Count:120 |
partially evaluated: !attributes[oldPos].graphemeBoundary| no Evaluation Count:0 | yes Evaluation Count:1266 |
| 0-1266 |
| 414 | oldPos++; never executed: oldPos++; | 0 |
| 415 | } else { executed: }Execution Count:1386 | 1386 |
| 416 | if (oldPos < len && d->atWordSeparator(oldPos)) { partially evaluated: oldPos < len| yes Evaluation Count:17 | no Evaluation Count:0 |
evaluated: d->atWordSeparator(oldPos)| yes Evaluation Count:1 | yes Evaluation Count:16 |
| 0-17 |
| 417 | oldPos++; | - |
| 418 | while (oldPos < len && d->atWordSeparator(oldPos)) partially evaluated: oldPos < len| yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: d->atWordSeparator(oldPos)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 0-4 |
| 419 | oldPos++; executed: oldPos++;Execution Count:3 | 3 |
| 420 | } else { executed: }Execution Count:1 | 1 |
| 421 | while (oldPos < len && !d->atSpace(oldPos) && !d->atWordSeparator(oldPos)) evaluated: oldPos < len| yes Evaluation Count:68 | yes Evaluation Count:3 |
evaluated: !d->atSpace(oldPos)| yes Evaluation Count:55 | yes Evaluation Count:13 |
partially evaluated: !d->atWordSeparator(oldPos)| yes Evaluation Count:55 | no Evaluation Count:0 |
| 0-68 |
| 422 | oldPos++; executed: oldPos++;Execution Count:55 | 55 |
| 423 | } executed: }Execution Count:16 | 16 |
| 424 | while (oldPos < len && d->atSpace(oldPos)) evaluated: oldPos < len| yes Evaluation Count:32 | yes Evaluation Count:3 |
evaluated: d->atSpace(oldPos)| yes Evaluation Count:18 | yes Evaluation Count:14 |
| 3-32 |
| 425 | oldPos++; executed: oldPos++;Execution Count:18 | 18 |
| 426 | } executed: }Execution Count:17 | 17 |
| 427 | | - |
| 428 | return oldPos; executed: return oldPos;Execution Count:1403 | 1403 |
| 429 | } | - |
| 430 | int QTextLayout::previousCursorPosition(int oldPos, CursorMode mode) const | - |
| 431 | { | - |
| 432 | const QCharAttributes *attributes = d->attributes(); | - |
| 433 | if (!attributes || oldPos <= 0 || oldPos > d->layoutData->string.length()) evaluated: !attributes| yes Evaluation Count:1 | yes Evaluation Count:1304 |
evaluated: oldPos <= 0| yes Evaluation Count:99 | yes Evaluation Count:1205 |
partially evaluated: oldPos > d->layoutData->string.length()| no Evaluation Count:0 | yes Evaluation Count:1205 |
| 0-1304 |
| 434 | return oldPos; executed: return oldPos;Execution Count:100 | 100 |
| 435 | | - |
| 436 | if (mode == SkipCharacters) { evaluated: mode == SkipCharacters| yes Evaluation Count:1166 | yes Evaluation Count:39 |
| 39-1166 |
| 437 | oldPos--; | - |
| 438 | while (oldPos && !attributes[oldPos].graphemeBoundary) evaluated: oldPos| yes Evaluation Count:1047 | yes Evaluation Count:119 |
partially evaluated: !attributes[oldPos].graphemeBoundary| no Evaluation Count:0 | yes Evaluation Count:1047 |
| 0-1047 |
| 439 | oldPos--; never executed: oldPos--; | 0 |
| 440 | } else { executed: }Execution Count:1166 | 1166 |
| 441 | while (oldPos && d->atSpace(oldPos-1)) partially evaluated: oldPos| yes Evaluation Count:63 | no Evaluation Count:0 |
evaluated: d->atSpace(oldPos-1)| yes Evaluation Count:24 | yes Evaluation Count:39 |
| 0-63 |
| 442 | oldPos--; executed: oldPos--;Execution Count:24 | 24 |
| 443 | | - |
| 444 | if (oldPos && d->atWordSeparator(oldPos-1)) { partially evaluated: oldPos| yes Evaluation Count:39 | no Evaluation Count:0 |
evaluated: d->atWordSeparator(oldPos-1)| yes Evaluation Count:1 | yes Evaluation Count:38 |
| 0-39 |
| 445 | oldPos--; | - |
| 446 | while (oldPos && d->atWordSeparator(oldPos-1)) partially evaluated: oldPos| yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: d->atWordSeparator(oldPos-1)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 0-4 |
| 447 | oldPos--; executed: oldPos--;Execution Count:3 | 3 |
| 448 | } else { executed: }Execution Count:1 | 1 |
| 449 | while (oldPos && !d->atSpace(oldPos-1) && !d->atWordSeparator(oldPos-1)) evaluated: oldPos| yes Evaluation Count:147 | yes Evaluation Count:11 |
evaluated: !d->atSpace(oldPos-1)| yes Evaluation Count:120 | yes Evaluation Count:27 |
partially evaluated: !d->atWordSeparator(oldPos-1)| yes Evaluation Count:120 | no Evaluation Count:0 |
| 0-147 |
| 450 | oldPos--; executed: oldPos--;Execution Count:120 | 120 |
| 451 | } executed: }Execution Count:38 | 38 |
| 452 | } | - |
| 453 | | - |
| 454 | return oldPos; executed: return oldPos;Execution Count:1205 | 1205 |
| 455 | } | - |
| 456 | int QTextLayout::rightCursorPosition(int oldPos) const | - |
| 457 | { | - |
| 458 | int newPos = d->positionAfterVisualMovement(oldPos, QTextCursor::Right); | - |
| 459 | | - |
| 460 | return newPos; executed: return newPos;Execution Count:453 | 453 |
| 461 | } | - |
| 462 | int QTextLayout::leftCursorPosition(int oldPos) const | - |
| 463 | { | - |
| 464 | int newPos = d->positionAfterVisualMovement(oldPos, QTextCursor::Left); | - |
| 465 | | - |
| 466 | return newPos; executed: return newPos;Execution Count:663 | 663 |
| 467 | } | - |
| 468 | bool QTextLayout::isValidCursorPosition(int pos) const | - |
| 469 | { | - |
| 470 | const QCharAttributes *attributes = d->attributes(); | - |
| 471 | if (!attributes || pos < 0 || pos > (int)d->layoutData->string.length()) never evaluated: !attributes never evaluated: pos > (int)d->layoutData->string.length() | 0 |
| 472 | return false; never executed: return false; | 0 |
| 473 | return attributes[pos].graphemeBoundary; never executed: return attributes[pos].graphemeBoundary; | 0 |
| 474 | } | - |
| 475 | QTextLine QTextLayout::createLine() | - |
| 476 | { | - |
| 477 | | - |
| 478 | | - |
| 479 | | - |
| 480 | | - |
| 481 | | - |
| 482 | | - |
| 483 | if (d->layoutData->layoutState == QTextEngine::LayoutFailed) partially evaluated: d->layoutData->layoutState == QTextEngine::LayoutFailed| no Evaluation Count:0 | yes Evaluation Count:425671 |
| 0-425671 |
| 484 | return QTextLine(); never executed: return QTextLine(); | 0 |
| 485 | | - |
| 486 | int l = d->lines.size(); | - |
| 487 | if (l && d->lines.at(l-1).length < 0) { evaluated: l| yes Evaluation Count:224640 | yes Evaluation Count:201031 |
partially evaluated: d->lines.at(l-1).length < 0| no Evaluation Count:0 | yes Evaluation Count:224640 |
| 0-224640 |
| 488 | QTextLine(l-1, d).setNumColumns(2147483647); | - |
| 489 | } | 0 |
| 490 | int from = l > 0 ? d->lines.at(l-1).from + d->lines.at(l-1).length + d->lines.at(l-1).trailingSpaces : 0; evaluated: l > 0| yes Evaluation Count:224640 | yes Evaluation Count:201031 |
| 201031-224640 |
| 491 | int strlen = d->layoutData->string.length(); | - |
| 492 | if (l && from >= strlen) { evaluated: l| yes Evaluation Count:224640 | yes Evaluation Count:201031 |
evaluated: from >= strlen| yes Evaluation Count:189442 | yes Evaluation Count:35198 |
| 35198-224640 |
| 493 | if (!d->lines.at(l-1).length || d->layoutData->string.at(strlen - 1) != QChar::LineSeparator) evaluated: !d->lines.at(l-1).length| yes Evaluation Count:3241 | yes Evaluation Count:186201 |
evaluated: d->layoutData->string.at(strlen - 1) != QChar::LineSeparator| yes Evaluation Count:186074 | yes Evaluation Count:127 |
| 127-186201 |
| 494 | return QTextLine(); executed: return QTextLine();Execution Count:189315 | 189315 |
| 495 | } executed: }Execution Count:127 | 127 |
| 496 | | - |
| 497 | QScriptLine line; | - |
| 498 | line.from = from; | - |
| 499 | line.length = -1; | - |
| 500 | line.justified = false; | - |
| 501 | line.gridfitted = false; | - |
| 502 | | - |
| 503 | d->lines.append(line); | - |
| 504 | return QTextLine(l, d); executed: return QTextLine(l, d);Execution Count:236356 | 236356 |
| 505 | } | - |
| 506 | | - |
| 507 | | - |
| 508 | | - |
| 509 | | - |
| 510 | | - |
| 511 | | - |
| 512 | int QTextLayout::lineCount() const | - |
| 513 | { | - |
| 514 | return d->lines.size(); executed: return d->lines.size();Execution Count:97902 | 97902 |
| 515 | } | - |
| 516 | | - |
| 517 | | - |
| 518 | | - |
| 519 | | - |
| 520 | | - |
| 521 | | - |
| 522 | QTextLine QTextLayout::lineAt(int i) const | - |
| 523 | { | - |
| 524 | return i < lineCount() ? QTextLine(i, d) : QTextLine(); executed: return i < lineCount() ? QTextLine(i, d) : QTextLine();Execution Count:50445 | 50445 |
| 525 | } | - |
| 526 | | - |
| 527 | | - |
| 528 | | - |
| 529 | | - |
| 530 | | - |
| 531 | | - |
| 532 | QTextLine QTextLayout::lineForTextPosition(int pos) const | - |
| 533 | { | - |
| 534 | int lineNum = d->lineNumberForTextPosition(pos); | - |
| 535 | return lineNum >= 0 ? lineAt(lineNum) : QTextLine(); executed: return lineNum >= 0 ? lineAt(lineNum) : QTextLine();Execution Count:19542 | 19542 |
| 536 | } | - |
| 537 | QPointF QTextLayout::position() const | - |
| 538 | { | - |
| 539 | return d->position; executed: return d->position;Execution Count:5816 | 5816 |
| 540 | } | - |
| 541 | | - |
| 542 | | - |
| 543 | | - |
| 544 | | - |
| 545 | | - |
| 546 | | - |
| 547 | void QTextLayout::setPosition(const QPointF &p) | - |
| 548 | { | - |
| 549 | d->position = p; | - |
| 550 | } executed: }Execution Count:3670 | 3670 |
| 551 | | - |
| 552 | | - |
| 553 | | - |
| 554 | | - |
| 555 | QRectF QTextLayout::boundingRect() const | - |
| 556 | { | - |
| 557 | if (d->lines.isEmpty()) evaluated: d->lines.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:4666 |
| 1-4666 |
| 558 | return QRectF(); executed: return QRectF();Execution Count:1 | 1 |
| 559 | | - |
| 560 | QFixed xmax, ymax; | - |
| 561 | QFixed xmin = d->lines.at(0).x; | - |
| 562 | QFixed ymin = d->lines.at(0).y; | - |
| 563 | | - |
| 564 | for (int i = 0; i < d->lines.size(); ++i) { evaluated: i < d->lines.size()| yes Evaluation Count:12446 | yes Evaluation Count:4666 |
| 4666-12446 |
| 565 | const QScriptLine &si = d->lines[i]; | - |
| 566 | xmin = qMin(xmin, si.x); | - |
| 567 | ymin = qMin(ymin, si.y); | - |
| 568 | QFixed lineWidth = si.width < (2147483647/256) ? qMax(si.width, si.textWidth) : si.textWidth; evaluated: si.width < (2147483647/256)| yes Evaluation Count:10083 | yes Evaluation Count:2363 |
| 2363-10083 |
| 569 | xmax = qMax(xmax, si.x+lineWidth); | - |
| 570 | | - |
| 571 | ymax = qMax(ymax, si.y+si.height().ceil()); | - |
| 572 | } executed: }Execution Count:12446 | 12446 |
| 573 | return QRectF(xmin.toReal(), ymin.toReal(), (xmax-xmin).toReal(), (ymax-ymin).toReal()); executed: return QRectF(xmin.toReal(), ymin.toReal(), (xmax-xmin).toReal(), (ymax-ymin).toReal());Execution Count:4666 | 4666 |
| 574 | } | - |
| 575 | qreal QTextLayout::minimumWidth() const | - |
| 576 | { | - |
| 577 | return d->minWidth.toReal(); executed: return d->minWidth.toReal();Execution Count:3643 | 3643 |
| 578 | } | - |
| 579 | qreal QTextLayout::maximumWidth() const | - |
| 580 | { | - |
| 581 | return d->maxWidth.toReal(); executed: return d->maxWidth.toReal();Execution Count:3643 | 3643 |
| 582 | } | - |
| 583 | | - |
| 584 | | - |
| 585 | | - |
| 586 | | - |
| 587 | | - |
| 588 | void QTextLayout::setFlags(int flags) | - |
| 589 | { | - |
| 590 | if (flags & Qt::TextJustificationForced) { partially evaluated: flags & Qt::TextJustificationForced| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 591 | d->option.setAlignment(Qt::AlignJustify); | - |
| 592 | d->forceJustification = true; | - |
| 593 | } | 0 |
| 594 | | - |
| 595 | if (flags & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) { partially evaluated: flags & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 596 | d->ignoreBidi = true; | - |
| 597 | d->option.setTextDirection((flags & Qt::TextForceLeftToRight) ? Qt::LeftToRight : Qt::RightToLeft); | - |
| 598 | } executed: }Execution Count:4 | 4 |
| 599 | } executed: }Execution Count:4 | 4 |
| 600 | | - |
| 601 | static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPointF &pos, QTextLayout::FormatRange *selection, | - |
| 602 | QPainterPath *region, QRectF boundingRect) | - |
| 603 | { | - |
| 604 | const QScriptLine &line = eng->lines[lineNumber]; | - |
| 605 | | - |
| 606 | QTextLineItemIterator iterator(eng, lineNumber, pos, selection); | - |
| 607 | | - |
| 608 | | - |
| 609 | | - |
| 610 | const qreal selectionY = pos.y() + line.y.toReal(); | - |
| 611 | const qreal lineHeight = line.height().toReal(); | - |
| 612 | | - |
| 613 | QFixed lastSelectionX = iterator.x; | - |
| 614 | QFixed lastSelectionWidth; | - |
| 615 | | - |
| 616 | while (!iterator.atEnd()) { evaluated: !iterator.atEnd()| yes Evaluation Count:51 | yes Evaluation Count:51 |
| 51 |
| 617 | iterator.next(); | - |
| 618 | | - |
| 619 | QFixed selectionX, selectionWidth; | - |
| 620 | if (iterator.getSelectionBounds(&selectionX, &selectionWidth)) { partially evaluated: iterator.getSelectionBounds(&selectionX, &selectionWidth)| yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
| 621 | if (selectionX == lastSelectionX + lastSelectionWidth) { evaluated: selectionX == lastSelectionX + lastSelectionWidth| yes Evaluation Count:50 | yes Evaluation Count:1 |
| 1-50 |
| 622 | lastSelectionWidth += selectionWidth; | - |
| 623 | continue; executed: continue;Execution Count:50 | 50 |
| 624 | } | - |
| 625 | | - |
| 626 | if (lastSelectionWidth > 0) partially evaluated: lastSelectionWidth > 0| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 627 | region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); never executed: region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | 0 |
| 628 | | - |
| 629 | lastSelectionX = selectionX; | - |
| 630 | lastSelectionWidth = selectionWidth; | - |
| 631 | } executed: }Execution Count:1 | 1 |
| 632 | } executed: }Execution Count:1 | 1 |
| 633 | if (lastSelectionWidth > 0) partially evaluated: lastSelectionWidth > 0| yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
| 634 | region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); executed: region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));Execution Count:51 | 51 |
| 635 | } executed: }Execution Count:51 | 51 |
| 636 | | - |
| 637 | static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip) | - |
| 638 | { | - |
| 639 | return clip.isValid() ? (rect & clip) : rect; executed: return clip.isValid() ? (rect & clip) : rect;Execution Count:51 | 51 |
| 640 | } | - |
| 641 | QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const | - |
| 642 | { | - |
| 643 | if (from < 0) partially evaluated: from < 0| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 644 | from = 0; executed: from = 0;Execution Count:22 | 22 |
| 645 | if (length < 0) partially evaluated: length < 0| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 646 | length = text().length(); executed: length = text().length();Execution Count:22 | 22 |
| 647 | | - |
| 648 | QHash<QPair<QFontEngine *, int>, QGlyphRun> glyphRunHash; | - |
| 649 | for (int i=0; i<d->lines.size(); ++i) { evaluated: i<d->lines.size()| yes Evaluation Count:22 | yes Evaluation Count:22 |
| 22 |
| 650 | if (d->lines[i].from > from + length) partially evaluated: d->lines[i].from > from + length| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 651 | break; | 0 |
| 652 | else if (d->lines[i].from + d->lines[i].length >= from) { partially evaluated: d->lines[i].from + d->lines[i].length >= from| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 653 | QList<QGlyphRun> glyphRuns = QTextLine(i, d).glyphRuns(from, length); | - |
| 654 | | - |
| 655 | for (int j = 0; j < glyphRuns.size(); j++) { evaluated: j < glyphRuns.size()| yes Evaluation Count:23 | yes Evaluation Count:22 |
| 22-23 |
| 656 | const QGlyphRun &glyphRun = glyphRuns.at(j); | - |
| 657 | QRawFont rawFont = glyphRun.rawFont(); | - |
| 658 | | - |
| 659 | QFontEngine *fontEngine = rawFont.d->fontEngine; | - |
| 660 | QGlyphRun::GlyphRunFlags flags = glyphRun.flags(); | - |
| 661 | QPair<QFontEngine *, int> key(fontEngine, int(flags)); | - |
| 662 | | - |
| 663 | if (glyphRunHash.contains(key)) { partially evaluated: glyphRunHash.contains(key)| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 664 | QGlyphRun &oldGlyphRun = glyphRunHash[key]; | - |
| 665 | | - |
| 666 | QVector<quint32> indexes = oldGlyphRun.glyphIndexes(); | - |
| 667 | QVector<QPointF> positions = oldGlyphRun.positions(); | - |
| 668 | | - |
| 669 | indexes += glyphRun.glyphIndexes(); | - |
| 670 | positions += glyphRun.positions(); | - |
| 671 | | - |
| 672 | oldGlyphRun.setGlyphIndexes(indexes); | - |
| 673 | oldGlyphRun.setPositions(positions); | - |
| 674 | } else { | 0 |
| 675 | glyphRunHash[key] = glyphRun; | - |
| 676 | } executed: }Execution Count:23 | 23 |
| 677 | } | - |
| 678 | } executed: }Execution Count:22 | 22 |
| 679 | } | - |
| 680 | | - |
| 681 | return glyphRunHash.values(); executed: return glyphRunHash.values();Execution Count:22 | 22 |
| 682 | } | - |
| 683 | | - |
| 684 | | - |
| 685 | | - |
| 686 | | - |
| 687 | | - |
| 688 | | - |
| 689 | | - |
| 690 | void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRange> &selections, const QRectF &clip) const | - |
| 691 | { | - |
| 692 | if (d->lines.isEmpty()) partially evaluated: d->lines.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:5904 |
| 0-5904 |
| 693 | return; | 0 |
| 694 | | - |
| 695 | if (!d->layoutData) evaluated: !d->layoutData| yes Evaluation Count:5045 | yes Evaluation Count:859 |
| 859-5045 |
| 696 | d->itemize(); executed: d->itemize();Execution Count:5045 | 5045 |
| 697 | | - |
| 698 | QPointF position = pos + d->position; | - |
| 699 | | - |
| 700 | QFixed clipy = ((-2147483647 - 1)/256); | - |
| 701 | QFixed clipe = (2147483647/256); | - |
| 702 | if (clip.isValid()) { evaluated: clip.isValid()| yes Evaluation Count:5897 | yes Evaluation Count:7 |
| 7-5897 |
| 703 | clipy = QFixed::fromReal(clip.y() - position.y()); | - |
| 704 | clipe = clipy + QFixed::fromReal(clip.height()); | - |
| 705 | } executed: }Execution Count:5897 | 5897 |
| 706 | | - |
| 707 | int firstLine = 0; | - |
| 708 | int lastLine = d->lines.size(); | - |
| 709 | for (int i = 0; i < d->lines.size(); ++i) { evaluated: i < d->lines.size()| yes Evaluation Count:5943 | yes Evaluation Count:5904 |
| 5904-5943 |
| 710 | QTextLine l(i, d); | - |
| 711 | const QScriptLine &sl = d->lines[i]; | - |
| 712 | | - |
| 713 | if (sl.y > clipe) { partially evaluated: sl.y > clipe| no Evaluation Count:0 | yes Evaluation Count:5943 |
| 0-5943 |
| 714 | lastLine = i; | - |
| 715 | break; | 0 |
| 716 | } | - |
| 717 | if ((sl.y + sl.height()) < clipy) { partially evaluated: (sl.y + sl.height()) < clipy| no Evaluation Count:0 | yes Evaluation Count:5943 |
| 0-5943 |
| 718 | firstLine = i; | - |
| 719 | continue; never executed: continue; | 0 |
| 720 | } | - |
| 721 | } executed: }Execution Count:5943 | 5943 |
| 722 | | - |
| 723 | QPainterPath excludedRegion; | - |
| 724 | QPainterPath textDoneRegion; | - |
| 725 | for (int i = 0; i < selections.size(); ++i) { evaluated: i < selections.size()| yes Evaluation Count:51 | yes Evaluation Count:5904 |
| 51-5904 |
| 726 | FormatRange selection = selections.at(i); | - |
| 727 | const QBrush bg = selection.format.background(); | - |
| 728 | | - |
| 729 | QPainterPath region; | - |
| 730 | region.setFillRule(Qt::WindingFill); | - |
| 731 | | - |
| 732 | for (int line = firstLine; line < lastLine; ++line) { evaluated: line < lastLine| yes Evaluation Count:51 | yes Evaluation Count:51 |
| 51 |
| 733 | const QScriptLine &sl = d->lines[line]; | - |
| 734 | QTextLine tl(line, d); | - |
| 735 | | - |
| 736 | QRectF lineRect(tl.naturalTextRect()); | - |
| 737 | lineRect.translate(position); | - |
| 738 | lineRect.adjust(0, 0, d->leadingSpaceWidth(sl).toReal(), 0); | - |
| 739 | | - |
| 740 | bool isLastLineInBlock = (line == d->lines.size()-1); | - |
| 741 | int sl_length = sl.length + (isLastLineInBlock? 1 : 0); partially evaluated: isLastLineInBlock| yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
| 742 | | - |
| 743 | | - |
| 744 | if (sl.from > selection.start + selection.length || sl.from + sl_length <= selection.start) partially evaluated: sl.from > selection.start + selection.length| no Evaluation Count:0 | yes Evaluation Count:51 |
partially evaluated: sl.from + sl_length <= selection.start| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
| 745 | continue; never executed: continue; | 0 |
| 746 | | - |
| 747 | const bool selectionStartInLine = sl.from <= selection.start; | - |
| 748 | const bool selectionEndInLine = selection.start + selection.length < sl.from + sl_length; | - |
| 749 | | - |
| 750 | if (sl.length && (selectionStartInLine || selectionEndInLine)) { partially evaluated: sl.length| yes Evaluation Count:51 | no Evaluation Count:0 |
partially evaluated: selectionStartInLine| yes Evaluation Count:51 | no Evaluation Count:0 |
never evaluated: selectionEndInLine | 0-51 |
| 751 | addSelectedRegionsToPath(d, line, position, &selection, ®ion, clipIfValid(lineRect, clip)); | - |
| 752 | } else { executed: }Execution Count:51 | 51 |
| 753 | region.addRect(clipIfValid(lineRect, clip)); | - |
| 754 | } | 0 |
| 755 | | - |
| 756 | if (selection.format.boolProperty(QTextFormat::FullWidthSelection)) { partially evaluated: selection.format.boolProperty(QTextFormat::FullWidthSelection)| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
| 757 | QRectF fullLineRect(tl.rect()); | - |
| 758 | fullLineRect.translate(position); | - |
| 759 | fullLineRect.setRight((2147483647/256)); | - |
| 760 | if (!selectionEndInLine) never evaluated: !selectionEndInLine | 0 |
| 761 | region.addRect(clipIfValid(QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip)); never executed: region.addRect(clipIfValid(QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip)); | 0 |
| 762 | if (!selectionStartInLine) never evaluated: !selectionStartInLine | 0 |
| 763 | region.addRect(clipIfValid(QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip)); never executed: region.addRect(clipIfValid(QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip)); | 0 |
| 764 | } else if (!selectionEndInLine partially evaluated: !selectionEndInLine| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
| 765 | && isLastLineInBlock never evaluated: isLastLineInBlock | 0 |
| 766 | &&!(d->option.flags() & QTextOption::ShowLineAndParagraphSeparators)) { never evaluated: !(d->option.flags() & QTextOption::ShowLineAndParagraphSeparators) | 0 |
| 767 | region.addRect(clipIfValid(QRectF(lineRect.right(), lineRect.top(), | - |
| 768 | lineRect.height()/4, lineRect.height()), clip)); | - |
| 769 | } | 0 |
| 770 | | - |
| 771 | } | - |
| 772 | { | - |
| 773 | const QPen oldPen = p->pen(); | - |
| 774 | const QBrush oldBrush = p->brush(); | - |
| 775 | | - |
| 776 | p->setPen(selection.format.penProperty(QTextFormat::OutlinePen)); | - |
| 777 | p->setBrush(selection.format.brushProperty(QTextFormat::BackgroundBrush)); | - |
| 778 | p->drawPath(region); | - |
| 779 | | - |
| 780 | p->setPen(oldPen); | - |
| 781 | p->setBrush(oldBrush); | - |
| 782 | } | - |
| 783 | | - |
| 784 | | - |
| 785 | | - |
| 786 | bool hasText = (selection.format.foreground().style() != Qt::NoBrush); | - |
| 787 | bool hasBackground= (selection.format.background().style() != Qt::NoBrush); | - |
| 788 | | - |
| 789 | if (hasBackground) { partially evaluated: hasBackground| yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
| 790 | selection.format.setProperty((QTextFormat::ForegroundBrush + 1), selection.format.property(QTextFormat::BackgroundBrush)); | - |
| 791 | | - |
| 792 | | - |
| 793 | selection.format.setProperty(QTextFormat::BackgroundBrush, QBrush()); | - |
| 794 | selection.format.clearProperty(QTextFormat::OutlinePen); | - |
| 795 | } executed: }Execution Count:51 | 51 |
| 796 | | - |
| 797 | selection.format.setProperty(0x5012, !hasText); | - |
| 798 | | - |
| 799 | if (hasText && !hasBackground && !(textDoneRegion & region).isEmpty()) partially evaluated: hasText| yes Evaluation Count:51 | no Evaluation Count:0 |
partially evaluated: !hasBackground| no Evaluation Count:0 | yes Evaluation Count:51 |
never evaluated: !(textDoneRegion & region).isEmpty() | 0-51 |
| 800 | continue; never executed: continue; | 0 |
| 801 | | - |
| 802 | p->save(); | - |
| 803 | p->setClipPath(region, Qt::IntersectClip); | - |
| 804 | | - |
| 805 | for (int line = firstLine; line < lastLine; ++line) { evaluated: line < lastLine| yes Evaluation Count:51 | yes Evaluation Count:51 |
| 51 |
| 806 | QTextLine l(line, d); | - |
| 807 | l.draw(p, position, &selection); | - |
| 808 | } executed: }Execution Count:51 | 51 |
| 809 | p->restore(); | - |
| 810 | | - |
| 811 | if (hasText) { partially evaluated: hasText| yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
| 812 | textDoneRegion += region; | - |
| 813 | } else { executed: }Execution Count:51 | 51 |
| 814 | if (hasBackground) never evaluated: hasBackground | 0 |
| 815 | textDoneRegion -= region; never executed: textDoneRegion -= region; | 0 |
| 816 | } | 0 |
| 817 | | - |
| 818 | excludedRegion += region; | - |
| 819 | } executed: }Execution Count:51 | 51 |
| 820 | | - |
| 821 | QPainterPath needsTextButNoBackground = excludedRegion - textDoneRegion; | - |
| 822 | if (!needsTextButNoBackground.isEmpty()){ partially evaluated: !needsTextButNoBackground.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:5904 |
| 0-5904 |
| 823 | p->save(); | - |
| 824 | p->setClipPath(needsTextButNoBackground, Qt::IntersectClip); | - |
| 825 | FormatRange selection; | - |
| 826 | selection.start = 0; | - |
| 827 | selection.length = 2147483647; | - |
| 828 | selection.format.setProperty(0x513, true); | - |
| 829 | for (int line = firstLine; line < lastLine; ++line) { never evaluated: line < lastLine | 0 |
| 830 | QTextLine l(line, d); | - |
| 831 | l.draw(p, position, &selection); | - |
| 832 | } | 0 |
| 833 | p->restore(); | - |
| 834 | } | 0 |
| 835 | | - |
| 836 | if (!excludedRegion.isEmpty()) { evaluated: !excludedRegion.isEmpty()| yes Evaluation Count:51 | yes Evaluation Count:5853 |
| 51-5853 |
| 837 | p->save(); | - |
| 838 | QPainterPath path; | - |
| 839 | QRectF br = boundingRect().translated(position); | - |
| 840 | br.setRight((2147483647/256)); | - |
| 841 | if (!clip.isNull()) partially evaluated: !clip.isNull()| yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
| 842 | br = br.intersected(clip); executed: br = br.intersected(clip);Execution Count:51 | 51 |
| 843 | path.addRect(br); | - |
| 844 | path -= excludedRegion; | - |
| 845 | p->setClipPath(path, Qt::IntersectClip); | - |
| 846 | } executed: }Execution Count:51 | 51 |
| 847 | | - |
| 848 | for (int i = firstLine; i < lastLine; ++i) { evaluated: i < lastLine| yes Evaluation Count:5943 | yes Evaluation Count:5904 |
| 5904-5943 |
| 849 | QTextLine l(i, d); | - |
| 850 | l.draw(p, position); | - |
| 851 | } executed: }Execution Count:5943 | 5943 |
| 852 | if (!excludedRegion.isEmpty()) evaluated: !excludedRegion.isEmpty()| yes Evaluation Count:51 | yes Evaluation Count:5853 |
| 51-5853 |
| 853 | p->restore(); executed: p->restore();Execution Count:51 | 51 |
| 854 | | - |
| 855 | | - |
| 856 | if (!d->cacheGlyphs) evaluated: !d->cacheGlyphs| yes Evaluation Count:5135 | yes Evaluation Count:769 |
| 769-5135 |
| 857 | d->freeMemory(); executed: d->freeMemory();Execution Count:5135 | 5135 |
| 858 | } executed: }Execution Count:5904 | 5904 |
| 859 | void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const | - |
| 860 | { | - |
| 861 | drawCursor(p, pos, cursorPosition, 1); | - |
| 862 | } | 0 |
| 863 | void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width) const | - |
| 864 | { | - |
| 865 | if (d->lines.isEmpty()) partially evaluated: d->lines.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 866 | return; | 0 |
| 867 | | - |
| 868 | if (!d->layoutData) evaluated: !d->layoutData| yes Evaluation Count:40 | yes Evaluation Count:353 |
| 40-353 |
| 869 | d->itemize(); executed: d->itemize();Execution Count:40 | 40 |
| 870 | | - |
| 871 | QPointF position = pos + d->position; | - |
| 872 | | - |
| 873 | cursorPosition = qBound(0, cursorPosition, d->layoutData->string.length()); | - |
| 874 | int line = d->lineNumberForTextPosition(cursorPosition); | - |
| 875 | if (line < 0) partially evaluated: line < 0| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 876 | line = 0; never executed: line = 0; | 0 |
| 877 | if (line >= d->lines.size()) partially evaluated: line >= d->lines.size()| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 878 | return; | 0 |
| 879 | | - |
| 880 | QTextLine l(line, d); | - |
| 881 | const QScriptLine &sl = d->lines[line]; | - |
| 882 | | - |
| 883 | qreal x = position.x() + l.cursorToX(cursorPosition); | - |
| 884 | | - |
| 885 | int itm; | - |
| 886 | | - |
| 887 | if (d->visualCursorMovement()) { partially evaluated: d->visualCursorMovement()| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 888 | if (cursorPosition == sl.from + sl.length) never evaluated: cursorPosition == sl.from + sl.length | 0 |
| 889 | cursorPosition--; never executed: cursorPosition--; | 0 |
| 890 | itm = d->findItem(cursorPosition); | - |
| 891 | } else | 0 |
| 892 | itm = d->findItem(cursorPosition - 1); executed: itm = d->findItem(cursorPosition - 1);Execution Count:393 | 393 |
| 893 | | - |
| 894 | QFixed base = sl.base(); | - |
| 895 | QFixed descent = sl.descent; | - |
| 896 | bool rightToLeft = d->isRightToLeft(); | - |
| 897 | if (itm >= 0) { evaluated: itm >= 0| yes Evaluation Count:153 | yes Evaluation Count:240 |
| 153-240 |
| 898 | const QScriptItem &si = d->layoutData->items.at(itm); | - |
| 899 | if (si.ascent > 0) partially evaluated: si.ascent > 0| yes Evaluation Count:153 | no Evaluation Count:0 |
| 0-153 |
| 900 | base = si.ascent; executed: base = si.ascent;Execution Count:153 | 153 |
| 901 | if (si.descent > 0) partially evaluated: si.descent > 0| yes Evaluation Count:153 | no Evaluation Count:0 |
| 0-153 |
| 902 | descent = si.descent; executed: descent = si.descent;Execution Count:153 | 153 |
| 903 | rightToLeft = si.analysis.bidiLevel % 2; | - |
| 904 | } executed: }Execution Count:153 | 153 |
| 905 | qreal y = position.y() + (sl.y + sl.base() - base).toReal(); | - |
| 906 | bool toggleAntialiasing = !(p->renderHints() & QPainter::Antialiasing) partially evaluated: !(p->renderHints() & QPainter::Antialiasing)| yes Evaluation Count:393 | no Evaluation Count:0 |
| 0-393 |
| 907 | && (p->transform().type() > QTransform::TxTranslate); partially evaluated: (p->transform().type() > QTransform::TxTranslate)| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 908 | if (toggleAntialiasing) partially evaluated: toggleAntialiasing| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 909 | p->setRenderHint(QPainter::Antialiasing); never executed: p->setRenderHint(QPainter::Antialiasing); | 0 |
| 910 | p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush()); | - |
| 911 | if (toggleAntialiasing) partially evaluated: toggleAntialiasing| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 912 | p->setRenderHint(QPainter::Antialiasing, false); never executed: p->setRenderHint(QPainter::Antialiasing, false); | 0 |
| 913 | if (d->layoutData->hasBidi) { partially evaluated: d->layoutData->hasBidi| no Evaluation Count:0 | yes Evaluation Count:393 |
| 0-393 |
| 914 | const int arrow_extent = 4; | - |
| 915 | int sign = rightToLeft ? -1 : 1; never evaluated: rightToLeft | 0 |
| 916 | p->drawLine(QLineF(x, y, x + (sign * arrow_extent/2), y + arrow_extent/2)); | - |
| 917 | p->drawLine(QLineF(x, y+arrow_extent, x + (sign * arrow_extent/2), y + arrow_extent/2)); | - |
| 918 | } | 0 |
| 919 | return; executed: return;Execution Count:393 | 393 |
| 920 | } | - |
| 921 | QRectF QTextLine::rect() const | - |
| 922 | { | - |
| 923 | const QScriptLine& sl = eng->lines[index]; | - |
| 924 | return QRectF(sl.x.toReal(), sl.y.toReal(), sl.width.toReal(), sl.height().toReal()); executed: return QRectF(sl.x.toReal(), sl.y.toReal(), sl.width.toReal(), sl.height().toReal());Execution Count:165 | 165 |
| 925 | } | - |
| 926 | | - |
| 927 | | - |
| 928 | | - |
| 929 | | - |
| 930 | QRectF QTextLine::naturalTextRect() const | - |
| 931 | { | - |
| 932 | const QScriptLine& sl = eng->lines[index]; | - |
| 933 | QFixed x = sl.x + eng->alignLine(sl); | - |
| 934 | | - |
| 935 | QFixed width = sl.textWidth; | - |
| 936 | if (sl.justified) partially evaluated: sl.justified| no Evaluation Count:0 | yes Evaluation Count:236 |
| 0-236 |
| 937 | width = sl.width; never executed: width = sl.width; | 0 |
| 938 | | - |
| 939 | return QRectF(x.toReal(), sl.y.toReal(), width.toReal(), sl.height().toReal()); executed: return QRectF(x.toReal(), sl.y.toReal(), width.toReal(), sl.height().toReal());Execution Count:236 | 236 |
| 940 | } | - |
| 941 | | - |
| 942 | | - |
| 943 | | - |
| 944 | | - |
| 945 | | - |
| 946 | | - |
| 947 | qreal QTextLine::x() const | - |
| 948 | { | - |
| 949 | return eng->lines[index].x.toReal(); executed: return eng->lines[index].x.toReal();Execution Count:30443 | 30443 |
| 950 | } | - |
| 951 | | - |
| 952 | | - |
| 953 | | - |
| 954 | | - |
| 955 | | - |
| 956 | | - |
| 957 | qreal QTextLine::y() const | - |
| 958 | { | - |
| 959 | return eng->lines[index].y.toReal(); executed: return eng->lines[index].y.toReal();Execution Count:4124 | 4124 |
| 960 | } | - |
| 961 | | - |
| 962 | | - |
| 963 | | - |
| 964 | | - |
| 965 | | - |
| 966 | | - |
| 967 | qreal QTextLine::width() const | - |
| 968 | { | - |
| 969 | return eng->lines[index].width.toReal(); executed: return eng->lines[index].width.toReal();Execution Count:12232 | 12232 |
| 970 | } | - |
| 971 | | - |
| 972 | | - |
| 973 | | - |
| 974 | | - |
| 975 | | - |
| 976 | | - |
| 977 | | - |
| 978 | qreal QTextLine::ascent() const | - |
| 979 | { | - |
| 980 | return eng->lines[index].ascent.toReal(); executed: return eng->lines[index].ascent.toReal();Execution Count:11205 | 11205 |
| 981 | } | - |
| 982 | | - |
| 983 | | - |
| 984 | | - |
| 985 | | - |
| 986 | | - |
| 987 | | - |
| 988 | qreal QTextLine::descent() const | - |
| 989 | { | - |
| 990 | return eng->lines[index].descent.toReal(); never executed: return eng->lines[index].descent.toReal(); | 0 |
| 991 | } | - |
| 992 | qreal QTextLine::height() const | - |
| 993 | { | - |
| 994 | return eng->lines[index].height().ceil().toReal(); executed: return eng->lines[index].height().ceil().toReal();Execution Count:244403 | 244403 |
| 995 | } | - |
| 996 | qreal QTextLine::leading() const | - |
| 997 | { | - |
| 998 | return eng->lines[index].leading.toReal(); never executed: return eng->lines[index].leading.toReal(); | 0 |
| 999 | } | - |
| 1000 | void QTextLine::setLeadingIncluded(bool included) | - |
| 1001 | { | - |
| 1002 | eng->lines[index].leadingIncluded= included; | - |
| 1003 | | - |
| 1004 | } executed: }Execution Count:28368 | 28368 |
| 1005 | bool QTextLine::leadingIncluded() const | - |
| 1006 | { | - |
| 1007 | return eng->lines[index].leadingIncluded; never executed: return eng->lines[index].leadingIncluded; | 0 |
| 1008 | } | - |
| 1009 | | - |
| 1010 | | - |
| 1011 | | - |
| 1012 | | - |
| 1013 | | - |
| 1014 | | - |
| 1015 | qreal QTextLine::naturalTextWidth() const | - |
| 1016 | { | - |
| 1017 | return eng->lines[index].textWidth.toReal(); executed: return eng->lines[index].textWidth.toReal();Execution Count:280086 | 280086 |
| 1018 | } | - |
| 1019 | qreal QTextLine::horizontalAdvance() const | - |
| 1020 | { | - |
| 1021 | return eng->lines[index].textAdvance.toReal(); executed: return eng->lines[index].textAdvance.toReal();Execution Count:3817 | 3817 |
| 1022 | } | - |
| 1023 | void QTextLine::setLineWidth(qreal width) | - |
| 1024 | { | - |
| 1025 | QScriptLine &line = eng->lines[index]; | - |
| 1026 | if (!eng->layoutData) { partially evaluated: !eng->layoutData| no Evaluation Count:0 | yes Evaluation Count:231229 |
| 0-231229 |
| 1027 | QMessageLogger("text/qtextlayout.cpp", 1555, __PRETTY_FUNCTION__).warning("QTextLine: Can't set a line width while not layouting."); | - |
| 1028 | return; | 0 |
| 1029 | } | - |
| 1030 | | - |
| 1031 | if (width > (2147483647/256)) evaluated: width > (2147483647/256)| yes Evaluation Count:35749 | yes Evaluation Count:195480 |
| 35749-195480 |
| 1032 | width = (2147483647/256); executed: width = (2147483647/256);Execution Count:35749 | 35749 |
| 1033 | | - |
| 1034 | line.width = QFixed::fromReal(width); | - |
| 1035 | if (line.length evaluated: line.length| yes Evaluation Count:229125 | yes Evaluation Count:2104 |
| 2104-229125 |
| 1036 | && line.textWidth <= line.width evaluated: line.textWidth <= line.width| yes Evaluation Count:226163 | yes Evaluation Count:2962 |
| 2962-226163 |
| 1037 | && line.from + line.length == eng->layoutData->string.length()) evaluated: line.from + line.length == eng->layoutData->string.length()| yes Evaluation Count:432 | yes Evaluation Count:225731 |
| 432-225731 |
| 1038 | | - |
| 1039 | | - |
| 1040 | return; executed: return;Execution Count:432 | 432 |
| 1041 | line.length = 0; | - |
| 1042 | line.textWidth = 0; | - |
| 1043 | | - |
| 1044 | layout_helper(2147483647); | - |
| 1045 | } executed: }Execution Count:230797 | 230797 |
| 1046 | void QTextLine::setNumColumns(int numColumns) | - |
| 1047 | { | - |
| 1048 | QScriptLine &line = eng->lines[index]; | - |
| 1049 | line.width = (2147483647/256); | - |
| 1050 | line.length = 0; | - |
| 1051 | line.textWidth = 0; | - |
| 1052 | layout_helper(numColumns); | - |
| 1053 | } executed: }Execution Count:10472 | 10472 |
| 1054 | void QTextLine::setNumColumns(int numColumns, qreal alignmentWidth) | - |
| 1055 | { | - |
| 1056 | QScriptLine &line = eng->lines[index]; | - |
| 1057 | line.width = QFixed::fromReal(alignmentWidth); | - |
| 1058 | line.length = 0; | - |
| 1059 | line.textWidth = 0; | - |
| 1060 | layout_helper(numColumns); | - |
| 1061 | } | 0 |
| 1062 | | - |
| 1063 | | - |
| 1064 | | - |
| 1065 | | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | | - |
| 1069 | namespace { | - |
| 1070 | | - |
| 1071 | struct LineBreakHelper | - |
| 1072 | { | - |
| 1073 | LineBreakHelper() | - |
| 1074 | : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0), | - |
| 1075 | manualWrap(false), whiteSpaceOrObject(true) | - |
| 1076 | { | - |
| 1077 | } executed: }Execution Count:232079 | 232079 |
| 1078 | | - |
| 1079 | | - |
| 1080 | QScriptLine tmpData; | - |
| 1081 | QScriptLine spaceData; | - |
| 1082 | | - |
| 1083 | QGlyphLayout glyphs; | - |
| 1084 | | - |
| 1085 | int glyphCount; | - |
| 1086 | int maxGlyphs; | - |
| 1087 | int currentPosition; | - |
| 1088 | glyph_t previousGlyph; | - |
| 1089 | | - |
| 1090 | QFixed minw; | - |
| 1091 | QFixed softHyphenWidth; | - |
| 1092 | QFixed rightBearing; | - |
| 1093 | QFixed minimumRightBearing; | - |
| 1094 | | - |
| 1095 | QFontEngine *fontEngine; | - |
| 1096 | const unsigned short *logClusters; | - |
| 1097 | | - |
| 1098 | bool manualWrap; | - |
| 1099 | bool whiteSpaceOrObject; | - |
| 1100 | | - |
| 1101 | bool checkFullOtherwiseExtend(QScriptLine &line); | - |
| 1102 | | - |
| 1103 | QFixed calculateNewWidth(const QScriptLine &line) const { | - |
| 1104 | return line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth | 1240967 |
| 1105 | - qMin(rightBearing, QFixed()); executed: return line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth - qMin(rightBearing, QFixed());Execution Count:1240967 | 1240967 |
| 1106 | } | - |
| 1107 | | - |
| 1108 | inline glyph_t currentGlyph() const | - |
| 1109 | { | - |
| 1110 | qt_noop(); | - |
| 1111 | qt_noop(); | - |
| 1112 | | - |
| 1113 | return glyphs.glyphs[logClusters[currentPosition - 1]]; executed: return glyphs.glyphs[logClusters[currentPosition - 1]];Execution Count:1054610 | 1054610 |
| 1114 | } | - |
| 1115 | | - |
| 1116 | inline void saveCurrentGlyph() | - |
| 1117 | { | - |
| 1118 | previousGlyph = 0; | - |
| 1119 | if (currentPosition > 0 && evaluated: currentPosition > 0| yes Evaluation Count:828274 | yes Evaluation Count:194331 |
| 194331-828274 |
| 1120 | logClusters[currentPosition - 1] < glyphs.numGlyphs) { evaluated: logClusters[currentPosition - 1] < glyphs.numGlyphs| yes Evaluation Count:827866 | yes Evaluation Count:408 |
| 408-827866 |
| 1121 | previousGlyph = currentGlyph(); | - |
| 1122 | } executed: }Execution Count:827866 | 827866 |
| 1123 | } executed: }Execution Count:1022605 | 1022605 |
| 1124 | | - |
| 1125 | inline void adjustRightBearing(glyph_t glyph) | - |
| 1126 | { | - |
| 1127 | qreal rb; | - |
| 1128 | fontEngine->getGlyphBearings(glyph, 0, &rb); | - |
| 1129 | rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); | - |
| 1130 | } executed: }Execution Count:261656 | 261656 |
| 1131 | | - |
| 1132 | inline void adjustRightBearing() | - |
| 1133 | { | - |
| 1134 | if (currentPosition <= 0) partially evaluated: currentPosition <= 0| no Evaluation Count:0 | yes Evaluation Count:226744 |
| 0-226744 |
| 1135 | return; | 0 |
| 1136 | adjustRightBearing(currentGlyph()); | - |
| 1137 | } executed: }Execution Count:226744 | 226744 |
| 1138 | | - |
| 1139 | inline void adjustPreviousRightBearing() | - |
| 1140 | { | - |
| 1141 | if (previousGlyph > 0) evaluated: previousGlyph > 0| yes Evaluation Count:34912 | yes Evaluation Count:57 |
| 57-34912 |
| 1142 | adjustRightBearing(previousGlyph); executed: adjustRightBearing(previousGlyph);Execution Count:34912 | 34912 |
| 1143 | } executed: }Execution Count:34969 | 34969 |
| 1144 | | - |
| 1145 | inline void resetRightBearing() | - |
| 1146 | { | - |
| 1147 | rightBearing = QFixed(1); | - |
| 1148 | | - |
| 1149 | } executed: }Execution Count:822403 | 822403 |
| 1150 | }; | - |
| 1151 | | - |
| 1152 | inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line) | - |
| 1153 | { | - |
| 1154 | if (0) QMessageLogger("text/qtextlayout.cpp", 1699, __PRETTY_FUNCTION__).debug("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal()); never executed: QMessageLogger("text/qtextlayout.cpp", 1699, __PRETTY_FUNCTION__).debug("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal()); partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:717667 |
| 0-717667 |
| 1155 | | - |
| 1156 | QFixed newWidth = calculateNewWidth(line); | - |
| 1157 | if (line.length && !manualWrap && (newWidth > line.width || glyphCount > maxGlyphs)) evaluated: line.length| yes Evaluation Count:485596 | yes Evaluation Count:232071 |
evaluated: !manualWrap| yes Evaluation Count:459335 | yes Evaluation Count:26261 |
evaluated: newWidth > line.width| yes Evaluation Count:25186 | yes Evaluation Count:434149 |
partially evaluated: glyphCount > maxGlyphs| no Evaluation Count:0 | yes Evaluation Count:434149 |
| 0-485596 |
| 1158 | return true; executed: return true;Execution Count:25186 | 25186 |
| 1159 | | - |
| 1160 | minw = qMax(minw, tmpData.textWidth); | - |
| 1161 | line += tmpData; | - |
| 1162 | line.textWidth += spaceData.textWidth; | - |
| 1163 | | - |
| 1164 | line.length += spaceData.length; | - |
| 1165 | tmpData.textWidth = 0; | - |
| 1166 | tmpData.length = 0; | - |
| 1167 | spaceData.textWidth = 0; | - |
| 1168 | spaceData.length = 0; | - |
| 1169 | | - |
| 1170 | return false; executed: return false;Execution Count:692481 | 692481 |
| 1171 | } | - |
| 1172 | | - |
| 1173 | } | - |
| 1174 | | - |
| 1175 | | - |
| 1176 | static inline void addNextCluster(int &pos, int end, QScriptLine &line, int &glyphCount, | - |
| 1177 | const QScriptItem ¤t, const unsigned short *logClusters, | - |
| 1178 | const QGlyphLayout &glyphs) | - |
| 1179 | { | - |
| 1180 | int glyphPosition = logClusters[pos]; | - |
| 1181 | do { | - |
| 1182 | ++pos; | - |
| 1183 | ++line.length; | - |
| 1184 | } while (pos < end && logClusters[pos] == glyphPosition); executed: }Execution Count:2974247 evaluated: pos < end| yes Evaluation Count:2768122 | yes Evaluation Count:206125 |
evaluated: logClusters[pos] == glyphPosition| yes Evaluation Count:10716 | yes Evaluation Count:2757406 |
| 10716-2974247 |
| 1185 | do { | - |
| 1186 | if (!glyphs.attributes[glyphPosition].dontPrint) evaluated: !glyphs.attributes[glyphPosition].dontPrint| yes Evaluation Count:3167438 | yes Evaluation Count:1077 |
| 1077-3167438 |
| 1187 | line.textWidth += glyphs.advances_x[glyphPosition]; executed: line.textWidth += glyphs.advances_x[glyphPosition];Execution Count:3167438 | 3167438 |
| 1188 | ++glyphPosition; | - |
| 1189 | } while (glyphPosition < current.num_glyphs && !glyphs.attributes[glyphPosition].clusterStart); executed: }Execution Count:3168515 evaluated: glyphPosition < current.num_glyphs| yes Evaluation Count:2962390 | yes Evaluation Count:206125 |
evaluated: !glyphs.attributes[glyphPosition].clusterStart| yes Evaluation Count:204984 | yes Evaluation Count:2757406 |
| 204984-3168515 |
| 1190 | | - |
| 1191 | qt_noop(); | - |
| 1192 | | - |
| 1193 | ++glyphCount; | - |
| 1194 | } executed: }Execution Count:2963531 | 2963531 |
| 1195 | | - |
| 1196 | | - |
| 1197 | | - |
| 1198 | void QTextLine::layout_helper(int maxGlyphs) | - |
| 1199 | { | - |
| 1200 | QScriptLine &line = eng->lines[index]; | - |
| 1201 | line.length = 0; | - |
| 1202 | line.trailingSpaces = 0; | - |
| 1203 | line.textWidth = 0; | - |
| 1204 | line.hasTrailingSpaces = false; | - |
| 1205 | | - |
| 1206 | if (!eng->layoutData->items.size() || line.from >= eng->layoutData->string.length()) { evaluated: !eng->layoutData->items.size()| yes Evaluation Count:9091 | yes Evaluation Count:232210 |
evaluated: line.from >= eng->layoutData->string.length()| yes Evaluation Count:131 | yes Evaluation Count:232079 |
| 131-232210 |
| 1207 | line.setDefaultHeight(eng); | - |
| 1208 | return; executed: return;Execution Count:9222 | 9222 |
| 1209 | } | - |
| 1210 | | - |
| 1211 | qt_noop(); | - |
| 1212 | | - |
| 1213 | LineBreakHelper lbh; | - |
| 1214 | | - |
| 1215 | lbh.maxGlyphs = maxGlyphs; | - |
| 1216 | | - |
| 1217 | QTextOption::WrapMode wrapMode = eng->option.wrapMode(); | - |
| 1218 | bool breakany = (wrapMode == QTextOption::WrapAnywhere); | - |
| 1219 | lbh.manualWrap = (wrapMode == QTextOption::ManualWrap || wrapMode == QTextOption::NoWrap); evaluated: wrapMode == QTextOption::ManualWrap| yes Evaluation Count:14259 | yes Evaluation Count:217820 |
evaluated: wrapMode == QTextOption::NoWrap| yes Evaluation Count:5 | yes Evaluation Count:217815 |
| 5-217820 |
| 1220 | | - |
| 1221 | int item = -1; | - |
| 1222 | int newItem = eng->findItem(line.from); | - |
| 1223 | | - |
| 1224 | if (0) QMessageLogger("text/qtextlayout.cpp", 1769, __PRETTY_FUNCTION__).debug("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); never executed: QMessageLogger("text/qtextlayout.cpp", 1769, __PRETTY_FUNCTION__).debug("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:232079 |
| 0-232079 |
| 1225 | | - |
| 1226 | Qt::Alignment alignment = eng->option.alignment(); | - |
| 1227 | | - |
| 1228 | const QCharAttributes *attributes = eng->attributes(); | - |
| 1229 | if (!attributes) partially evaluated: !attributes| no Evaluation Count:0 | yes Evaluation Count:232079 |
| 0-232079 |
| 1230 | return; | 0 |
| 1231 | lbh.currentPosition = line.from; | - |
| 1232 | int end = 0; | - |
| 1233 | lbh.logClusters = eng->layoutData->logClustersPtr; | - |
| 1234 | lbh.previousGlyph = 0; | - |
| 1235 | | - |
| 1236 | while (newItem < eng->layoutData->items.size()) { evaluated: newItem < eng->layoutData->items.size()| yes Evaluation Count:822403 | yes Evaluation Count:194345 |
| 194345-822403 |
| 1237 | lbh.resetRightBearing(); | - |
| 1238 | lbh.softHyphenWidth = 0; | - |
| 1239 | if (newItem != item) { evaluated: newItem != item| yes Evaluation Count:243519 | yes Evaluation Count:578884 |
| 243519-578884 |
| 1240 | item = newItem; | - |
| 1241 | const QScriptItem ¤t = eng->layoutData->items[item]; | - |
| 1242 | if (!current.num_glyphs) { evaluated: !current.num_glyphs| yes Evaluation Count:215357 | yes Evaluation Count:28162 |
| 28162-215357 |
| 1243 | eng->shape(item); | - |
| 1244 | attributes = eng->attributes(); | - |
| 1245 | if (!attributes) partially evaluated: !attributes| no Evaluation Count:0 | yes Evaluation Count:215357 |
| 0-215357 |
| 1246 | return; | 0 |
| 1247 | lbh.logClusters = eng->layoutData->logClustersPtr; | - |
| 1248 | } executed: }Execution Count:215357 | 215357 |
| 1249 | lbh.currentPosition = qMax(line.from, current.position); | - |
| 1250 | end = current.position + eng->length(item); | - |
| 1251 | lbh.glyphs = eng->shapedGlyphs(¤t); | - |
| 1252 | QFontEngine *fontEngine = eng->fontEngine(current); | - |
| 1253 | if (lbh.fontEngine != fontEngine) { evaluated: lbh.fontEngine != fontEngine| yes Evaluation Count:232510 | yes Evaluation Count:11009 |
| 11009-232510 |
| 1254 | lbh.fontEngine = fontEngine; | - |
| 1255 | lbh.minimumRightBearing = qMin(QFixed(), | - |
| 1256 | QFixed::fromReal(fontEngine->minRightBearing())); | - |
| 1257 | } executed: }Execution Count:232510 | 232510 |
| 1258 | } executed: }Execution Count:243519 | 243519 |
| 1259 | const QScriptItem ¤t = eng->layoutData->items[item]; | - |
| 1260 | | - |
| 1261 | lbh.tmpData.leading = qMax(lbh.tmpData.leading + lbh.tmpData.ascent, | - |
| 1262 | current.leading + current.ascent) - qMax(lbh.tmpData.ascent, | - |
| 1263 | current.ascent); | - |
| 1264 | lbh.tmpData.ascent = qMax(lbh.tmpData.ascent, current.ascent); | - |
| 1265 | lbh.tmpData.descent = qMax(lbh.tmpData.descent, current.descent); | - |
| 1266 | | - |
| 1267 | if (current.analysis.flags == QScriptAnalysis::Tab && (alignment & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignCenter | Qt::AlignJustify))) { evaluated: current.analysis.flags == QScriptAnalysis::Tab| yes Evaluation Count:7 | yes Evaluation Count:822396 |
partially evaluated: (alignment & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignCenter | Qt::AlignJustify))| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-822396 |
| 1268 | lbh.whiteSpaceOrObject = true; | - |
| 1269 | if (lbh.checkFullOtherwiseExtend(line)) partially evaluated: lbh.checkFullOtherwiseExtend(line)| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 1270 | goto found; never executed: goto found; | 0 |
| 1271 | | - |
| 1272 | QFixed x = line.x + line.textWidth + lbh.tmpData.textWidth + lbh.spaceData.textWidth; | - |
| 1273 | QFixed tabWidth = eng->calculateTabWidth(item, x); | - |
| 1274 | | - |
| 1275 | lbh.spaceData.textWidth += tabWidth; | - |
| 1276 | lbh.spaceData.length++; | - |
| 1277 | newItem = item + 1; | - |
| 1278 | | - |
| 1279 | QFixed averageCharWidth = eng->fontEngine(current)->averageCharWidth(); | - |
| 1280 | lbh.glyphCount += qRound(tabWidth / averageCharWidth); | - |
| 1281 | | - |
| 1282 | if (lbh.checkFullOtherwiseExtend(line)) partially evaluated: lbh.checkFullOtherwiseExtend(line)| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 1283 | goto found; never executed: goto found; | 0 |
| 1284 | } else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) { executed: }Execution Count:7 evaluated: current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator| yes Evaluation Count:10080 | yes Evaluation Count:812316 |
| 7-812316 |
| 1285 | lbh.whiteSpaceOrObject = true; | - |
| 1286 | | - |
| 1287 | | - |
| 1288 | if (!line.length && !lbh.tmpData.length) evaluated: !line.length| yes Evaluation Count:11 | yes Evaluation Count:10069 |
partially evaluated: !lbh.tmpData.length| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-10069 |
| 1289 | line.setDefaultHeight(eng); executed: line.setDefaultHeight(eng);Execution Count:11 | 11 |
| 1290 | if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators) { partially evaluated: eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators| no Evaluation Count:0 | yes Evaluation Count:10080 |
| 0-10080 |
| 1291 | addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, | - |
| 1292 | current, lbh.logClusters, lbh.glyphs); | - |
| 1293 | } else { | 0 |
| 1294 | lbh.tmpData.length++; | - |
| 1295 | lbh.adjustPreviousRightBearing(); | - |
| 1296 | } executed: }Execution Count:10080 | 10080 |
| 1297 | line += lbh.tmpData; | - |
| 1298 | goto found; executed: goto found;Execution Count:10080 | 10080 |
| 1299 | } else if (current.analysis.flags == QScriptAnalysis::Object) { evaluated: current.analysis.flags == QScriptAnalysis::Object| yes Evaluation Count:8 | yes Evaluation Count:812308 |
| 8-812308 |
| 1300 | lbh.whiteSpaceOrObject = true; | - |
| 1301 | lbh.tmpData.length++; | - |
| 1302 | | - |
| 1303 | QTextFormat format = eng->formats()->format(eng->formatIndex(&eng->layoutData->items[item])); | - |
| 1304 | if (eng->block.docHandle()) partially evaluated: eng->block.docHandle()| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 1305 | eng->docLayout()->positionInlineObject(QTextInlineObject(item, eng), eng->block.position() + current.position, format); executed: eng->docLayout()->positionInlineObject(QTextInlineObject(item, eng), eng->block.position() + current.position, format);Execution Count:8 | 8 |
| 1306 | | - |
| 1307 | lbh.tmpData.textWidth += current.width; | - |
| 1308 | | - |
| 1309 | newItem = item + 1; | - |
| 1310 | ++lbh.glyphCount; | - |
| 1311 | if (lbh.checkFullOtherwiseExtend(line)) partially evaluated: lbh.checkFullOtherwiseExtend(line)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1312 | goto found; never executed: goto found; | 0 |
| 1313 | } else if (attributes[lbh.currentPosition].whiteSpace) { executed: }Execution Count:8 evaluated: attributes[lbh.currentPosition].whiteSpace| yes Evaluation Count:288561 | yes Evaluation Count:523747 |
| 8-523747 |
| 1314 | lbh.whiteSpaceOrObject = true; | - |
| 1315 | while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace) evaluated: lbh.currentPosition < end| yes Evaluation Count:577250 | yes Evaluation Count:1063 |
evaluated: attributes[lbh.currentPosition].whiteSpace| yes Evaluation Count:289752 | yes Evaluation Count:287498 |
| 1063-577250 |
| 1316 | addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount, | 289752 |
| 1317 | current, lbh.logClusters, lbh.glyphs); executed: addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs);Execution Count:289752 | 289752 |
| 1318 | | - |
| 1319 | if (!lbh.manualWrap && lbh.spaceData.textWidth > line.width) { evaluated: !lbh.manualWrap| yes Evaluation Count:276435 | yes Evaluation Count:12126 |
evaluated: lbh.spaceData.textWidth > line.width| yes Evaluation Count:2765 | yes Evaluation Count:273670 |
| 2765-276435 |
| 1320 | lbh.spaceData.textWidth = line.width; | - |
| 1321 | goto found; executed: goto found;Execution Count:2765 | 2765 |
| 1322 | } | - |
| 1323 | } else { executed: }Execution Count:285796 | 285796 |
| 1324 | lbh.whiteSpaceOrObject = false; | - |
| 1325 | bool sb_or_ws = false; | - |
| 1326 | lbh.saveCurrentGlyph(); | - |
| 1327 | do { | - |
| 1328 | addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, | - |
| 1329 | current, lbh.logClusters, lbh.glyphs); | - |
| 1330 | | - |
| 1331 | if (lbh.currentPosition >= eng->layoutData->string.length() evaluated: lbh.currentPosition >= eng->layoutData->string.length()| yes Evaluation Count:194088 | yes Evaluation Count:2479691 |
| 194088-2479691 |
| 1332 | || attributes[lbh.currentPosition].whiteSpace evaluated: attributes[lbh.currentPosition].whiteSpace| yes Evaluation Count:322893 | yes Evaluation Count:2156798 |
| 322893-2156798 |
| 1333 | || attributes[lbh.currentPosition].lineBreak) { evaluated: attributes[lbh.currentPosition].lineBreak| yes Evaluation Count:5968 | yes Evaluation Count:2150830 |
| 5968-2150830 |
| 1334 | sb_or_ws = true; | - |
| 1335 | break; executed: break;Execution Count:522949 | 522949 |
| 1336 | } else if (breakany && attributes[lbh.currentPosition].graphemeBoundary) { evaluated: breakany| yes Evaluation Count:351 | yes Evaluation Count:2150479 |
partially evaluated: attributes[lbh.currentPosition].graphemeBoundary| yes Evaluation Count:351 | no Evaluation Count:0 |
| 0-2150479 |
| 1337 | break; executed: break;Execution Count:351 | 351 |
| 1338 | } | - |
| 1339 | } while (lbh.currentPosition < end); evaluated: lbh.currentPosition < end| yes Evaluation Count:2150032 | yes Evaluation Count:447 |
| 447-2150032 |
| 1340 | lbh.minw = qMax(lbh.tmpData.textWidth, lbh.minw); | - |
| 1341 | | - |
| 1342 | if (lbh.currentPosition > 0 && lbh.currentPosition < end partially evaluated: lbh.currentPosition > 0| yes Evaluation Count:523747 | no Evaluation Count:0 |
evaluated: lbh.currentPosition < end| yes Evaluation Count:318685 | yes Evaluation Count:205062 |
| 0-523747 |
| 1343 | && attributes[lbh.currentPosition].lineBreak evaluated: attributes[lbh.currentPosition].lineBreak| yes Evaluation Count:5964 | yes Evaluation Count:312721 |
| 5964-312721 |
| 1344 | && eng->layoutData->string.at(lbh.currentPosition - 1).unicode() == QChar::SoftHyphen) { partially evaluated: eng->layoutData->string.at(lbh.currentPosition - 1).unicode() == QChar::SoftHyphen| no Evaluation Count:0 | yes Evaluation Count:5964 |
| 0-5964 |
| 1345 | if (line.length) never evaluated: line.length | 0 |
| 1346 | lbh.softHyphenWidth = lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]]; never executed: lbh.softHyphenWidth = lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]]; | 0 |
| 1347 | else if (breakany) never evaluated: breakany | 0 |
| 1348 | lbh.tmpData.textWidth += lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]]; never executed: lbh.tmpData.textWidth += lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]]; | 0 |
| 1349 | } | - |
| 1350 | | - |
| 1351 | | - |
| 1352 | | - |
| 1353 | | - |
| 1354 | | - |
| 1355 | | - |
| 1356 | | - |
| 1357 | if (sb_or_ws|breakany) { evaluated: sb_or_ws|breakany| yes Evaluation Count:523300 | yes Evaluation Count:447 |
| 447-523300 |
| 1358 | QFixed rightBearing = lbh.rightBearing; | - |
| 1359 | if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) evaluated: lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width| yes Evaluation Count:37520 | yes Evaluation Count:485780 |
| 37520-485780 |
| 1360 | lbh.adjustRightBearing(); executed: lbh.adjustRightBearing();Execution Count:37520 | 37520 |
| 1361 | if (lbh.checkFullOtherwiseExtend(line)) { evaluated: lbh.checkFullOtherwiseExtend(line)| yes Evaluation Count:24889 | yes Evaluation Count:498411 |
| 24889-498411 |
| 1362 | | - |
| 1363 | if (rightBearing <= 0) partially evaluated: rightBearing <= 0| no Evaluation Count:0 | yes Evaluation Count:24889 |
| 0-24889 |
| 1364 | lbh.rightBearing = rightBearing; never executed: lbh.rightBearing = rightBearing; | 0 |
| 1365 | else | - |
| 1366 | lbh.adjustPreviousRightBearing(); executed: lbh.adjustPreviousRightBearing();Execution Count:24889 | 24889 |
| 1367 | | - |
| 1368 | if (!breakany) { evaluated: !breakany| yes Evaluation Count:24858 | yes Evaluation Count:31 |
| 31-24858 |
| 1369 | line.textWidth += lbh.softHyphenWidth; | - |
| 1370 | } executed: }Execution Count:24858 | 24858 |
| 1371 | | - |
| 1372 | goto found; executed: goto found;Execution Count:24889 | 24889 |
| 1373 | } | - |
| 1374 | } executed: }Execution Count:498411 | 498411 |
| 1375 | lbh.saveCurrentGlyph(); | - |
| 1376 | } executed: }Execution Count:498858 | 498858 |
| 1377 | if (lbh.currentPosition == end) evaluated: lbh.currentPosition == end| yes Evaluation Count:205770 | yes Evaluation Count:578899 |
| 205770-578899 |
| 1378 | newItem = item + 1; executed: newItem = item + 1;Execution Count:205770 | 205770 |
| 1379 | } executed: }Execution Count:784669 | 784669 |
| 1380 | if (0) QMessageLogger("text/qtextlayout.cpp", 1941, __PRETTY_FUNCTION__).debug("reached end of line"); never executed: QMessageLogger("text/qtextlayout.cpp", 1941, __PRETTY_FUNCTION__).debug("reached end of line"); partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:194345 |
| 0-194345 |
| 1381 | lbh.checkFullOtherwiseExtend(line); | - |
| 1382 | found: code before this statement executed: found:Execution Count:194345 | 194345 |
| 1383 | if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) evaluated: lbh.rightBearing > 0| yes Evaluation Count:192547 | yes Evaluation Count:39532 |
evaluated: !lbh.whiteSpaceOrObject| yes Evaluation Count:189224 | yes Evaluation Count:3323 |
| 3323-192547 |
| 1384 | lbh.adjustRightBearing(); executed: lbh.adjustRightBearing();Execution Count:189224 | 189224 |
| 1385 | line.textAdvance = line.textWidth; | - |
| 1386 | line.textWidth -= qMin(QFixed(), lbh.rightBearing); | - |
| 1387 | | - |
| 1388 | if (line.length == 0) { partially evaluated: line.length == 0| no Evaluation Count:0 | yes Evaluation Count:232079 |
| 0-232079 |
| 1389 | if (0) QMessageLogger("text/qtextlayout.cpp", 1950, __PRETTY_FUNCTION__).debug("no break available in line, adding temp: length %d, width %f, space: length %d, width %f", | 0 |
| 1390 | lbh.tmpData.length, lbh.tmpData.textWidth.toReal(), | 0 |
| 1391 | lbh.spaceData.length, lbh.spaceData.textWidth.toReal()); never executed: QMessageLogger("text/qtextlayout.cpp", 1950, __PRETTY_FUNCTION__).debug("no break available in line, adding temp: length %d, width %f, space: length %d, width %f", lbh.tmpData.length, lbh.tmpData.textWidth.toReal(), lbh.spaceData.length, lbh.spaceData.textWidth.toReal()); | 0 |
| 1392 | line += lbh.tmpData; | - |
| 1393 | } | 0 |
| 1394 | | - |
| 1395 | if (0) QMessageLogger("text/qtextlayout.cpp", 1956, __PRETTY_FUNCTION__).debug("line length = %d, ascent=%f, descent=%f, textWidth=%f (spacew=%f)", line.length, line.ascent.toReal(), partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:232079 |
| 0-232079 |
| 1396 | line.descent.toReal(), line.textWidth.toReal(), lbh.spaceData.width.toReal()); never executed: QMessageLogger("text/qtextlayout.cpp", 1956, __PRETTY_FUNCTION__).debug("line length = %d, ascent=%f, descent=%f, textWidth=%f (spacew=%f)", line.length, line.ascent.toReal(), line.descent.toReal(), line.textWidth.toReal(), lbh.spaceData.width.toReal()); | 0 |
| 1397 | if (0) QMessageLogger("text/qtextlayout.cpp", 1958, __PRETTY_FUNCTION__).debug(" : '%s'", eng->layoutData->string.mid(line.from, line.length).toUtf8().data()); never executed: QMessageLogger("text/qtextlayout.cpp", 1958, __PRETTY_FUNCTION__).debug(" : '%s'", eng->layoutData->string.mid(line.from, line.length).toUtf8().data()); partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:232079 |
| 0-232079 |
| 1398 | | - |
| 1399 | if (lbh.manualWrap) { evaluated: lbh.manualWrap| yes Evaluation Count:14264 | yes Evaluation Count:217815 |
| 14264-217815 |
| 1400 | eng->minWidth = qMax(eng->minWidth, line.textWidth); | - |
| 1401 | eng->maxWidth = qMax(eng->maxWidth, line.textWidth); | - |
| 1402 | } else { executed: }Execution Count:14264 | 14264 |
| 1403 | eng->minWidth = qMax(eng->minWidth, lbh.minw); | - |
| 1404 | eng->maxWidth += line.textWidth; | - |
| 1405 | } executed: }Execution Count:217815 | 217815 |
| 1406 | | - |
| 1407 | if (line.textWidth > 0 && item < eng->layoutData->items.size()) evaluated: line.textWidth > 0| yes Evaluation Count:232064 | yes Evaluation Count:15 |
partially evaluated: item < eng->layoutData->items.size()| yes Evaluation Count:232064 | no Evaluation Count:0 |
| 0-232064 |
| 1408 | eng->maxWidth += lbh.spaceData.textWidth; executed: eng->maxWidth += lbh.spaceData.textWidth;Execution Count:232064 | 232064 |
| 1409 | if (eng->option.flags() & QTextOption::IncludeTrailingSpaces) evaluated: eng->option.flags() & QTextOption::IncludeTrailingSpaces| yes Evaluation Count:6482 | yes Evaluation Count:225597 |
| 6482-225597 |
| 1410 | line.textWidth += lbh.spaceData.textWidth; executed: line.textWidth += lbh.spaceData.textWidth;Execution Count:6482 | 6482 |
| 1411 | if (lbh.spaceData.length) { evaluated: lbh.spaceData.length| yes Evaluation Count:27361 | yes Evaluation Count:204718 |
| 27361-204718 |
| 1412 | line.trailingSpaces = lbh.spaceData.length; | - |
| 1413 | line.hasTrailingSpaces = true; | - |
| 1414 | } executed: }Execution Count:27361 | 27361 |
| 1415 | | - |
| 1416 | line.justified = false; | - |
| 1417 | line.gridfitted = false; | - |
| 1418 | | - |
| 1419 | if (eng->option.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere) { evaluated: eng->option.wrapMode() == QTextOption::WrapAtWordBoundaryOrAnywhere| yes Evaluation Count:22779 | yes Evaluation Count:209300 |
| 22779-209300 |
| 1420 | if ((lbh.maxGlyphs != 2147483647 && lbh.glyphCount > lbh.maxGlyphs) partially evaluated: lbh.maxGlyphs != 2147483647| no Evaluation Count:0 | yes Evaluation Count:22779 |
never evaluated: lbh.glyphCount > lbh.maxGlyphs | 0-22779 |
| 1421 | || (lbh.maxGlyphs == 2147483647 && line.textWidth > line.width)) { partially evaluated: lbh.maxGlyphs == 2147483647| yes Evaluation Count:22779 | no Evaluation Count:0 |
evaluated: line.textWidth > line.width| yes Evaluation Count:32 | yes Evaluation Count:22747 |
| 0-22779 |
| 1422 | | - |
| 1423 | eng->option.setWrapMode(QTextOption::WrapAnywhere); | - |
| 1424 | line.length = 0; | - |
| 1425 | line.textWidth = 0; | - |
| 1426 | layout_helper(lbh.maxGlyphs); | - |
| 1427 | eng->option.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); | - |
| 1428 | } executed: }Execution Count:32 | 32 |
| 1429 | } executed: }Execution Count:22779 | 22779 |
| 1430 | } executed: }Execution Count:232079 | 232079 |
| 1431 | | - |
| 1432 | | - |
| 1433 | | - |
| 1434 | | - |
| 1435 | void QTextLine::setPosition(const QPointF &pos) | - |
| 1436 | { | - |
| 1437 | eng->lines[index].x = QFixed::fromReal(pos.x()); | - |
| 1438 | eng->lines[index].y = QFixed::fromReal(pos.y()); | - |
| 1439 | } executed: }Execution Count:225885 | 225885 |
| 1440 | | - |
| 1441 | | - |
| 1442 | | - |
| 1443 | | - |
| 1444 | QPointF QTextLine::position() const | - |
| 1445 | { | - |
| 1446 | return QPointF(eng->lines[index].x.toReal(), eng->lines[index].y.toReal()); never executed: return QPointF(eng->lines[index].x.toReal(), eng->lines[index].y.toReal()); | 0 |
| 1447 | } | - |
| 1448 | int QTextLine::textStart() const | - |
| 1449 | { | - |
| 1450 | return eng->lines[index].from; executed: return eng->lines[index].from;Execution Count:926 | 926 |
| 1451 | } | - |
| 1452 | | - |
| 1453 | | - |
| 1454 | | - |
| 1455 | | - |
| 1456 | | - |
| 1457 | | - |
| 1458 | int QTextLine::textLength() const | - |
| 1459 | { | - |
| 1460 | if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators partially evaluated: eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators| no Evaluation Count:0 | yes Evaluation Count:987 |
| 0-987 |
| 1461 | && eng->block.isValid() && index == eng->lines.count()-1) { never evaluated: eng->block.isValid() never evaluated: index == eng->lines.count()-1 | 0 |
| 1462 | return eng->lines[index].length - 1; never executed: return eng->lines[index].length - 1; | 0 |
| 1463 | } | - |
| 1464 | return eng->lines[index].length + eng->lines[index].trailingSpaces; executed: return eng->lines[index].length + eng->lines[index].trailingSpaces;Execution Count:987 | 987 |
| 1465 | } | - |
| 1466 | | - |
| 1467 | static void drawMenuText(QPainter *p, QFixed x, QFixed y, const QScriptItem &si, QTextItemInt &gf, QTextEngine *eng, | - |
| 1468 | int start, int glyph_start) | - |
| 1469 | { | - |
| 1470 | int ge = glyph_start + gf.glyphs.numGlyphs; | - |
| 1471 | int gs = glyph_start; | - |
| 1472 | int end = start + gf.num_chars; | - |
| 1473 | unsigned short *logClusters = eng->logClusters(&si); | - |
| 1474 | QGlyphLayout glyphs = eng->shapedGlyphs(&si); | - |
| 1475 | QFixed orig_width = gf.width; | - |
| 1476 | | - |
| 1477 | int *ul = eng->underlinePositions; | - |
| 1478 | if (ul) partially evaluated: ul| yes Evaluation Count:3871 | no Evaluation Count:0 |
| 0-3871 |
| 1479 | while (*ul != -1 && *ul < start) evaluated: *ul != -1| yes Evaluation Count:518 | yes Evaluation Count:3353 |
partially evaluated: *ul < start| no Evaluation Count:0 | yes Evaluation Count:518 |
| 0-3353 |
| 1480 | ++ul; | 0 |
| 1481 | bool rtl = si.analysis.bidiLevel % 2; | - |
| 1482 | if (rtl) evaluated: rtl| yes Evaluation Count:11 | yes Evaluation Count:3860 |
| 11-3860 |
| 1483 | x += si.width; executed: x += si.width;Execution Count:11 | 11 |
| 1484 | | - |
| 1485 | do { | - |
| 1486 | int gtmp = ge; | - |
| 1487 | int stmp = end; | - |
| 1488 | if (ul && *ul != -1 && *ul < end) { partially evaluated: ul| yes Evaluation Count:4372 | no Evaluation Count:0 |
evaluated: *ul != -1| yes Evaluation Count:519 | yes Evaluation Count:3853 |
partially evaluated: *ul < end| yes Evaluation Count:519 | no Evaluation Count:0 |
| 0-4372 |
| 1489 | stmp = *ul; | - |
| 1490 | gtmp = logClusters[*ul-si.position]; | - |
| 1491 | } executed: }Execution Count:519 | 519 |
| 1492 | | - |
| 1493 | gf.glyphs = glyphs.mid(gs, gtmp - gs); | - |
| 1494 | gf.num_chars = stmp - start; | - |
| 1495 | gf.chars = eng->layoutData->string.unicode() + start; | - |
| 1496 | QFixed w = 0; | - |
| 1497 | while (gs < gtmp) { evaluated: gs < gtmp| yes Evaluation Count:18727 | yes Evaluation Count:4372 |
| 4372-18727 |
| 1498 | w += glyphs.effectiveAdvance(gs); | - |
| 1499 | ++gs; | - |
| 1500 | } executed: }Execution Count:18727 | 18727 |
| 1501 | start = stmp; | - |
| 1502 | gf.width = w; | - |
| 1503 | if (rtl) evaluated: rtl| yes Evaluation Count:11 | yes Evaluation Count:4361 |
| 11-4361 |
| 1504 | x -= w; executed: x -= w;Execution Count:11 | 11 |
| 1505 | if (gf.num_chars) evaluated: gf.num_chars| yes Evaluation Count:3943 | yes Evaluation Count:429 |
| 429-3943 |
| 1506 | QPainterPrivate::get(p)->drawTextItem(QPointF(x.toReal(), y.toReal()), gf, eng); executed: QPainterPrivate::get(p)->drawTextItem(QPointF(x.toReal(), y.toReal()), gf, eng);Execution Count:3943 | 3943 |
| 1507 | if (!rtl) evaluated: !rtl| yes Evaluation Count:4361 | yes Evaluation Count:11 |
| 11-4361 |
| 1508 | x += w; executed: x += w;Execution Count:4361 | 4361 |
| 1509 | if (ul && *ul != -1 && *ul < end) { partially evaluated: ul| yes Evaluation Count:4372 | no Evaluation Count:0 |
evaluated: *ul != -1| yes Evaluation Count:519 | yes Evaluation Count:3853 |
partially evaluated: *ul < end| yes Evaluation Count:519 | no Evaluation Count:0 |
| 0-4372 |
| 1510 | | - |
| 1511 | gtmp = (*ul == end-1) ? ge : logClusters[*ul+1-si.position]; evaluated: (*ul == end-1)| yes Evaluation Count:18 | yes Evaluation Count:501 |
| 18-501 |
| 1512 | ++stmp; | - |
| 1513 | gf.glyphs = glyphs.mid(gs, gtmp - gs); | - |
| 1514 | gf.num_chars = stmp - start; | - |
| 1515 | gf.chars = eng->layoutData->string.unicode() + start; | - |
| 1516 | gf.logClusters = logClusters + start - si.position; | - |
| 1517 | w = 0; | - |
| 1518 | while (gs < gtmp) { evaluated: gs < gtmp| yes Evaluation Count:518 | yes Evaluation Count:519 |
| 518-519 |
| 1519 | w += glyphs.effectiveAdvance(gs); | - |
| 1520 | ++gs; | - |
| 1521 | } executed: }Execution Count:518 | 518 |
| 1522 | ++start; | - |
| 1523 | gf.width = w; | - |
| 1524 | gf.underlineStyle = QTextCharFormat::SingleUnderline; | - |
| 1525 | if (rtl) partially evaluated: rtl| no Evaluation Count:0 | yes Evaluation Count:519 |
| 0-519 |
| 1526 | x -= w; | 0 |
| 1527 | QPainterPrivate::get(p)->drawTextItem(QPointF(x.toReal(), y.toReal()), gf, eng); | - |
| 1528 | if (!rtl) partially evaluated: !rtl| yes Evaluation Count:519 | no Evaluation Count:0 |
| 0-519 |
| 1529 | x += w; executed: x += w;Execution Count:519 | 519 |
| 1530 | gf.underlineStyle = QTextCharFormat::NoUnderline; | - |
| 1531 | ++gf.chars; | - |
| 1532 | ++ul; | - |
| 1533 | } executed: }Execution Count:519 | 519 |
| 1534 | } while (gs < ge); executed: }Execution Count:4372 evaluated: gs < ge| yes Evaluation Count:501 | yes Evaluation Count:3871 |
| 501-4372 |
| 1535 | | - |
| 1536 | gf.width = orig_width; | - |
| 1537 | } executed: }Execution Count:3871 | 3871 |
| 1538 | | - |
| 1539 | | - |
| 1540 | static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const QTextCharFormat &chf, const QRectF &r) | - |
| 1541 | { | - |
| 1542 | QBrush c = chf.foreground(); | - |
| 1543 | if (c.style() == Qt::NoBrush) { evaluated: c.style() == Qt::NoBrush| yes Evaluation Count:309 | yes Evaluation Count:60 |
| 60-309 |
| 1544 | p->setPen(defaultPen); | - |
| 1545 | } executed: }Execution Count:309 | 309 |
| 1546 | | - |
| 1547 | QBrush bg = chf.background(); | - |
| 1548 | if (bg.style() != Qt::NoBrush && !chf.property(0x513).toBool()) partially evaluated: bg.style() != Qt::NoBrush| no Evaluation Count:0 | yes Evaluation Count:369 |
never evaluated: !chf.property(0x513).toBool() | 0-369 |
| 1549 | p->fillRect(r, bg); never executed: p->fillRect(r, bg); | 0 |
| 1550 | if (c.style() != Qt::NoBrush) { evaluated: c.style() != Qt::NoBrush| yes Evaluation Count:60 | yes Evaluation Count:309 |
| 60-309 |
| 1551 | p->setPen(QPen(c, 0)); | - |
| 1552 | } executed: }Execution Count:60 | 60 |
| 1553 | | - |
| 1554 | } executed: }Execution Count:369 | 369 |
| 1555 | | - |
| 1556 | | - |
| 1557 | static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &glyphLayout, | - |
| 1558 | const QPointF &pos, const QGlyphRun::GlyphRunFlags &flags, | - |
| 1559 | const QFixed &selectionX, const QFixed &selectionWidth) | - |
| 1560 | { | - |
| 1561 | QGlyphRun glyphRun; | - |
| 1562 | | - |
| 1563 | | - |
| 1564 | QRawFont font; | - |
| 1565 | QRawFontPrivate *fontD = QRawFontPrivate::get(font); | - |
| 1566 | fontD->fontEngine = fontEngine; | - |
| 1567 | fontD->thread = QThread::currentThread(); | - |
| 1568 | fontD->fontEngine->ref.ref(); | - |
| 1569 | QVarLengthArray<glyph_t> glyphsArray; | - |
| 1570 | QVarLengthArray<QFixedPoint> positionsArray; | - |
| 1571 | | - |
| 1572 | QTextItem::RenderFlags renderFlags; | - |
| 1573 | if (flags.testFlag(QGlyphRun::Overline)) evaluated: flags.testFlag(QGlyphRun::Overline)| yes Evaluation Count:2 | yes Evaluation Count:21 |
| 2-21 |
| 1574 | renderFlags |= QTextItem::Overline; executed: renderFlags |= QTextItem::Overline;Execution Count:2 | 2 |
| 1575 | if (flags.testFlag(QGlyphRun::Underline)) evaluated: flags.testFlag(QGlyphRun::Underline)| yes Evaluation Count:4 | yes Evaluation Count:19 |
| 4-19 |
| 1576 | renderFlags |= QTextItem::Underline; executed: renderFlags |= QTextItem::Underline;Execution Count:4 | 4 |
| 1577 | if (flags.testFlag(QGlyphRun::StrikeOut)) evaluated: flags.testFlag(QGlyphRun::StrikeOut)| yes Evaluation Count:2 | yes Evaluation Count:21 |
| 2-21 |
| 1578 | renderFlags |= QTextItem::StrikeOut; executed: renderFlags |= QTextItem::StrikeOut;Execution Count:2 | 2 |
| 1579 | if (flags.testFlag(QGlyphRun::RightToLeft)) evaluated: flags.testFlag(QGlyphRun::RightToLeft)| yes Evaluation Count:7 | yes Evaluation Count:16 |
| 7-16 |
| 1580 | renderFlags |= QTextItem::RightToLeft; executed: renderFlags |= QTextItem::RightToLeft;Execution Count:7 | 7 |
| 1581 | | - |
| 1582 | fontEngine->getGlyphPositions(glyphLayout, QTransform(), renderFlags, glyphsArray, | - |
| 1583 | positionsArray); | - |
| 1584 | qt_noop(); | - |
| 1585 | | - |
| 1586 | qreal fontHeight = font.ascent() + font.descent(); | - |
| 1587 | qreal minY = 0; | - |
| 1588 | qreal maxY = 0; | - |
| 1589 | QVector<quint32> glyphs; | - |
| 1590 | QVector<QPointF> positions; | - |
| 1591 | for (int i=0; i<glyphsArray.size(); ++i) { evaluated: i<glyphsArray.size()| yes Evaluation Count:95 | yes Evaluation Count:23 |
| 23-95 |
| 1592 | glyphs.append(glyphsArray.at(i) & 0xffffff); | - |
| 1593 | | - |
| 1594 | QPointF position = positionsArray.at(i).toPointF() + pos; | - |
| 1595 | positions.append(position); | - |
| 1596 | | - |
| 1597 | if (i == 0) { evaluated: i == 0| yes Evaluation Count:23 | yes Evaluation Count:72 |
| 23-72 |
| 1598 | maxY = minY = position.y(); | - |
| 1599 | } else { executed: }Execution Count:23 | 23 |
| 1600 | minY = qMin(minY, position.y()); | - |
| 1601 | maxY = qMax(maxY, position.y()); | - |
| 1602 | } executed: }Execution Count:72 | 72 |
| 1603 | } | - |
| 1604 | | - |
| 1605 | qreal height = maxY + fontHeight - minY; | - |
| 1606 | | - |
| 1607 | glyphRun.setGlyphIndexes(glyphs); | - |
| 1608 | glyphRun.setPositions(positions); | - |
| 1609 | glyphRun.setFlags(flags); | - |
| 1610 | glyphRun.setRawFont(font); | - |
| 1611 | | - |
| 1612 | glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY - font.ascent(), | - |
| 1613 | selectionWidth.toReal(), height)); | - |
| 1614 | | - |
| 1615 | return glyphRun; executed: return glyphRun;Execution Count:23 | 23 |
| 1616 | } | - |
| 1617 | QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const | - |
| 1618 | { | - |
| 1619 | const QScriptLine &line = eng->lines[index]; | - |
| 1620 | | - |
| 1621 | if (line.length == 0) partially evaluated: line.length == 0| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 1622 | return QList<QGlyphRun>(); never executed: return QList<QGlyphRun>(); | 0 |
| 1623 | | - |
| 1624 | if (from < 0) partially evaluated: from < 0| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 1625 | from = textStart(); never executed: from = textStart(); | 0 |
| 1626 | | - |
| 1627 | if (length < 0) partially evaluated: length < 0| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 1628 | length = textLength(); never executed: length = textLength(); | 0 |
| 1629 | | - |
| 1630 | if (length == 0) partially evaluated: length == 0| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 1631 | return QList<QGlyphRun>(); never executed: return QList<QGlyphRun>(); | 0 |
| 1632 | | - |
| 1633 | QTextLayout::FormatRange selection; | - |
| 1634 | selection.start = from; | - |
| 1635 | selection.length = length; | - |
| 1636 | | - |
| 1637 | QTextLineItemIterator iterator(eng, index, QPointF(), &selection); | - |
| 1638 | qreal y = line.y.toReal() + line.base().toReal(); | - |
| 1639 | QList<QGlyphRun> glyphRuns; | - |
| 1640 | while (!iterator.atEnd()) { evaluated: !iterator.atEnd()| yes Evaluation Count:23 | yes Evaluation Count:22 |
| 22-23 |
| 1641 | QScriptItem &si = iterator.next(); | - |
| 1642 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject) partially evaluated: si.analysis.flags >= QScriptAnalysis::TabOrObject| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1643 | continue; never executed: continue; | 0 |
| 1644 | | - |
| 1645 | QPointF pos(iterator.x.toReal(), y); | - |
| 1646 | if (from >= 0 && length >= 0 && partially evaluated: from >= 0| yes Evaluation Count:23 | no Evaluation Count:0 |
partially evaluated: length >= 0| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
| 1647 | (from >= si.position + eng->length(&si) partially evaluated: from >= si.position + eng->length(&si)| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1648 | || from + length <= si.position partially evaluated: from + length <= si.position| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1649 | || from + length <= iterator.itemStart partially evaluated: from + length <= iterator.itemStart| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1650 | || from >= iterator.itemEnd)) { partially evaluated: from >= iterator.itemEnd| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1651 | continue; never executed: continue; | 0 |
| 1652 | } | - |
| 1653 | | - |
| 1654 | QFont font; | - |
| 1655 | QGlyphRun::GlyphRunFlags flags; | - |
| 1656 | if (!eng->useRawFont) { partially evaluated: !eng->useRawFont| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
| 1657 | font = eng->font(si); | - |
| 1658 | if (font.overline()) evaluated: font.overline()| yes Evaluation Count:2 | yes Evaluation Count:21 |
| 2-21 |
| 1659 | flags |= QGlyphRun::Overline; executed: flags |= QGlyphRun::Overline;Execution Count:2 | 2 |
| 1660 | if (font.underline()) evaluated: font.underline()| yes Evaluation Count:4 | yes Evaluation Count:19 |
| 4-19 |
| 1661 | flags |= QGlyphRun::Underline; executed: flags |= QGlyphRun::Underline;Execution Count:4 | 4 |
| 1662 | if (font.strikeOut()) evaluated: font.strikeOut()| yes Evaluation Count:2 | yes Evaluation Count:21 |
| 2-21 |
| 1663 | flags |= QGlyphRun::StrikeOut; executed: flags |= QGlyphRun::StrikeOut;Execution Count:2 | 2 |
| 1664 | } executed: }Execution Count:23 | 23 |
| 1665 | | - |
| 1666 | bool rtl = false; | - |
| 1667 | if (si.analysis.bidiLevel % 2) { evaluated: si.analysis.bidiLevel % 2| yes Evaluation Count:7 | yes Evaluation Count:16 |
| 7-16 |
| 1668 | flags |= QGlyphRun::RightToLeft; | - |
| 1669 | rtl = true; | - |
| 1670 | } executed: }Execution Count:7 | 7 |
| 1671 | | - |
| 1672 | int relativeFrom = qMax(iterator.itemStart, from) - si.position; | - |
| 1673 | int relativeTo = qMin(iterator.itemEnd - 1, from + length - 1) - si.position; | - |
| 1674 | | - |
| 1675 | unsigned short *logClusters = eng->logClusters(&si); | - |
| 1676 | int glyphsStart = logClusters[relativeFrom]; | - |
| 1677 | int glyphsEnd = (relativeTo == eng->length(&si)) partially evaluated: (relativeTo == eng->length(&si))| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1678 | ? si.num_glyphs - 1 | - |
| 1679 | : logClusters[relativeTo]; | - |
| 1680 | | - |
| 1681 | int nextGlyphIndex = relativeTo < eng->length(&si) - 1 ? logClusters[relativeTo + 1] : si.num_glyphs; partially evaluated: relativeTo < eng->length(&si) - 1| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1682 | if (nextGlyphIndex - 1 > glyphsEnd) partially evaluated: nextGlyphIndex - 1 > glyphsEnd| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1683 | glyphsEnd = nextGlyphIndex - 1; never executed: glyphsEnd = nextGlyphIndex - 1; | 0 |
| 1684 | bool startsInsideLigature = relativeFrom > 0 && logClusters[relativeFrom - 1] == glyphsStart; partially evaluated: relativeFrom > 0| no Evaluation Count:0 | yes Evaluation Count:23 |
never evaluated: logClusters[relativeFrom - 1] == glyphsStart | 0-23 |
| 1685 | bool endsInsideLigature = nextGlyphIndex == glyphsEnd; | - |
| 1686 | | - |
| 1687 | int itemGlyphsStart = logClusters[iterator.itemStart - si.position]; | - |
| 1688 | int itemGlyphsEnd = logClusters[iterator.itemEnd - 1 - si.position]; | - |
| 1689 | | - |
| 1690 | QGlyphLayout glyphLayout = eng->shapedGlyphs(&si); | - |
| 1691 | | - |
| 1692 | | - |
| 1693 | | - |
| 1694 | | - |
| 1695 | if (relativeFrom != (iterator.itemStart - si.position) && !rtl) { partially evaluated: relativeFrom != (iterator.itemStart - si.position)| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1696 | for (int i=itemGlyphsStart; i<glyphsStart; ++i) { never evaluated: i<glyphsStart | 0 |
| 1697 | QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6); | - |
| 1698 | pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), | - |
| 1699 | glyphLayout.advances_y[i].toReal()); | - |
| 1700 | } | 0 |
| 1701 | } else if (relativeTo != (iterator.itemEnd - si.position - 1) && rtl) { partially evaluated: relativeTo != (iterator.itemEnd - si.position - 1)| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1702 | for (int i=itemGlyphsEnd; i>glyphsEnd; --i) { never evaluated: i>glyphsEnd | 0 |
| 1703 | QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6); | - |
| 1704 | pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), | - |
| 1705 | glyphLayout.advances_y[i].toReal()); | - |
| 1706 | } | 0 |
| 1707 | } | 0 |
| 1708 | | - |
| 1709 | glyphLayout = glyphLayout.mid(glyphsStart, glyphsEnd - glyphsStart + 1); | - |
| 1710 | | - |
| 1711 | QFixed x; | - |
| 1712 | QFixed width; | - |
| 1713 | iterator.getSelectionBounds(&x, &width); | - |
| 1714 | | - |
| 1715 | if (glyphLayout.numGlyphs > 0) { partially evaluated: glyphLayout.numGlyphs > 0| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
| 1716 | QFontEngine *mainFontEngine; | - |
| 1717 | | - |
| 1718 | if (eng->useRawFont && eng->rawFont.isValid()) partially evaluated: eng->useRawFont| no Evaluation Count:0 | yes Evaluation Count:23 |
never evaluated: eng->rawFont.isValid() | 0-23 |
| 1719 | mainFontEngine= eng->fontEngine(si); never executed: mainFontEngine= eng->fontEngine(si); | 0 |
| 1720 | else | - |
| 1721 | | - |
| 1722 | mainFontEngine = font.d->engineForScript(si.analysis.script); executed: mainFontEngine = font.d->engineForScript(si.analysis.script);Execution Count:23 | 23 |
| 1723 | | - |
| 1724 | if (mainFontEngine->type() == QFontEngine::Multi) { partially evaluated: mainFontEngine->type() == QFontEngine::Multi| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
| 1725 | QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine); | - |
| 1726 | int end = rtl ? glyphLayout.numGlyphs : 0; evaluated: rtl| yes Evaluation Count:7 | yes Evaluation Count:16 |
| 7-16 |
| 1727 | int start = rtl ? end : 0; evaluated: rtl| yes Evaluation Count:7 | yes Evaluation Count:16 |
| 7-16 |
| 1728 | int which = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24; | - |
| 1729 | for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs); evaluated: rtl| yes Evaluation Count:28 | yes Evaluation Count:90 |
evaluated: start > 0| yes Evaluation Count:21 | yes Evaluation Count:7 |
evaluated: !rtl| yes Evaluation Count:90 | yes Evaluation Count:7 |
evaluated: end < glyphLayout.numGlyphs| yes Evaluation Count:74 | yes Evaluation Count:16 |
| 7-90 |
| 1730 | rtl ? --start : ++end) { | - |
| 1731 | const int e = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24; | - |
| 1732 | if (e == which) partially evaluated: e == which| yes Evaluation Count:95 | no Evaluation Count:0 |
| 0-95 |
| 1733 | continue; executed: continue;Execution Count:95 | 95 |
| 1734 | | - |
| 1735 | QGlyphLayout subLayout = glyphLayout.mid(start, end - start); | - |
| 1736 | multiFontEngine->ensureEngineAt(which); | - |
| 1737 | | - |
| 1738 | QGlyphRun::GlyphRunFlags subFlags = flags; | - |
| 1739 | if (start == 0 && startsInsideLigature) never evaluated: start == 0 never evaluated: startsInsideLigature | 0 |
| 1740 | subFlags |= QGlyphRun::SplitLigature; never executed: subFlags |= QGlyphRun::SplitLigature; | 0 |
| 1741 | | - |
| 1742 | glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which), | - |
| 1743 | subLayout, pos, subFlags, x, width)); | - |
| 1744 | for (int i = 0; i < subLayout.numGlyphs; i++) { never evaluated: i < subLayout.numGlyphs | 0 |
| 1745 | pos += QPointF(subLayout.advances_x[i].toReal(), | - |
| 1746 | subLayout.advances_y[i].toReal()); | - |
| 1747 | } | 0 |
| 1748 | | - |
| 1749 | if (rtl) | 0 |
| 1750 | end = start; never executed: end = start; | 0 |
| 1751 | else | - |
| 1752 | start = end; never executed: start = end; | 0 |
| 1753 | which = e; | - |
| 1754 | } | 0 |
| 1755 | | - |
| 1756 | QGlyphLayout subLayout = glyphLayout.mid(start, end - start); | - |
| 1757 | multiFontEngine->ensureEngineAt(which); | - |
| 1758 | | - |
| 1759 | QGlyphRun::GlyphRunFlags subFlags = flags; | - |
| 1760 | if ((start == 0 && startsInsideLigature) || endsInsideLigature) partially evaluated: start == 0| yes Evaluation Count:23 | no Evaluation Count:0 |
partially evaluated: startsInsideLigature| no Evaluation Count:0 | yes Evaluation Count:23 |
partially evaluated: endsInsideLigature| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1761 | subFlags |= QGlyphRun::SplitLigature; never executed: subFlags |= QGlyphRun::SplitLigature; | 0 |
| 1762 | | - |
| 1763 | QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which), | - |
| 1764 | subLayout, pos, subFlags, x, width); | - |
| 1765 | if (!glyphRun.isEmpty()) partially evaluated: !glyphRun.isEmpty()| yes Evaluation Count:23 | no Evaluation Count:0 |
| 0-23 |
| 1766 | glyphRuns.append(glyphRun); executed: glyphRuns.append(glyphRun);Execution Count:23 | 23 |
| 1767 | } else { executed: }Execution Count:23 | 23 |
| 1768 | if (startsInsideLigature || endsInsideLigature) never evaluated: startsInsideLigature never evaluated: endsInsideLigature | 0 |
| 1769 | flags |= QGlyphRun::SplitLigature; never executed: flags |= QGlyphRun::SplitLigature; | 0 |
| 1770 | QGlyphRun glyphRun = glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags, x, | - |
| 1771 | width); | - |
| 1772 | if (!glyphRun.isEmpty()) never evaluated: !glyphRun.isEmpty() | 0 |
| 1773 | glyphRuns.append(glyphRun); never executed: glyphRuns.append(glyphRun); | 0 |
| 1774 | } | 0 |
| 1775 | } | - |
| 1776 | } executed: }Execution Count:23 | 23 |
| 1777 | | - |
| 1778 | return glyphRuns; executed: return glyphRuns;Execution Count:22 | 22 |
| 1779 | } | - |
| 1780 | void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatRange *selection) const | - |
| 1781 | { | - |
| 1782 | | - |
| 1783 | | - |
| 1784 | qt_noop(); | - |
| 1785 | | - |
| 1786 | const QScriptLine &line = eng->lines[index]; | - |
| 1787 | QPen pen = p->pen(); | - |
| 1788 | | - |
| 1789 | bool noText = (selection && selection->format.property(0x5012).toBool()); evaluated: selection| yes Evaluation Count:51 | yes Evaluation Count:21992 |
partially evaluated: selection->format.property(0x5012).toBool()| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-21992 |
| 1790 | | - |
| 1791 | if (!line.length) { evaluated: !line.length| yes Evaluation Count:598 | yes Evaluation Count:21445 |
| 598-21445 |
| 1792 | if (selection partially evaluated: selection| no Evaluation Count:0 | yes Evaluation Count:598 |
| 0-598 |
| 1793 | && selection->start <= line.from never evaluated: selection->start <= line.from | 0 |
| 1794 | && selection->start + selection->length > line.from) { never evaluated: selection->start + selection->length > line.from | 0 |
| 1795 | | - |
| 1796 | const qreal lineHeight = line.height().toReal(); | - |
| 1797 | QRectF r(pos.x() + line.x.toReal(), pos.y() + line.y.toReal(), | - |
| 1798 | lineHeight / 2, QFontMetrics(eng->font()).width(QLatin1Char(' '))); | - |
| 1799 | setPenAndDrawBackground(p, QPen(), selection->format, r); | - |
| 1800 | p->setPen(pen); | - |
| 1801 | } | 0 |
| 1802 | return; executed: return;Execution Count:598 | 598 |
| 1803 | } | - |
| 1804 | | - |
| 1805 | | - |
| 1806 | QTextLineItemIterator iterator(eng, index, pos, selection); | - |
| 1807 | QFixed lineBase = line.base(); | - |
| 1808 | eng->clearDecorations(); | - |
| 1809 | eng->enableDelayDecorations(); | - |
| 1810 | | - |
| 1811 | const QFixed y = QFixed::fromReal(pos.y()) + line.y + lineBase; | - |
| 1812 | | - |
| 1813 | bool suppressColors = (eng->option.flags() & QTextOption::SuppressColors); | - |
| 1814 | while (!iterator.atEnd()) { evaluated: !iterator.atEnd()| yes Evaluation Count:22264 | yes Evaluation Count:21445 |
| 21445-22264 |
| 1815 | QScriptItem &si = iterator.next(); | - |
| 1816 | | - |
| 1817 | if (selection && selection->start >= 0 && iterator.isOutsideSelection()) evaluated: selection| yes Evaluation Count:51 | yes Evaluation Count:22213 |
partially evaluated: selection->start >= 0| yes Evaluation Count:51 | no Evaluation Count:0 |
partially evaluated: iterator.isOutsideSelection()| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-22213 |
| 1818 | continue; never executed: continue; | 0 |
| 1819 | | - |
| 1820 | if (si.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator evaluated: si.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator| yes Evaluation Count:731 | yes Evaluation Count:21533 |
| 731-21533 |
| 1821 | && !(eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators)) partially evaluated: !(eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators)| yes Evaluation Count:731 | no Evaluation Count:0 |
| 0-731 |
| 1822 | continue; executed: continue;Execution Count:731 | 731 |
| 1823 | | - |
| 1824 | QFixed itemBaseLine = y; | - |
| 1825 | QFont f = eng->font(si); | - |
| 1826 | QTextCharFormat format; | - |
| 1827 | | - |
| 1828 | if (eng->hasFormats() || selection) { evaluated: eng->hasFormats()| yes Evaluation Count:318 | yes Evaluation Count:21215 |
evaluated: selection| yes Evaluation Count:51 | yes Evaluation Count:21164 |
| 51-21215 |
| 1829 | format = eng->format(&si); | - |
| 1830 | if (suppressColors) { partially evaluated: suppressColors| no Evaluation Count:0 | yes Evaluation Count:369 |
| 0-369 |
| 1831 | format.clearForeground(); | - |
| 1832 | format.clearBackground(); | - |
| 1833 | format.clearProperty(QTextFormat::TextUnderlineColor); | - |
| 1834 | } | 0 |
| 1835 | if (selection) evaluated: selection| yes Evaluation Count:51 | yes Evaluation Count:318 |
| 51-318 |
| 1836 | format.merge(selection->format); executed: format.merge(selection->format);Execution Count:51 | 51 |
| 1837 | | - |
| 1838 | setPenAndDrawBackground(p, pen, format, QRectF(iterator.x.toReal(), (y - lineBase).toReal(), | - |
| 1839 | iterator.itemWidth.toReal(), line.height().toReal())); | - |
| 1840 | | - |
| 1841 | QTextCharFormat::VerticalAlignment valign = format.verticalAlignment(); | - |
| 1842 | if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) { partially evaluated: valign == QTextCharFormat::AlignSuperScript| no Evaluation Count:0 | yes Evaluation Count:369 |
partially evaluated: valign == QTextCharFormat::AlignSubScript| no Evaluation Count:0 | yes Evaluation Count:369 |
| 0-369 |
| 1843 | QFontEngine *fe = f.d->engineForScript(si.analysis.script); | - |
| 1844 | QFixed height = fe->ascent() + fe->descent(); | - |
| 1845 | if (valign == QTextCharFormat::AlignSubScript) never evaluated: valign == QTextCharFormat::AlignSubScript | 0 |
| 1846 | itemBaseLine += height / 6; never executed: itemBaseLine += height / 6; | 0 |
| 1847 | else if (valign == QTextCharFormat::AlignSuperScript) never evaluated: valign == QTextCharFormat::AlignSuperScript | 0 |
| 1848 | itemBaseLine -= height / 2; never executed: itemBaseLine -= height / 2; | 0 |
| 1849 | } | - |
| 1850 | } executed: }Execution Count:369 | 369 |
| 1851 | | - |
| 1852 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject) { evaluated: si.analysis.flags >= QScriptAnalysis::TabOrObject| yes Evaluation Count:3 | yes Evaluation Count:21530 |
| 3-21530 |
| 1853 | | - |
| 1854 | if (eng->hasFormats()) { partially evaluated: eng->hasFormats()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 1855 | p->save(); | - |
| 1856 | if (si.analysis.flags == QScriptAnalysis::Object && eng->block.docHandle()) { evaluated: si.analysis.flags == QScriptAnalysis::Object| yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: eng->block.docHandle()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1857 | QFixed itemY = y - si.ascent; | - |
| 1858 | if (format.verticalAlignment() == QTextCharFormat::AlignTop) { partially evaluated: format.verticalAlignment() == QTextCharFormat::AlignTop| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1859 | itemY = y - lineBase; | - |
| 1860 | } | 0 |
| 1861 | | - |
| 1862 | QRectF itemRect(iterator.x.toReal(), itemY.toReal(), iterator.itemWidth.toReal(), si.height().toReal()); | - |
| 1863 | | - |
| 1864 | eng->docLayout()->drawInlineObject(p, itemRect, | - |
| 1865 | QTextInlineObject(iterator.item, eng), | - |
| 1866 | si.position + eng->block.position(), | - |
| 1867 | format); | - |
| 1868 | if (selection) { partially evaluated: selection| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1869 | QBrush bg = format.brushProperty((QTextFormat::ForegroundBrush + 1)); | - |
| 1870 | if (bg.style() != Qt::NoBrush) { never evaluated: bg.style() != Qt::NoBrush | 0 |
| 1871 | QColor c = bg.color(); | - |
| 1872 | c.setAlpha(128); | - |
| 1873 | p->fillRect(itemRect, c); | - |
| 1874 | } | 0 |
| 1875 | } | 0 |
| 1876 | } else { executed: }Execution Count:2 | 2 |
| 1877 | QFont f = eng->font(si); | - |
| 1878 | QTextItemInt gf(si, &f, format); | - |
| 1879 | gf.chars = 0; | - |
| 1880 | gf.num_chars = 0; | - |
| 1881 | gf.width = iterator.itemWidth; | - |
| 1882 | QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng); | - |
| 1883 | if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) { partially evaluated: eng->option.flags() & QTextOption::ShowTabsAndSpaces| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1884 | QChar visualTab(0x2192); | - |
| 1885 | int w = QFontMetrics(f).width(visualTab); | - |
| 1886 | qreal x = iterator.itemWidth.toReal() - w; | - |
| 1887 | if (x < 0) | 0 |
| 1888 | p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(), | 0 |
| 1889 | iterator.itemWidth.toReal(), line.height().toReal()), | 0 |
| 1890 | Qt::IntersectClip); never executed: p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(), iterator.itemWidth.toReal(), line.height().toReal()), Qt::IntersectClip); | 0 |
| 1891 | else | - |
| 1892 | x /= 2; | 0 |
| 1893 | p->drawText(QPointF(iterator.x.toReal() + x, | - |
| 1894 | y.toReal()), visualTab); | - |
| 1895 | } | 0 |
| 1896 | | - |
| 1897 | } executed: }Execution Count:1 | 1 |
| 1898 | p->restore(); | - |
| 1899 | } executed: }Execution Count:3 | 3 |
| 1900 | | - |
| 1901 | continue; executed: continue;Execution Count:3 | 3 |
| 1902 | } | - |
| 1903 | | - |
| 1904 | unsigned short *logClusters = eng->logClusters(&si); | - |
| 1905 | QGlyphLayout glyphs = eng->shapedGlyphs(&si); | - |
| 1906 | | - |
| 1907 | QTextItemInt gf(glyphs.mid(iterator.glyphsStart, iterator.glyphsEnd - iterator.glyphsStart), | - |
| 1908 | &f, eng->layoutData->string.unicode() + iterator.itemStart, | - |
| 1909 | iterator.itemEnd - iterator.itemStart, eng->fontEngine(si), format); | - |
| 1910 | gf.logClusters = logClusters + iterator.itemStart - si.position; | - |
| 1911 | gf.width = iterator.itemWidth; | - |
| 1912 | gf.justified = line.justified; | - |
| 1913 | gf.initWithScriptItem(si); | - |
| 1914 | | - |
| 1915 | qt_noop(); | - |
| 1916 | | - |
| 1917 | if (eng->underlinePositions) { evaluated: eng->underlinePositions| yes Evaluation Count:3871 | yes Evaluation Count:17659 |
| 3871-17659 |
| 1918 | | - |
| 1919 | drawMenuText(p, iterator.x, itemBaseLine, si, gf, eng, iterator.itemStart, iterator.glyphsStart); | - |
| 1920 | } else { executed: }Execution Count:3871 | 3871 |
| 1921 | QPointF pos(iterator.x.toReal(), itemBaseLine.toReal()); | - |
| 1922 | if (format.penProperty(QTextFormat::TextOutline).style() != Qt::NoPen) { partially evaluated: format.penProperty(QTextFormat::TextOutline).style() != Qt::NoPen| no Evaluation Count:0 | yes Evaluation Count:17659 |
| 0-17659 |
| 1923 | QPainterPath path; | - |
| 1924 | path.setFillRule(Qt::WindingFill); | - |
| 1925 | | - |
| 1926 | if (gf.glyphs.numGlyphs) never evaluated: gf.glyphs.numGlyphs | 0 |
| 1927 | gf.fontEngine->addOutlineToPath(pos.x(), pos.y(), gf.glyphs, &path, gf.flags); never executed: gf.fontEngine->addOutlineToPath(pos.x(), pos.y(), gf.glyphs, &path, gf.flags); | 0 |
| 1928 | if (gf.flags) { never evaluated: gf.flags | 0 |
| 1929 | const QFontEngine *fe = gf.fontEngine; | - |
| 1930 | const qreal lw = fe->lineThickness().toReal(); | - |
| 1931 | if (gf.flags & QTextItem::Underline) { never evaluated: gf.flags & QTextItem::Underline | 0 |
| 1932 | qreal offs = fe->underlinePosition().toReal(); | - |
| 1933 | path.addRect(pos.x(), pos.y() + offs, gf.width.toReal(), lw); | - |
| 1934 | } | 0 |
| 1935 | if (gf.flags & QTextItem::Overline) { never evaluated: gf.flags & QTextItem::Overline | 0 |
| 1936 | qreal offs = fe->ascent().toReal() + 1; | - |
| 1937 | path.addRect(pos.x(), pos.y() - offs, gf.width.toReal(), lw); | - |
| 1938 | } | 0 |
| 1939 | if (gf.flags & QTextItem::StrikeOut) { never evaluated: gf.flags & QTextItem::StrikeOut | 0 |
| 1940 | qreal offs = fe->ascent().toReal() / 3; | - |
| 1941 | path.addRect(pos.x(), pos.y() - offs, gf.width.toReal(), lw); | - |
| 1942 | } | 0 |
| 1943 | } | 0 |
| 1944 | | - |
| 1945 | p->save(); | - |
| 1946 | p->setRenderHint(QPainter::Antialiasing); | - |
| 1947 | | - |
| 1948 | | - |
| 1949 | if (p->pen().style() == Qt::NoPen) never evaluated: p->pen().style() == Qt::NoPen | 0 |
| 1950 | p->setBrush(Qt::NoBrush); never executed: p->setBrush(Qt::NoBrush); | 0 |
| 1951 | else | - |
| 1952 | p->setBrush(p->pen().brush()); never executed: p->setBrush(p->pen().brush()); | 0 |
| 1953 | | - |
| 1954 | p->setPen(format.textOutline()); | - |
| 1955 | p->drawPath(path); | - |
| 1956 | p->restore(); | - |
| 1957 | } else { | 0 |
| 1958 | if (noText) partially evaluated: noText| no Evaluation Count:0 | yes Evaluation Count:17659 |
| 0-17659 |
| 1959 | gf.glyphs.numGlyphs = 0; never executed: gf.glyphs.numGlyphs = 0; | 0 |
| 1960 | QPainterPrivate::get(p)->drawTextItem(pos, gf, eng); | - |
| 1961 | } executed: }Execution Count:17659 | 17659 |
| 1962 | } | - |
| 1963 | if (si.analysis.flags == QScriptAnalysis::Space partially evaluated: si.analysis.flags == QScriptAnalysis::Space| no Evaluation Count:0 | yes Evaluation Count:21530 |
| 0-21530 |
| 1964 | && (eng->option.flags() & QTextOption::ShowTabsAndSpaces)) { never evaluated: (eng->option.flags() & QTextOption::ShowTabsAndSpaces) | 0 |
| 1965 | QBrush c = format.foreground(); | - |
| 1966 | if (c.style() != Qt::NoBrush) never evaluated: c.style() != Qt::NoBrush | 0 |
| 1967 | p->setPen(c.color()); never executed: p->setPen(c.color()); | 0 |
| 1968 | QChar visualSpace((ushort)0xb7); | - |
| 1969 | p->drawText(QPointF(iterator.x.toReal(), itemBaseLine.toReal()), visualSpace); | - |
| 1970 | p->setPen(pen); | - |
| 1971 | } | 0 |
| 1972 | } executed: }Execution Count:21530 | 21530 |
| 1973 | eng->drawDecorations(p); | - |
| 1974 | | - |
| 1975 | if (eng->hasFormats()) evaluated: eng->hasFormats()| yes Evaluation Count:285 | yes Evaluation Count:21160 |
| 285-21160 |
| 1976 | p->setPen(pen); executed: p->setPen(pen);Execution Count:285 | 285 |
| 1977 | } executed: }Execution Count:21445 | 21445 |
| 1978 | qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const | - |
| 1979 | { | - |
| 1980 | if (!eng->layoutData) evaluated: !eng->layoutData| yes Evaluation Count:1 | yes Evaluation Count:12255 |
| 1-12255 |
| 1981 | eng->itemize(); executed: eng->itemize();Execution Count:1 | 1 |
| 1982 | | - |
| 1983 | const QScriptLine &line = eng->lines[index]; | - |
| 1984 | bool lastLine = index >= eng->lines.size() - 1; | - |
| 1985 | | - |
| 1986 | QFixed x = line.x; | - |
| 1987 | x += eng->alignLine(line) - eng->leadingSpaceWidth(line); | - |
| 1988 | | - |
| 1989 | if (!index && !eng->layoutData->items.size()) { evaluated: !index| yes Evaluation Count:12155 | yes Evaluation Count:101 |
evaluated: !eng->layoutData->items.size()| yes Evaluation Count:2601 | yes Evaluation Count:9554 |
| 101-12155 |
| 1990 | *cursorPos = 0; | - |
| 1991 | return x.toReal(); executed: return x.toReal();Execution Count:2601 | 2601 |
| 1992 | } | - |
| 1993 | | - |
| 1994 | int lineEnd = line.from + line.length + line.trailingSpaces; | - |
| 1995 | int pos = *cursorPos; | - |
| 1996 | int itm; | - |
| 1997 | const QCharAttributes *attributes = eng->attributes(); | - |
| 1998 | if (!attributes) { partially evaluated: !attributes| no Evaluation Count:0 | yes Evaluation Count:9655 |
| 0-9655 |
| 1999 | *cursorPos = 0; | - |
| 2000 | return x.toReal(); never executed: return x.toReal(); | 0 |
| 2001 | } | - |
| 2002 | while (pos < lineEnd && !attributes[pos].graphemeBoundary) evaluated: pos < lineEnd| yes Evaluation Count:4834 | yes Evaluation Count:4821 |
partially evaluated: !attributes[pos].graphemeBoundary| no Evaluation Count:0 | yes Evaluation Count:4834 |
| 0-4834 |
| 2003 | pos++; | 0 |
| 2004 | if (pos == lineEnd) { evaluated: pos == lineEnd| yes Evaluation Count:4821 | yes Evaluation Count:4834 |
| 4821-4834 |
| 2005 | | - |
| 2006 | itm = eng->findItem(pos-1); | - |
| 2007 | } executed: }Execution Count:4821 | 4821 |
| 2008 | else | - |
| 2009 | itm = eng->findItem(pos); executed: itm = eng->findItem(pos);Execution Count:4834 | 4834 |
| 2010 | eng->shapeLine(line); | - |
| 2011 | | - |
| 2012 | const QScriptItem *si = &eng->layoutData->items[itm]; | - |
| 2013 | if (!si->num_glyphs) evaluated: !si->num_glyphs| yes Evaluation Count:8 | yes Evaluation Count:9647 |
| 8-9647 |
| 2014 | eng->shape(itm); executed: eng->shape(itm);Execution Count:8 | 8 |
| 2015 | pos -= si->position; | - |
| 2016 | | - |
| 2017 | QGlyphLayout glyphs = eng->shapedGlyphs(si); | - |
| 2018 | unsigned short *logClusters = eng->logClusters(si); | - |
| 2019 | qt_noop(); | - |
| 2020 | | - |
| 2021 | int l = eng->length(itm); | - |
| 2022 | if (pos > l) partially evaluated: pos > l| no Evaluation Count:0 | yes Evaluation Count:9655 |
| 0-9655 |
| 2023 | pos = l; | 0 |
| 2024 | if (pos < 0) partially evaluated: pos < 0| no Evaluation Count:0 | yes Evaluation Count:9655 |
| 0-9655 |
| 2025 | pos = 0; | 0 |
| 2026 | | - |
| 2027 | int glyph_pos = pos == l ? si->num_glyphs : logClusters[pos]; evaluated: pos == l| yes Evaluation Count:4821 | yes Evaluation Count:4834 |
| 4821-4834 |
| 2028 | if (edge == Trailing && glyph_pos < si->num_glyphs) { partially evaluated: edge == Trailing| no Evaluation Count:0 | yes Evaluation Count:9655 |
never evaluated: glyph_pos < si->num_glyphs | 0-9655 |
| 2029 | | - |
| 2030 | glyph_pos++; | - |
| 2031 | while (glyph_pos < si->num_glyphs && !glyphs.attributes[glyph_pos].clusterStart) never evaluated: glyph_pos < si->num_glyphs never evaluated: !glyphs.attributes[glyph_pos].clusterStart | 0 |
| 2032 | glyph_pos++; never executed: glyph_pos++; | 0 |
| 2033 | } | 0 |
| 2034 | | - |
| 2035 | bool reverse = eng->layoutData->items[itm].analysis.bidiLevel % 2; | - |
| 2036 | | - |
| 2037 | | - |
| 2038 | | - |
| 2039 | | - |
| 2040 | int firstItem = eng->findItem(line.from); | - |
| 2041 | int lastItem = eng->findItem(lineEnd - 1); | - |
| 2042 | int nItems = (firstItem >= 0 && lastItem >= firstItem)? (lastItem-firstItem+1) : 0; partially evaluated: firstItem >= 0| yes Evaluation Count:9655 | no Evaluation Count:0 |
partially evaluated: lastItem >= firstItem| yes Evaluation Count:9655 | no Evaluation Count:0 |
| 0-9655 |
| 2043 | | - |
| 2044 | QVarLengthArray<int> visualOrder(nItems); | - |
| 2045 | QVarLengthArray<uchar> levels(nItems); | - |
| 2046 | for (int i = 0; i < nItems; ++i) evaluated: i < nItems| yes Evaluation Count:15748 | yes Evaluation Count:9655 |
| 9655-15748 |
| 2047 | levels[i] = eng->layoutData->items[i+firstItem].analysis.bidiLevel; executed: levels[i] = eng->layoutData->items[i+firstItem].analysis.bidiLevel;Execution Count:15748 | 15748 |
| 2048 | QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); | - |
| 2049 | | - |
| 2050 | for (int i = 0; i < nItems; ++i) { partially evaluated: i < nItems| yes Evaluation Count:12477 | no Evaluation Count:0 |
| 0-12477 |
| 2051 | int item = visualOrder[i]+firstItem; | - |
| 2052 | if (item == itm) evaluated: item == itm| yes Evaluation Count:9655 | yes Evaluation Count:2822 |
| 2822-9655 |
| 2053 | break; executed: break;Execution Count:9655 | 9655 |
| 2054 | QScriptItem &si = eng->layoutData->items[item]; | - |
| 2055 | if (!si.num_glyphs) evaluated: !si.num_glyphs| yes Evaluation Count:1 | yes Evaluation Count:2821 |
| 1-2821 |
| 2056 | eng->shape(item); executed: eng->shape(item);Execution Count:1 | 1 |
| 2057 | | - |
| 2058 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject) { evaluated: si.analysis.flags >= QScriptAnalysis::TabOrObject| yes Evaluation Count:1 | yes Evaluation Count:2821 |
| 1-2821 |
| 2059 | x += si.width; | - |
| 2060 | continue; executed: continue;Execution Count:1 | 1 |
| 2061 | } | - |
| 2062 | int start = qMax(line.from, si.position); | - |
| 2063 | int end = qMin(lineEnd, si.position + eng->length(item)); | - |
| 2064 | | - |
| 2065 | logClusters = eng->logClusters(&si); | - |
| 2066 | | - |
| 2067 | int gs = logClusters[start-si.position]; | - |
| 2068 | int ge = (end == si.position + eng->length(item)) ? si.num_glyphs-1 : logClusters[end-si.position-1]; partially evaluated: (end == si.position + eng->length(item))| yes Evaluation Count:2821 | no Evaluation Count:0 |
| 0-2821 |
| 2069 | | - |
| 2070 | QGlyphLayout glyphs = eng->shapedGlyphs(&si); | - |
| 2071 | | - |
| 2072 | while (gs <= ge) { evaluated: gs <= ge| yes Evaluation Count:9459 | yes Evaluation Count:2821 |
| 2821-9459 |
| 2073 | x += glyphs.effectiveAdvance(gs); | - |
| 2074 | ++gs; | - |
| 2075 | } executed: }Execution Count:9459 | 9459 |
| 2076 | } executed: }Execution Count:2821 | 2821 |
| 2077 | | - |
| 2078 | logClusters = eng->logClusters(si); | - |
| 2079 | glyphs = eng->shapedGlyphs(si); | - |
| 2080 | if (si->analysis.flags >= QScriptAnalysis::TabOrObject) { evaluated: si->analysis.flags >= QScriptAnalysis::TabOrObject| yes Evaluation Count:7 | yes Evaluation Count:9648 |
| 7-9648 |
| 2081 | if (pos == (reverse ? 0 : l)) partially evaluated: pos == (reverse ? 0 : l)| no Evaluation Count:0 | yes Evaluation Count:7 |
partially evaluated: reverse| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 2082 | x += si->width; never executed: x += si->width; | 0 |
| 2083 | } else { executed: }Execution Count:7 | 7 |
| 2084 | bool rtl = eng->isRightToLeft(); | - |
| 2085 | bool visual = eng->visualCursorMovement(); | - |
| 2086 | int end = qMin(lineEnd, si->position + l) - si->position; | - |
| 2087 | if (reverse) { evaluated: reverse| yes Evaluation Count:673 | yes Evaluation Count:8975 |
| 673-8975 |
| 2088 | int glyph_end = end == l ? si->num_glyphs : logClusters[end]; partially evaluated: end == l| yes Evaluation Count:673 | no Evaluation Count:0 |
| 0-673 |
| 2089 | int glyph_start = glyph_pos; | - |
| 2090 | if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem))) evaluated: visual| yes Evaluation Count:606 | yes Evaluation Count:67 |
evaluated: !rtl| yes Evaluation Count:176 | yes Evaluation Count:430 |
partially evaluated: lastLine| yes Evaluation Count:176 | no Evaluation Count:0 |
evaluated: itm == (visualOrder[nItems - 1] + firstItem)| yes Evaluation Count:42 | yes Evaluation Count:134 |
| 0-606 |
| 2091 | glyph_start++; executed: glyph_start++;Execution Count:134 | 134 |
| 2092 | for (int i = glyph_end - 1; i >= glyph_start; i--) evaluated: i >= glyph_start| yes Evaluation Count:1202 | yes Evaluation Count:673 |
| 673-1202 |
| 2093 | x += glyphs.effectiveAdvance(i); executed: x += glyphs.effectiveAdvance(i);Execution Count:1202 | 1202 |
| 2094 | } else { executed: }Execution Count:673 | 673 |
| 2095 | int start = qMax(line.from - si->position, 0); | - |
| 2096 | int glyph_start = logClusters[start]; | - |
| 2097 | int glyph_end = glyph_pos; | - |
| 2098 | if (!visual || !rtl || (lastLine && itm == visualOrder[0] + firstItem)) evaluated: !visual| yes Evaluation Count:8386 | yes Evaluation Count:589 |
evaluated: !rtl| yes Evaluation Count:307 | yes Evaluation Count:282 |
partially evaluated: lastLine| yes Evaluation Count:282 | no Evaluation Count:0 |
evaluated: itm == visualOrder[0] + firstItem| yes Evaluation Count:101 | yes Evaluation Count:181 |
| 0-8386 |
| 2099 | glyph_end--; executed: glyph_end--;Execution Count:8794 | 8794 |
| 2100 | for (int i = glyph_start; i <= glyph_end; i++) evaluated: i <= glyph_end| yes Evaluation Count:58834 | yes Evaluation Count:8975 |
| 8975-58834 |
| 2101 | x += glyphs.effectiveAdvance(i); executed: x += glyphs.effectiveAdvance(i);Execution Count:58834 | 58834 |
| 2102 | } executed: }Execution Count:8975 | 8975 |
| 2103 | x += eng->offsetInLigature(si, pos, end, glyph_pos); | - |
| 2104 | } executed: }Execution Count:9648 | 9648 |
| 2105 | | - |
| 2106 | if (eng->option.wrapMode() != QTextOption::NoWrap && x > line.x + line.width) evaluated: eng->option.wrapMode() != QTextOption::NoWrap| yes Evaluation Count:9628 | yes Evaluation Count:27 |
partially evaluated: x > line.x + line.width| no Evaluation Count:0 | yes Evaluation Count:9628 |
| 0-9628 |
| 2107 | x = line.x + line.width; never executed: x = line.x + line.width; | 0 |
| 2108 | if (eng->option.wrapMode() != QTextOption::NoWrap && x < 0) evaluated: eng->option.wrapMode() != QTextOption::NoWrap| yes Evaluation Count:9628 | yes Evaluation Count:27 |
partially evaluated: x < 0| no Evaluation Count:0 | yes Evaluation Count:9628 |
| 0-9628 |
| 2109 | x = 0; | 0 |
| 2110 | | - |
| 2111 | *cursorPos = pos + si->position; | - |
| 2112 | return x.toReal(); executed: return x.toReal();Execution Count:9655 | 9655 |
| 2113 | } | - |
| 2114 | int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const | - |
| 2115 | { | - |
| 2116 | QFixed x = QFixed::fromReal(_x); | - |
| 2117 | const QScriptLine &line = eng->lines[index]; | - |
| 2118 | bool lastLine = index >= eng->lines.size() - 1; | - |
| 2119 | int lineNum = index; | - |
| 2120 | | - |
| 2121 | if (!eng->layoutData) evaluated: !eng->layoutData| yes Evaluation Count:7 | yes Evaluation Count:20 |
| 7-20 |
| 2122 | eng->itemize(); executed: eng->itemize();Execution Count:7 | 7 |
| 2123 | | - |
| 2124 | int line_length = textLength(); | - |
| 2125 | | - |
| 2126 | if (!line_length) evaluated: !line_length| yes Evaluation Count:3 | yes Evaluation Count:24 |
| 3-24 |
| 2127 | return line.from; executed: return line.from;Execution Count:3 | 3 |
| 2128 | | - |
| 2129 | int firstItem = eng->findItem(line.from); | - |
| 2130 | int lastItem = eng->findItem(line.from + line_length - 1); | - |
| 2131 | int nItems = (firstItem >= 0 && lastItem >= firstItem)? (lastItem-firstItem+1) : 0; partially evaluated: firstItem >= 0| yes Evaluation Count:24 | no Evaluation Count:0 |
partially evaluated: lastItem >= firstItem| yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
| 2132 | | - |
| 2133 | if (!nItems) partially evaluated: !nItems| no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
| 2134 | return 0; never executed: return 0; | 0 |
| 2135 | | - |
| 2136 | x -= line.x; | - |
| 2137 | x -= eng->alignLine(line); | - |
| 2138 | | - |
| 2139 | | - |
| 2140 | QVarLengthArray<int> visualOrder(nItems); | - |
| 2141 | QVarLengthArray<unsigned char> levels(nItems); | - |
| 2142 | for (int i = 0; i < nItems; ++i) evaluated: i < nItems| yes Evaluation Count:26 | yes Evaluation Count:24 |
| 24-26 |
| 2143 | levels[i] = eng->layoutData->items[i+firstItem].analysis.bidiLevel; executed: levels[i] = eng->layoutData->items[i+firstItem].analysis.bidiLevel;Execution Count:26 | 26 |
| 2144 | QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); | - |
| 2145 | | - |
| 2146 | bool visual = eng->visualCursorMovement(); | - |
| 2147 | if (x <= 0) { evaluated: x <= 0| yes Evaluation Count:12 | yes Evaluation Count:12 |
| 12 |
| 2148 | | - |
| 2149 | int item = visualOrder[0]+firstItem; | - |
| 2150 | QScriptItem &si = eng->layoutData->items[item]; | - |
| 2151 | if (!si.num_glyphs) evaluated: !si.num_glyphs| yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-9 |
| 2152 | eng->shape(item); executed: eng->shape(item);Execution Count:3 | 3 |
| 2153 | int pos = si.position; | - |
| 2154 | if (si.analysis.bidiLevel % 2) partially evaluated: si.analysis.bidiLevel % 2| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 2155 | pos += eng->length(item); never executed: pos += eng->length(item); | 0 |
| 2156 | pos = qMax(line.from, pos); | - |
| 2157 | pos = qMin(line.from + line_length, pos); | - |
| 2158 | return pos; executed: return pos;Execution Count:12 | 12 |
| 2159 | } else if (x < line.textWidth evaluated: x < line.textWidth| yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
| 2160 | || (line.justified && x < line.width)) { partially evaluated: line.justified| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: x < line.width | 0-2 |
| 2161 | | - |
| 2162 | QFixed pos; | - |
| 2163 | bool rtl = eng->isRightToLeft(); | - |
| 2164 | | - |
| 2165 | eng->shapeLine(line); | - |
| 2166 | QVector<int> insertionPoints; | - |
| 2167 | if (visual && rtl) partially evaluated: visual| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 2168 | eng->insertionPointsForLine(lineNum, insertionPoints); never executed: eng->insertionPointsForLine(lineNum, insertionPoints); | 0 |
| 2169 | int nchars = 0; | - |
| 2170 | for (int i = 0; i < nItems; ++i) { partially evaluated: i < nItems| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 2171 | int item = visualOrder[i]+firstItem; | - |
| 2172 | QScriptItem &si = eng->layoutData->items[item]; | - |
| 2173 | int item_length = eng->length(item); | - |
| 2174 | | - |
| 2175 | | - |
| 2176 | int start = qMax(line.from - si.position, 0); | - |
| 2177 | int end = qMin(line.from + line_length - si.position, item_length); | - |
| 2178 | | - |
| 2179 | unsigned short *logClusters = eng->logClusters(&si); | - |
| 2180 | | - |
| 2181 | int gs = logClusters[start]; | - |
| 2182 | int ge = (end == item_length ? si.num_glyphs : logClusters[end]) - 1; evaluated: end == item_length| yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
| 2183 | QGlyphLayout glyphs = eng->shapedGlyphs(&si); | - |
| 2184 | | - |
| 2185 | QFixed item_width = 0; | - |
| 2186 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject) { partially evaluated: si.analysis.flags >= QScriptAnalysis::TabOrObject| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 2187 | item_width = si.width; | - |
| 2188 | } else { | 0 |
| 2189 | int g = gs; | - |
| 2190 | while (g <= ge) { evaluated: g <= ge| yes Evaluation Count:175 | yes Evaluation Count:10 |
| 10-175 |
| 2191 | item_width += glyphs.effectiveAdvance(g); | - |
| 2192 | ++g; | - |
| 2193 | } executed: }Execution Count:175 | 175 |
| 2194 | } executed: }Execution Count:10 | 10 |
| 2195 | | - |
| 2196 | | - |
| 2197 | if (pos + item_width < x) { partially evaluated: pos + item_width < x| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 2198 | pos += item_width; | - |
| 2199 | nchars += end; | - |
| 2200 | continue; never executed: continue; | 0 |
| 2201 | } | - |
| 2202 | | - |
| 2203 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject) { partially evaluated: si.analysis.flags >= QScriptAnalysis::TabOrObject| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 2204 | if (cpos == QTextLine::CursorOnCharacter) never evaluated: cpos == QTextLine::CursorOnCharacter | 0 |
| 2205 | return si.position; never executed: return si.position; | 0 |
| 2206 | bool left_half = (x - pos) < item_width/2; | - |
| 2207 | | - |
| 2208 | if (bool(si.analysis.bidiLevel % 2) != left_half) never evaluated: bool(si.analysis.bidiLevel % 2) != left_half | 0 |
| 2209 | return si.position; never executed: return si.position; | 0 |
| 2210 | return si.position + 1; never executed: return si.position + 1; | 0 |
| 2211 | } | - |
| 2212 | | - |
| 2213 | int glyph_pos = -1; | - |
| 2214 | QFixed edge; | - |
| 2215 | | - |
| 2216 | if (cpos == QTextLine::CursorOnCharacter) { evaluated: cpos == QTextLine::CursorOnCharacter| yes Evaluation Count:4 | yes Evaluation Count:6 |
| 4-6 |
| 2217 | if (si.analysis.bidiLevel % 2) { partially evaluated: si.analysis.bidiLevel % 2| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 2218 | pos += item_width; | - |
| 2219 | glyph_pos = gs; | - |
| 2220 | while (gs <= ge) { never evaluated: gs <= ge | 0 |
| 2221 | if (glyphs.attributes[gs].clusterStart) { never evaluated: glyphs.attributes[gs].clusterStart | 0 |
| 2222 | if (pos < x) | 0 |
| 2223 | break; | 0 |
| 2224 | glyph_pos = gs; | - |
| 2225 | edge = pos; | - |
| 2226 | break; | 0 |
| 2227 | } | - |
| 2228 | pos -= glyphs.effectiveAdvance(gs); | - |
| 2229 | ++gs; | - |
| 2230 | } | 0 |
| 2231 | } else { | 0 |
| 2232 | glyph_pos = gs; | - |
| 2233 | while (gs <= ge) { evaluated: gs <= ge| yes Evaluation Count:62 | yes Evaluation Count:1 |
| 1-62 |
| 2234 | if (glyphs.attributes[gs].clusterStart) { partially evaluated: glyphs.attributes[gs].clusterStart| yes Evaluation Count:62 | no Evaluation Count:0 |
| 0-62 |
| 2235 | if (pos > x) evaluated: pos > x| yes Evaluation Count:3 | yes Evaluation Count:59 |
| 3-59 |
| 2236 | break; executed: break;Execution Count:3 | 3 |
| 2237 | glyph_pos = gs; | - |
| 2238 | edge = pos; | - |
| 2239 | } executed: }Execution Count:59 | 59 |
| 2240 | pos += glyphs.effectiveAdvance(gs); | - |
| 2241 | ++gs; | - |
| 2242 | } executed: }Execution Count:59 | 59 |
| 2243 | } executed: }Execution Count:4 | 4 |
| 2244 | } else { | - |
| 2245 | QFixed dist = 2147483647/256; | - |
| 2246 | if (si.analysis.bidiLevel % 2) { partially evaluated: si.analysis.bidiLevel % 2| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 2247 | if (!visual || rtl || (lastLine && i == nItems - 1)) { never evaluated: lastLine never evaluated: i == nItems - 1 | 0 |
| 2248 | pos += item_width; | - |
| 2249 | while (gs <= ge) { never evaluated: gs <= ge | 0 |
| 2250 | if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { never evaluated: glyphs.attributes[gs].clusterStart never evaluated: qAbs(x-pos) < dist | 0 |
| 2251 | glyph_pos = gs; | - |
| 2252 | edge = pos; | - |
| 2253 | dist = qAbs(x-pos); | - |
| 2254 | } | 0 |
| 2255 | pos -= glyphs.effectiveAdvance(gs); | - |
| 2256 | ++gs; | - |
| 2257 | } | 0 |
| 2258 | } else { | 0 |
| 2259 | while (ge >= gs) { never evaluated: ge >= gs | 0 |
| 2260 | if (glyphs.attributes[ge].clusterStart && qAbs(x-pos) < dist) { never evaluated: glyphs.attributes[ge].clusterStart never evaluated: qAbs(x-pos) < dist | 0 |
| 2261 | glyph_pos = ge; | - |
| 2262 | edge = pos; | - |
| 2263 | dist = qAbs(x-pos); | - |
| 2264 | } | 0 |
| 2265 | pos += glyphs.effectiveAdvance(ge); | - |
| 2266 | --ge; | - |
| 2267 | } | 0 |
| 2268 | } | 0 |
| 2269 | } else { | - |
| 2270 | if (!visual || !rtl || (lastLine && i == 0)) { partially evaluated: !visual| yes Evaluation Count:6 | no Evaluation Count:0 |
never evaluated: lastLine | 0-6 |
| 2271 | while (gs <= ge) { evaluated: gs <= ge| yes Evaluation Count:63 | yes Evaluation Count:6 |
| 6-63 |
| 2272 | if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { partially evaluated: glyphs.attributes[gs].clusterStart| yes Evaluation Count:63 | no Evaluation Count:0 |
evaluated: qAbs(x-pos) < dist| yes Evaluation Count:41 | yes Evaluation Count:22 |
| 0-63 |
| 2273 | glyph_pos = gs; | - |
| 2274 | edge = pos; | - |
| 2275 | dist = qAbs(x-pos); | - |
| 2276 | } executed: }Execution Count:41 | 41 |
| 2277 | pos += glyphs.effectiveAdvance(gs); | - |
| 2278 | ++gs; | - |
| 2279 | } executed: }Execution Count:63 | 63 |
| 2280 | } else { executed: }Execution Count:6 | 6 |
| 2281 | QFixed oldPos = pos; | - |
| 2282 | while (gs <= ge) { never evaluated: gs <= ge | 0 |
| 2283 | pos += glyphs.effectiveAdvance(gs); | - |
| 2284 | if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { never evaluated: glyphs.attributes[gs].clusterStart never evaluated: qAbs(x-pos) < dist | 0 |
| 2285 | glyph_pos = gs; | - |
| 2286 | edge = pos; | - |
| 2287 | dist = qAbs(x-pos); | - |
| 2288 | } | 0 |
| 2289 | ++gs; | - |
| 2290 | } | 0 |
| 2291 | pos = oldPos; | - |
| 2292 | } | 0 |
| 2293 | } | - |
| 2294 | if (qAbs(x-pos) < dist) { partially evaluated: qAbs(x-pos) < dist| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 2295 | if (visual) { | 0 |
| 2296 | if (!rtl && i < nItems - 1) { never evaluated: i < nItems - 1 | 0 |
| 2297 | nchars += end; | - |
| 2298 | continue; never executed: continue; | 0 |
| 2299 | } | - |
| 2300 | if (rtl && nchars > 0) never evaluated: nchars > 0 | 0 |
| 2301 | return insertionPoints[lastLine ? nchars : nchars - 1]; never executed: return insertionPoints[lastLine ? nchars : nchars - 1]; | 0 |
| 2302 | } | 0 |
| 2303 | return eng->positionInLigature(&si, end, x, pos, -1, | 0 |
| 2304 | cpos == QTextLine::CursorOnCharacter); never executed: return eng->positionInLigature(&si, end, x, pos, -1, cpos == QTextLine::CursorOnCharacter); | 0 |
| 2305 | } | - |
| 2306 | } executed: }Execution Count:6 | 6 |
| 2307 | qt_noop(); | - |
| 2308 | return eng->positionInLigature(&si, end, x, edge, glyph_pos, | 10 |
| 2309 | cpos == QTextLine::CursorOnCharacter); executed: return eng->positionInLigature(&si, end, x, edge, glyph_pos, cpos == QTextLine::CursorOnCharacter);Execution Count:10 | 10 |
| 2310 | } | - |
| 2311 | } | 0 |
| 2312 | | - |
| 2313 | | - |
| 2314 | int item = visualOrder[nItems-1]+firstItem; | - |
| 2315 | QScriptItem &si = eng->layoutData->items[item]; | - |
| 2316 | if (!si.num_glyphs) evaluated: !si.num_glyphs| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 2317 | eng->shape(item); executed: eng->shape(item);Execution Count:1 | 1 |
| 2318 | int pos = si.position; | - |
| 2319 | if (!(si.analysis.bidiLevel % 2)) partially evaluated: !(si.analysis.bidiLevel % 2)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 2320 | pos += eng->length(item); executed: pos += eng->length(item);Execution Count:2 | 2 |
| 2321 | pos = qMax(line.from, pos); | - |
| 2322 | | - |
| 2323 | int maxPos = line.from + line_length; | - |
| 2324 | | - |
| 2325 | | - |
| 2326 | | - |
| 2327 | | - |
| 2328 | | - |
| 2329 | | - |
| 2330 | if (this->index < eng->lines.count() - 1) partially evaluated: this->index < eng->lines.count() - 1| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 2331 | --maxPos; never executed: --maxPos; | 0 |
| 2332 | | - |
| 2333 | pos = qMin(pos, maxPos); | - |
| 2334 | return pos; executed: return pos;Execution Count:2 | 2 |
| 2335 | } | - |
| 2336 | | - |
| 2337 | | - |
| 2338 | | - |
| | |