diff options
| author | Ben Murdoch <benm@google.com> | 2011-09-09 16:49:44 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2011-09-09 22:38:39 +0100 |
| commit | 2376f8253f59e70e733bdf338e9cb49535f3d50f (patch) | |
| tree | e1e0fdcad17eb98d6904967c9588064b26eaeedf /core/java/android/webkit/WebTextView.java | |
| parent | 02ea7d48773210fa0f29299269aca26b3201b1d0 (diff) | |
Relax form autocomplete conditions
Use the URL host and path rather than the complete url to store
form autocomplete data. This helps in the situation that a site
uses some dynamic query string on the page that contains the form.
Also set the autoocmplete threshold to 1 so that we don't flick the
autocomplete options up and down as you type the first few characters.
Bug: 5265606
Change-Id: I7b372400062ae34f70a78b786007910dc179b101
Diffstat (limited to 'core/java/android/webkit/WebTextView.java')
| -rw-r--r-- | core/java/android/webkit/WebTextView.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 2a79caad77be..217ad7c4367e 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -60,6 +60,8 @@ import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.TextView; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; import junit.framework.Assert; @@ -1044,6 +1046,7 @@ import junit.framework.Assert; break; } setHint(null); + setThreshold(1); if (single) { mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(), mNodePointer); @@ -1077,4 +1080,16 @@ import junit.framework.Assert; /* package */ void setAutoFillProfileIsSet(boolean autoFillProfileIsSet) { mAutoFillProfileIsSet = autoFillProfileIsSet; } + + static String urlForAutoCompleteData(String urlString) { + // Remove any fragment or query string. + URL url = null; + try { + url = new URL(urlString); + } catch (MalformedURLException e) { + Log.e(LOGTAG, "Unable to parse URL "+url); + } + + return url != null ? url.getProtocol() + "://" + url.getHost() + url.getPath() : null; + } } |
