Skip to content

Commit ddc421d

Browse files
George MountAndroid (Google) Code Review
authored andcommitted
Merge "Update edit text size when the text changes so scroll works."
2 parents 8d3c318 + c6c549d commit ddc421d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

core/java/android/webkit/WebViewClassic.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,7 @@ public void onTrimMemory(int level) {
12541254
static final int FOCUS_NODE_CHANGED = 147;
12551255
static final int AUTOFILL_FORM = 148;
12561256
static final int ANIMATE_TEXT_SCROLL = 149;
1257+
static final int EDIT_TEXT_SIZE_CHANGED = 150;
12571258

12581259
private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
12591260
private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT;
@@ -8504,6 +8505,12 @@ public void handleMessage(Message msg) {
85048505
computeEditTextScroll();
85058506
break;
85068507

8508+
case EDIT_TEXT_SIZE_CHANGED:
8509+
if (msg.arg1 == mFieldPointer) {
8510+
mEditTextContent.set((Rect)msg.obj);
8511+
}
8512+
break;
8513+
85078514
default:
85088515
super.handleMessage(msg);
85098516
break;

core/java/android/webkit/WebViewCore.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,6 +2778,18 @@ private void updateTextSelection(int pointer, int start, int end,
27782778
}
27792779
}
27802780

2781+
// called by JNI
2782+
private void updateTextSizeAndScroll(int pointer, int width, int height,
2783+
int scrollX, int scrollY) {
2784+
if (mWebView != null) {
2785+
Rect rect = new Rect(-scrollX, -scrollY, width - scrollX,
2786+
height - scrollY);
2787+
Message.obtain(mWebView.mPrivateHandler,
2788+
WebViewClassic.EDIT_TEXT_SIZE_CHANGED, pointer, 0, rect)
2789+
.sendToTarget();
2790+
}
2791+
}
2792+
27812793
// called by JNI
27822794
private void clearTextEntry() {
27832795
if (mWebView == null) return;

0 commit comments

Comments
 (0)