Bug 1319660 - 1. Don't take shortcut if old replacement ranges don't match; r=esawin

The block at [1] is a shortcut we take when we reconcile Java text
changes with Gecko text changes. However, we only checked that the new
ranges are the same, i.e. that the new Gecko text is the same as the new
Java text. We should also be checking that the old ranges are the same,
i.e. that the replaced Gecko text is the same as the replaced Java text.

[1] https://dxr.mozilla.org/mozilla-central/rev/bbbd2f7539f224a482cc6d2dd10e6a5f31c8baf3/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java#1233
This commit is contained in:
Jim Chen 2017-01-04 14:46:10 -05:00
parent 7267008bbf
commit cdb5767ec4

View File

@ -1230,8 +1230,9 @@ final class GeckoEditable extends JNIObject
// with Gecko here.
mIgnoreSelectionChange = false;
} else if (indexInText == 0 && text.length() == action.mSequence.length()) {
// The new text exactly matches our sequence, so do a direct replace.
} else if (indexInText == 0 && text.length() == action.mSequence.length() &&
oldEnd - start == action.mEnd - action.mStart) {
// The new change exactly matches our saved change, so do a direct replace.
mText.currentReplace(start, oldEnd, action.mSequence);
// Ignore the next selection change because the selection change is a