Skip to content

Commit a607060

Browse files
committed
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
1 parent afb119c commit a607060

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

core/java/android/webkit/WebTextView.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,10 @@ private void setMaxLength(int maxLength) {
892892
* WebTextView represents.
893893
*/
894894
/* package */ void setNodePointer(int ptr) {
895-
mNodePointer = ptr;
895+
if (ptr != mNodePointer) {
896+
mNodePointer = ptr;
897+
setAdapterCustom(null);
898+
}
896899
}
897900

898901
/**
@@ -1047,11 +1050,12 @@ private void setMaxLength(int maxLength) {
10471050
}
10481051
setHint(null);
10491052
setThreshold(1);
1053+
boolean autoComplete = false;
10501054
if (single) {
10511055
mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(),
10521056
mNodePointer);
10531057
maxLength = mWebView.nativeFocusCandidateMaxLength();
1054-
boolean autoComplete = mWebView.nativeFocusCandidateIsAutoComplete();
1058+
autoComplete = mWebView.nativeFocusCandidateIsAutoComplete();
10551059
if (type != PASSWORD && (mAutoFillable || autoComplete)) {
10561060
String name = mWebView.nativeFocusCandidateName();
10571061
if (name != null && name.length() > 0) {
@@ -1066,8 +1070,9 @@ private void setMaxLength(int maxLength) {
10661070
setInputType(inputType);
10671071
setImeOptions(imeOptions);
10681072
setVisibility(VISIBLE);
1069-
AutoCompleteAdapter adapter = null;
1070-
setAdapterCustom(adapter);
1073+
if (!autoComplete) {
1074+
setAdapterCustom(null);
1075+
}
10711076
}
10721077

10731078
/**

core/java/android/webkit/WebView.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,8 +3241,7 @@ public void clearCache(boolean includeDiskFiles) {
32413241
public void clearFormData() {
32423242
checkThread();
32433243
if (inEditingMode()) {
3244-
AutoCompleteAdapter adapter = null;
3245-
mWebTextView.setAdapterCustom(adapter);
3244+
mWebTextView.setAdapterCustom(null);
32463245
}
32473246
}
32483247

0 commit comments

Comments
 (0)