Overshooting when measuring the text caused things to go out-of-sync and to hang, b=142206, r=shanjian, sr=dbaron, a=asa

This commit is contained in:
rbs%maths.uq.edu.au 2002-09-05 01:58:55 +00:00
Родитель caf5074301
Коммит 5fe9f9019a
6 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -1672,7 +1672,7 @@ do_BreakGetTextDimensions(const nsFontSwitchGTK *aFontSwitch,
// and the end of the text
if ((breakIndex < (data->mNumBreaks - 1)) && (data->mBreaks[breakIndex] < i)) {
++breakIndex;
numChars = data->mBreaks[breakIndex] - start;
numChars = PR_MIN(data->mBreaks[breakIndex] - start, (PRInt32)aSubstringLength);
}
else {
NS_ASSERTION(i != data->mBreaks[breakIndex], "don't expect to be at segment boundary");

Просмотреть файл

@ -1702,7 +1702,7 @@ do_BreakGetTextDimensions(const nsFontSwitch* aFontSwitch,
// and the end of the text
if ((breakIndex < (data->mNumBreaks - 1)) && (data->mBreaks[breakIndex] < i)) {
++breakIndex;
numChars = data->mBreaks[breakIndex] - start;
numChars = PR_MIN(data->mBreaks[breakIndex] - start, (PRInt32)aSubstringLength);
}
else {
NS_ASSERTION(i != data->mBreaks[breakIndex], "don't expect to be at segment boundary");

Просмотреть файл

@ -1847,7 +1847,7 @@ do_BreakGetTextDimensions(const nsFontSwitch* aFontSwitch,
// and the end of the text
if ((breakIndex < (data->mNumBreaks - 1)) && (data->mBreaks[breakIndex] < i)) {
++breakIndex;
numChars = data->mBreaks[breakIndex] - start;
numChars = PR_MIN(data->mBreaks[breakIndex] - start, (PRInt32)aSubstringLength);
}
else {
NS_ASSERTION(i != data->mBreaks[breakIndex], "don't expect to be at segment boundary");

Просмотреть файл

@ -1674,7 +1674,7 @@ do_BreakGetTextDimensions(const nsFontSwitchXlib *aFontSwitch,
// and the end of the text
if ((breakIndex < (data->mNumBreaks - 1)) && (data->mBreaks[breakIndex] < i)) {
++breakIndex;
numChars = data->mBreaks[breakIndex] - start;
numChars = PR_MIN(data->mBreaks[breakIndex] - start, (PRInt32)aSubstringLength);
}
else {
NS_ASSERTION(i != data->mBreaks[breakIndex], "don't expect to be at segment boundary");

Просмотреть файл

@ -4915,7 +4915,8 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext,
// Find the index of the last segment that fit
PRInt32 lastSegment;
if (numCharsFit == textRun.mTotalNumChars) { // fast path, normal case
if (numCharsFit >= textRun.mTotalNumChars) { // fast path, normal case
NS_ASSERTION(numCharsFit == textRun.mTotalNumChars, "shouldn't overshoot");
lastSegment = textRun.mNumSegments - 1;
} else {
for (lastSegment = 0; textRun.mBreaks[lastSegment] < numCharsFit; lastSegment++) ;

Просмотреть файл

@ -4915,7 +4915,8 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext,
// Find the index of the last segment that fit
PRInt32 lastSegment;
if (numCharsFit == textRun.mTotalNumChars) { // fast path, normal case
if (numCharsFit >= textRun.mTotalNumChars) { // fast path, normal case
NS_ASSERTION(numCharsFit == textRun.mTotalNumChars, "shouldn't overshoot");
lastSegment = textRun.mNumSegments - 1;
} else {
for (lastSegment = 0; textRun.mBreaks[lastSegment] < numCharsFit; lastSegment++) ;