OSDN Git Service

Sort the result of SpannableStringBuilder.getSpans
authorSiyamed Sinir <siyamed@google.com>
Tue, 12 Jan 2016 18:54:43 +0000 (10:54 -0800)
committerSiyamed Sinir <siyamed@google.com>
Thu, 21 Jan 2016 00:27:39 +0000 (16:27 -0800)
commitfa05ba0b0d39fae1d2cb3d98fbee0aef6a9fed88
tree5aa8285f50caa128cba09050678f7b6324615eb6
parent3d5278b63862b337b8c7ef82ed18f1825e4b5c6b
Sort the result of SpannableStringBuilder.getSpans

SpannableStringBuilder used to return the result of getSpans in the
order of start indices because of the interval tree it uses. However,
style spans has to be applied in the order of insertion to get
predictable results. Sorted the results of getSpans ordered first by
priority flag and then by insertion time. Moreover improved the
performance of SpannableStringInternal copy constructor.

Bug: 26240132
Change-Id: I0b0fa7bb30a3bd9ca37dedca66d8993718586027
core/java/android/text/Layout.java
core/java/android/text/SpannableStringBuilder.java
core/java/android/text/SpannableStringInternal.java
core/tests/benchmarks/src/android/text/SpannableStringBuilderBenchmark.java [new file with mode: 0644]
core/tests/benchmarks/src/android/text/SpannableStringInternalCopyBenchmark.java [new file with mode: 0644]