зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
caf5074301
Коммит
5fe9f9019a
|
@ -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++) ;
|
||||
|
|
Загрузка…
Ссылка в новой задаче