Skip to content

Commit 484de9d

Browse files
raphlinusAndroid (Google) Code Review
authored andcommitted
Merge "Fix for bug 6954231 text wraps on second line and is fused..." into jb-mr1-dev
2 parents 1795325 + 6b55899 commit 484de9d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/java/android/widget/Editor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public class Editor {
122122
InputMethodState mInputMethodState;
123123

124124
DisplayList[] mTextDisplayLists;
125+
int mLastLayoutHeight;
125126

126127
boolean mFrozenWithFocus;
127128
boolean mSelectionMoved;
@@ -1258,6 +1259,16 @@ private void drawHardwareAccelerated(Canvas canvas, Layout layout, Path highligh
12581259
mTextDisplayLists = new DisplayList[ArrayUtils.idealObjectArraySize(0)];
12591260
}
12601261

1262+
// If the height of the layout changes (usually when inserting or deleting a line,
1263+
// but could be changes within a span), invalidate everything. We could optimize
1264+
// more aggressively (for example, adding offsets to blocks) but it would be more
1265+
// complex and we would only get the benefit in some cases.
1266+
int layoutHeight = layout.getHeight();
1267+
if (mLastLayoutHeight != layoutHeight) {
1268+
invalidateTextDisplayList();
1269+
mLastLayoutHeight = layoutHeight;
1270+
}
1271+
12611272
DynamicLayout dynamicLayout = (DynamicLayout) layout;
12621273
int[] blockEndLines = dynamicLayout.getBlockEndLines();
12631274
int[] blockIndices = dynamicLayout.getBlockIndices();

0 commit comments

Comments
 (0)