Bug 1086983 - Part 2: Do not restore autocomplete text from editing mode. r=lucasr
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 06 Nov 2014 10:25:56 -0800
changeset 214668 36e434d7d9909cc6722d909b69bfa1ebffda5be3
parent 214667 53d7570e20f2f5b2f0c01519d089755fed48c873
child 214669 1afe68b5c5b0e6d3a1df8253491b706c42682cdb
push id27791
push userkwierso@gmail.com
push dateSat, 08 Nov 2014 01:43:47 +0000
treeherdermozilla-central@b7f2bf6856a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs1086983
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1086983 - Part 2: Do not restore autocomplete text from editing mode. r=lucasr
mobile/android/base/toolbar/ToolbarEditLayout.java
mobile/android/base/toolbar/ToolbarEditText.java
--- a/mobile/android/base/toolbar/ToolbarEditLayout.java
+++ b/mobile/android/base/toolbar/ToolbarEditLayout.java
@@ -125,17 +125,17 @@ public class ToolbarEditLayout extends T
         mEditText.setText(text);
     }
 
     String getText() {
         return mEditText.getText().toString();
     }
 
     protected void saveTabEditingState(final TabEditingState editingState) {
-        editingState.lastEditingText = getText();
+        editingState.lastEditingText = mEditText.getNonAutocompleteText();
         editingState.selectionStart = mEditText.getSelectionStart();
         editingState.selectionEnd = mEditText.getSelectionEnd();
    }
 
     protected void restoreTabEditingState(final TabEditingState editingState) {
         mEditText.setText(editingState.lastEditingText);
         mEditText.setSelection(editingState.selectionStart, editingState.selectionEnd);
     }
--- a/mobile/android/base/toolbar/ToolbarEditText.java
+++ b/mobile/android/base/toolbar/ToolbarEditText.java
@@ -155,16 +155,20 @@ public class ToolbarEditText extends Cus
         // Pretend we already autocompleted the existing text,
         // so that actions like backspacing don't trigger autocompletion.
         mAutoCompletePrefixLength = getText().length();
 
         // Show the cursor.
         setCursorVisible(true);
     }
 
+    protected String getNonAutocompleteText() {
+        return getNonAutocompleteText(getText());
+    }
+
     /**
      * Get the portion of text that is not marked as autocomplete text.
      *
      * @param text Current text content that may include autocomplete text
      */
     private static String getNonAutocompleteText(final Editable text) {
         final int start = text.getSpanStart(AUTOCOMPLETE_SPAN);
         if (start < 0) {