android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java |   46 
----------
 1 file changed, 4 insertions(+), 42 deletions(-)

New commits:
commit c5607197475647fe29b817e9d69f37b5533b455b
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Nov 12 16:28:32 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Nov 14 11:53:49 2025 +0100

    android: Drop always true TouchEventHandler.mDispatchEvents
    
    It gets set to true in the ctor, and since previous
    commit
    
        Change-Id: Iaad65954df69b11e1463a54097116001e7048cfa
        Author: Michael Weghorn <[email protected]>
        Date:   Wed Nov 12 16:15:51 2025 +0100
    
            android: Drop always true TouchEventHandler.processEventBlock param
    
    it is also obvious that it never gets set to any
    other value.
    
    Therefore, drop that member and all (dead) code that
    would only be relevant if it ever had a value of false.
    
    Change-Id: Iaad65954df69b11e1463a54097116001e7048cfa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193900
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git 
a/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java 
b/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
index 2fd318682c2c..22b9b71ccc89 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
@@ -62,12 +62,6 @@ public final class TouchEventHandler {
     private final Queue<MotionEvent> mEventQueue;
     private final ListenerTimeoutProcessor mListenerTimeoutProcessor;
 
-    // true if we should dispatch incoming events to the gesture detector and 
the pan/zoom
-    // controller. if this is false, then the current block of events has been
-    // default-prevented, and we should not dispatch these events (although 
we'll still send
-    // them to gecko listeners).
-    private boolean mDispatchEvents;
-
     // this next variable requires some explanation. strap yourself in.
     //
     // for each block of events, we do two things: (1) send the events to 
gecko and expect
@@ -116,7 +110,6 @@ public final class TouchEventHandler {
         mGestureDetector = new GestureDetector(context, mPanZoomController);
         mScaleGestureDetector = new 
SimpleScaleGestureDetector(mPanZoomController);
         mListenerTimeoutProcessor = new ListenerTimeoutProcessor();
-        mDispatchEvents = true;
 
         mGestureDetector.setOnDoubleTapListener(mPanZoomController);
     }
@@ -129,11 +122,6 @@ public final class TouchEventHandler {
         if (isDownEvent(event)) {
             // this is the start of a new block of events! whee!
 
-            // Set mDispatchEvents to true so that we are guaranteed to either 
queue these
-            // events or dispatch them. The only time we should not do either 
is once we've
-            // heard back from content to preventDefault this block.
-            mDispatchEvents = true;
-
             // we're not going to be holding this block of events in the 
queue, but we need
             // a marker of some sort so that the processEventBlock loop deals 
with the blocks
             // in the right order as notifications come in. we use a single 
null event in
@@ -146,15 +134,7 @@ public final class TouchEventHandler {
             mView.postDelayed(mListenerTimeoutProcessor, 
EVENT_LISTENER_TIMEOUT);
         }
 
-        // If we need to dispatch events directly, do that. It is possible 
that mDispatchEvents
-        // is false, in which case we are processing a block of events that we 
know
-        // has been default-prevented. in that case we don't keep the events 
as we don't
-        // need them (but we still pass them to the gecko listener).
-        if (mDispatchEvents) {
-            dispatchEvent(event);
-        } else if (touchFinished(event)) {
-            mPanZoomController.preventedTouchFinished();
-        }
+        dispatchEvent(event);
 
         return true;
     }
@@ -208,11 +188,6 @@ public final class TouchEventHandler {
             }
             if (mEventQueue.isEmpty()) {
                 // we have processed the backlog of events, and are all caught 
up.
-                // now we can set the dispatch flag so
-                // that the handleEvent() function can do the right thing for 
all
-                // remaining events in this block (which is still ongoing) 
without
-                // having to put them in the queue.
-                mDispatchEvents = true;
                 break;
             }
             event = mEventQueue.peek();
commit 5f4f31ee35b766e3b0d1cb7a51447ac5919f00a8
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Nov 12 16:15:51 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Nov 14 11:53:37 2025 +0100

    android: Drop always true TouchEventHandler.processEventBlock param
    
    The only caller passes a value of true, so drop
    the param and all code that would only be relevant
    for a value of false being passed.
    
    Change-Id: Ief93dc68488d133499ed7723d484142ceaa0f0a4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193899
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git 
a/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java 
b/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
index 6e8b46cdc1ce..2fd318682c2c 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
@@ -187,14 +187,7 @@ public final class TouchEventHandler {
      * Process the block of events at the head of the queue now that we know
      * whether it has been default-prevented or not.
      */
-    private void processEventBlock(boolean allowDefaultAction) {
-        if (!allowDefaultAction) {
-            // if the block has been default-prevented, cancel whatever stuff 
we had in
-            // progress in the gesture detector and pan zoom controller
-            long now = SystemClock.uptimeMillis();
-            dispatchEvent(MotionEvent.obtain(now, now, 
MotionEvent.ACTION_CANCEL, 0, 0, 0));
-        }
-
+    private void processEventBlock() {
         if (mEventQueue.isEmpty()) {
             Log.e(LOGTAG, "Unexpected empty event queue in 
processEventBlock!", new Exception());
             return;
@@ -211,13 +204,7 @@ public final class TouchEventHandler {
             // that has already been dispatched.
 
             if (event != null) {
-                // for each event we process, only dispatch it if the block 
hasn't been
-                // default-prevented.
-                if (allowDefaultAction) {
-                    dispatchEvent(event);
-                } else if (touchFinished(event)) {
-                    mPanZoomController.preventedTouchFinished();
-                }
+                dispatchEvent(event);
             }
             if (mEventQueue.isEmpty()) {
                 // we have processed the backlog of events, and are all caught 
up.
@@ -225,7 +212,7 @@ public final class TouchEventHandler {
                 // that the handleEvent() function can do the right thing for 
all
                 // remaining events in this block (which is still ongoing) 
without
                 // having to put them in the queue.
-                mDispatchEvents = allowDefaultAction;
+                mDispatchEvents = true;
                 break;
             }
             event = mEventQueue.peek();
@@ -251,7 +238,7 @@ public final class TouchEventHandler {
                 // the block of events this ListenerTimeoutProcessor 
corresponds to have
                 // already been removed from the queue.
             } else {
-                processEventBlock(true);
+                processEventBlock();
             }
             mProcessingBalance++;
         }

Reply via email to