Fix missing inline images
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Wed, 5 Oct 2011 14:27:14 +0000 (16:27 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 6 Oct 2011 13:31:34 +0000 (15:31 +0200)
Oops, the change to support floating images caused
a regression, as it caused all images represented by object
replacement characters to be ignored instead of only the ones
that were floating and were handled elsewhere. The correct
test is less strict, only verifying that the layout position is
InFlow.

Change-Id: Ib28ea595b598bbd047eebe1a704211f0ba139382
Reviewed-on: http://codereview.qt-project.org/6074
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>

src/declarative/items/qsgtextnode.cpp

index 1dd3564..f712bd7 100644 (file)
@@ -1163,8 +1163,7 @@ void QSGTextNode::addTextDocument(const QPointF &, QTextDocument *textDocument,
                     engine.setPosition(blockPosition);
                     if (text.contains(QChar::ObjectReplacementCharacter)) {
                         QTextFrame *frame = qobject_cast<QTextFrame *>(textDocument->objectForFormat(charFormat));
-                        if (frame && frame->frameFormat().position() == QTextFrameFormat::InFlow
-                            && frame->firstPosition() <= frame->lastPosition()) {
+                        if (frame && frame->frameFormat().position() == QTextFrameFormat::InFlow) {
                             BinaryTreeNode::SelectionState selectionState =
                                     (selectionStart < textPos + text.length()
                                      && selectionEnd >= textPos)