diff options
| author | Siyamed Sinir <siyamed@google.com> | 2017-08-03 22:01:56 -0700 |
|---|---|---|
| committer | Roozbeh Pournader <roozbeh@google.com> | 2017-08-07 15:35:06 -0700 |
| commit | a19cd51d2c511777201c09e258a4e8286249fd9a (patch) | |
| tree | 8c05a1d074fa5ec2859e92e14616253ffc985cb4 /core/java/android/text/StaticLayout.java | |
| parent | 370767083943cff62c6906dc362452356f2738b1 (diff) | |
Reset StaticLayout.mEllipsized during generate()
StaticLayout.mEllipsized and mMaxLineHeight was set for proper
calculation of static ellipsized text height. However, since
DynamicLayout uses a static instance of StaticLayout, and nobody reset
the mEllipsized, this caused configuration discrepancies for different
DynamicLayout instances.
Test: bit -t CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit -t CtsTextTestCases:android.text.cts.StaticLayoutTest
Fixes: 64372088
Bug: 64312574
Change-Id: I8ea6697d29da2ccbb433b64f17b4d1d6f254e8e1
Diffstat (limited to 'core/java/android/text/StaticLayout.java')
| -rw-r--r-- | core/java/android/text/StaticLayout.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 3474c2b56090..9ebf04dd6b33 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -621,6 +621,8 @@ public class StaticLayout extends Layout { b.setLocales(paint.getTextLocales()); mLineCount = 0; + mEllipsized = false; + mMaxLineHeight = DEFAULT_MAX_LINE_HEIGHT; int v = 0; boolean needMultiply = (spacingmult != 1 || spacingadd != 0); @@ -1403,7 +1405,7 @@ public class StaticLayout extends Layout { * The value is the same as getLineTop(maxLines) for ellipsized version where structurally no * more than maxLines is contained. */ - private int mMaxLineHeight = -1; + private int mMaxLineHeight = DEFAULT_MAX_LINE_HEIGHT; private static final int COLUMNS_NORMAL = 5; private static final int COLUMNS_ELLIPSIZE = 7; @@ -1432,6 +1434,8 @@ public class StaticLayout extends Layout { private static final double EXTRA_ROUNDING = 0.5; + private static final int DEFAULT_MAX_LINE_HEIGHT = -1; + // This is used to return three arrays from a single JNI call when // performing line breaking /*package*/ static class LineBreaks { |
