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

Commit 7882a783 authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Propagating hover events to JavaScript in WebView

Propagating hover events to JavaScript to enable
touch exploration of web content. All hover events
are mapped to mouse move events and then WebKit
generates the appropriate mousemove, mouseover and
mouseout actions.

Change-Id: Ib96cd22baf471df045629ca9e254e5a5f7023961
parent 01defe40
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -4380,15 +4380,20 @@ public class WebView extends AbsoluteLayout
    }

    WebViewCore.CursorData cursorData() {
        WebViewCore.CursorData result = new WebViewCore.CursorData();
        result.mMoveGeneration = nativeMoveGeneration();
        result.mFrame = nativeCursorFramePointer();
        WebViewCore.CursorData result = cursorDataNoPosition();
        Point position = nativeCursorPosition();
        result.mX = position.x;
        result.mY = position.y;
        return result;
    }

    WebViewCore.CursorData cursorDataNoPosition() {
        WebViewCore.CursorData result = new WebViewCore.CursorData();
        result.mMoveGeneration = nativeMoveGeneration();
        result.mFrame = nativeCursorFramePointer();
        return result;
    }

    /**
     *  Delete text from start to end in the focused textfield. If there is no
     *  focus, or if start == end, silently fail.  If start and end are out of
@@ -5587,6 +5592,18 @@ public class WebView extends AbsoluteLayout
    // density of the screen.
    private static final int DRAG_LAYER_FINGER_DISTANCE = 20000;

    @Override
    public boolean onHoverEvent(MotionEvent event) {
        if (mNativeClass == 0) {
            return false;
        }
        WebViewCore.CursorData data = cursorDataNoPosition();
        data.mX = viewToContentX((int) event.getX());
        data.mY = viewToContentY((int) event.getY());
        mWebViewCore.sendMessage(EventHub.SET_MOVE_MOUSE, data);
        return true;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (mNativeClass == 0 || (!isClickable() && !isLongClickable())) {