diff options
| author | Gilles Debunne <debunne@google.com> | 2011-01-04 15:35:29 -0800 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2011-01-04 15:37:41 -0800 |
| commit | 4cf435df2e485e405f085982ac8fd9c82fb57d47 (patch) | |
| tree | 241862fc8a16f6b52a7b09ada9e7e041211f935c /core/java/android/text/StaticLayout.java | |
| parent | 78526012a135327dae1a897dd4670b25f2a6f651 (diff) | |
Revert "Fix for ellipsized text that has two lines at maximum."
This reverts commit 32ea4ffdca0f4706e447d0a275f259fe121b9e6a.
This change introduces an ANR in AutoComplete text view. There is
an infinite loop when the suggestion TextView is measured.
Reverted to fix the ANR, opening a new bug for the ellipsize.
Bug 3315813, 3320375, 3318059
Change-Id: I1872116ca1f39324ed4500d338bafac7e0d195ec
Diffstat (limited to 'core/java/android/text/StaticLayout.java')
| -rw-r--r-- | core/java/android/text/StaticLayout.java | 182 |
1 files changed, 90 insertions, 92 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index d8d632062107..3dd1ecd34ad8 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -361,103 +361,101 @@ public class StaticLayout extends Layout if (fitbottom > okbottom) okbottom = fitbottom; } - } else { - if (breakOnlyAtSpaces) { - if (ok != here) { - // Log.e("text", "output ok " + here + " to " +ok); - - while (ok < spanEnd && chs[ok - paraStart] == ' ') { - ok++; - } + } else if (breakOnlyAtSpaces) { + if (ok != here) { + // Log.e("text", "output ok " + here + " to " +ok); - v = out(source, - here, ok, - okascent, okdescent, oktop, okbottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - ok == bufend, includepad, trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, okwidth, - paint); - - here = ok; - } else { - // Act like it fit even though it didn't. - - fitwidth = w; - fit = j + 1; - - if (fmtop < fittop) - fittop = fmtop; - if (fmascent < fitascent) - fitascent = fmascent; - if (fmdescent > fitdescent) - fitdescent = fmdescent; - if (fmbottom > fitbottom) - fitbottom = fmbottom; + while (ok < spanEnd && chs[ok - paraStart] == ' ') { + ok++; } - } else { - if (ok != here) { - // Log.e("text", "output ok " + here + " to " +ok); - while (ok < spanEnd && chs[ok - paraStart] == ' ') { - ok++; - } + v = out(source, + here, ok, + okascent, okdescent, oktop, okbottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + ok == bufend, includepad, trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, okwidth, + paint); + + here = ok; + } else { + // Act like it fit even though it didn't. + + fitwidth = w; + fit = j + 1; + + if (fmtop < fittop) + fittop = fmtop; + if (fmascent < fitascent) + fitascent = fmascent; + if (fmdescent > fitdescent) + fitdescent = fmdescent; + if (fmbottom > fitbottom) + fitbottom = fmbottom; + } + } else { + if (ok != here) { + // Log.e("text", "output ok " + here + " to " +ok); - v = out(source, - here, ok, - okascent, okdescent, oktop, okbottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - ok == bufend, includepad, trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, okwidth, - paint); - - here = ok; - } else if (fit != here) { - // Log.e("text", "output fit " + here + " to " +fit); - v = out(source, - here, fit, - fitascent, fitdescent, - fittop, fitbottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - fit == bufend, includepad, trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, fitwidth, - paint); - - here = fit; - } else { - // Log.e("text", "output one " + here + " to " +(here + 1)); - // XXX not sure why the existing fm wasn't ok. - // measureText(paint, mWorkPaint, - // source, here, here + 1, fm, tab, - // null); - - v = out(source, - here, here+1, - fm.ascent, fm.descent, - fm.top, fm.bottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - here + 1 == bufend, includepad, - trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, - widths[here - paraStart], paint); - - here = here + 1; + while (ok < spanEnd && chs[ok - paraStart] == ' ') { + ok++; } + + v = out(source, + here, ok, + okascent, okdescent, oktop, okbottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + ok == bufend, includepad, trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, okwidth, + paint); + + here = ok; + } else if (fit != here) { + // Log.e("text", "output fit " + here + " to " +fit); + v = out(source, + here, fit, + fitascent, fitdescent, + fittop, fitbottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + fit == bufend, includepad, trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, fitwidth, + paint); + + here = fit; + } else { + // Log.e("text", "output one " + here + " to " +(here + 1)); + // XXX not sure why the existing fm wasn't ok. + // measureText(paint, mWorkPaint, + // source, here, here + 1, fm, tab, + // null); + + v = out(source, + here, here+1, + fm.ascent, fm.descent, + fm.top, fm.bottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + here + 1 == bufend, includepad, + trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, + widths[here - paraStart], paint); + + here = here + 1; } if (here < spanStart) { |
