summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-12 14:00:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-12 14:00:35 (GMT)
commit3fd27b2800d41ec10aa798c572c25939cd77e1a7 (patch)
tree007e68aa6cbeb3c2393fff873b02aac0fe22b422 /src
parentdf1b8802c121790e9c1be3221b49fc1de410ed52 (diff)
parent6fcfcdd05fd1aca91f0888c85b9badf9adef2ae4 (diff)
downloadQt-3fd27b2800d41ec10aa798c572c25939cd77e1a7.zip
Qt-3fd27b2800d41ec10aa798c572c25939cd77e1a7.tar.gz
Qt-3fd27b2800d41ec10aa798c572c25939cd77e1a7.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fix incorrect line breaking in QtWebKit.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index 7c40e35..ca4d3c3 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -130,6 +130,11 @@ static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int
Line break boundaries give possible places where a line break
might happen and sentence boundaries will show the beginning and
end of whole sentences.
+
+ The first position in a string is always a valid boundary and
+ refers to the position before the first character. The last
+ position at the length of the string is also valid and refers
+ to the position after the last character.
*/
/*!
@@ -362,7 +367,8 @@ int QTextBoundaryFinder::toNextBoundary()
++pos;
break;
case Line:
- while (pos < length && d->attributes[pos].lineBreakType < HB_Break)
+ Q_ASSERT(pos);
+ while (pos < length && d->attributes[pos-1].lineBreakType < HB_Break)
++pos;
break;
}
@@ -404,7 +410,7 @@ int QTextBoundaryFinder::toPreviousBoundary()
--pos;
break;
case Line:
- while (pos > 0 && d->attributes[pos].lineBreakType < HB_Break)
+ while (pos > 0 && d->attributes[pos-1].lineBreakType < HB_Break)
--pos;
break;
}
@@ -429,7 +435,7 @@ bool QTextBoundaryFinder::isAtBoundary() const
case Word:
return d->attributes[pos].wordBoundary;
case Line:
- return d->attributes[pos].lineBreakType >= HB_Break;
+ return (pos > 0) ? d->attributes[pos-1].lineBreakType >= HB_Break : true;
case Sentence:
return d->attributes[pos].sentenceBoundary;
}