Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12221d15 authored by George Mount's avatar George Mount
Browse files

DO NOT MERGE Consider current scroll position to move text field into view.

 Bug 6530008

Change-Id: I6542dab70b64f809ec5dd4deb3511f8aa38278e1
parent b999b22e
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -5504,8 +5504,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        if (visibleRect.contains(mEditTextContentBounds)) {
            return; // no need to scroll
        }
        nativeFindMaxVisibleRect(mNativeClass, mEditTextLayerId, visibleRect);
        syncSelectionCursors();
        nativeFindMaxVisibleRect(mNativeClass, mEditTextLayerId, visibleRect);
        final int buffer = Math.max(1, viewToContentDimension(EDIT_RECT_BUFFER));
        Rect showRect = new Rect(
                Math.max(0, mEditTextContentBounds.left - buffer),
@@ -5538,17 +5538,19 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
            return; // no need to scroll
        }

        int scrollX = visibleRect.left;
        int scrollX = viewToContentX(getScrollX());
        if (visibleRect.left > showRect.left) {
            scrollX = showRect.left;
            // We are scrolled too far
            scrollX += showRect.left - visibleRect.left;
        } else if (visibleRect.right < showRect.right) {
            scrollX = Math.max(0, showRect.right - visibleRect.width());
            // We aren't scrolled enough to include the right
            scrollX += showRect.right - visibleRect.right;
        }
        int scrollY = visibleRect.top;
        int scrollY = viewToContentY(getScrollY());
        if (visibleRect.top > showRect.top) {
            scrollY = showRect.top;
            scrollY += showRect.top - visibleRect.top;
        } else if (visibleRect.bottom < showRect.bottom) {
            scrollY = Math.max(0, showRect.bottom - visibleRect.height());
            scrollY += showRect.bottom - visibleRect.bottom;
        }

        contentScrollTo(scrollX, scrollY, false);