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

Commit 3ecd7db5 authored by Cary Clark's avatar Cary Clark
Browse files

center long press to account for sloppy nodes

If a tap is close to, but not on a node, slop allows the tap
to find the node. Pass the slop-corrected values to
requestFocusNodeHref() as well.

bug:3412519
Change-Id: I7543354b6270976e1f99518581de23c567432b98
parent 7b76c8d3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2272,6 +2272,17 @@ public class WebView extends AbsoluteLayout
        }
        int contentX = viewToContentX(mLastTouchX + mScrollX);
        int contentY = viewToContentY(mLastTouchY + mScrollY);
        if (nativeHasCursorNode()) {
            Rect cursorBounds = nativeGetCursorRingBounds();
            if (!cursorBounds.contains(contentX, contentY)) {
                int slop = viewToContentDimension(mNavSlop);
                cursorBounds.inset(-slop, -slop);
                if (cursorBounds.contains(contentX, contentY)) {
                    contentX = (int) cursorBounds.centerX();
                    contentY = (int) cursorBounds.centerY();
                }
            }
        }
        mWebViewCore.sendMessage(EventHub.REQUEST_CURSOR_HREF,
                contentX, contentY, hrefMsg);
    }