From a607060bbd985560a9fa0218906eddabf522d734 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 5 Oct 2011 18:26:57 -0700 Subject: Prevent adapter flickering Bug: 5403763 Prevent rapidly switching between a null adapter and a valid adapter by only clearing if the node pointer changes or the text view is no longer autocompletable. Change-Id: Ie594396db807b5ad5e1a5a0e68ec0c7677364aaf --- core/java/android/webkit/WebTextView.java | 13 +++++++++---- core/java/android/webkit/WebView.java | 3 +-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 092e2b5..09be4fe 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -892,7 +892,10 @@ import junit.framework.Assert; * WebTextView represents. */ /* package */ void setNodePointer(int ptr) { - mNodePointer = ptr; + if (ptr != mNodePointer) { + mNodePointer = ptr; + setAdapterCustom(null); + } } /** @@ -1047,11 +1050,12 @@ import junit.framework.Assert; } setHint(null); setThreshold(1); + boolean autoComplete = false; if (single) { mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(), mNodePointer); maxLength = mWebView.nativeFocusCandidateMaxLength(); - boolean autoComplete = mWebView.nativeFocusCandidateIsAutoComplete(); + autoComplete = mWebView.nativeFocusCandidateIsAutoComplete(); if (type != PASSWORD && (mAutoFillable || autoComplete)) { String name = mWebView.nativeFocusCandidateName(); if (name != null && name.length() > 0) { @@ -1066,8 +1070,9 @@ import junit.framework.Assert; setInputType(inputType); setImeOptions(imeOptions); setVisibility(VISIBLE); - AutoCompleteAdapter adapter = null; - setAdapterCustom(adapter); + if (!autoComplete) { + setAdapterCustom(null); + } } /** diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index eaed9fe..abd8b43 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3241,8 +3241,7 @@ public class WebView extends AbsoluteLayout public void clearFormData() { checkThread(); if (inEditingMode()) { - AutoCompleteAdapter adapter = null; - mWebTextView.setAdapterCustom(adapter); + mWebTextView.setAdapterCustom(null); } } -- cgit v1.1