android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java |   44 
++--------
 1 file changed, 11 insertions(+), 33 deletions(-)

New commits:
commit 79aeaf9b1ceddfd9144d787e86cf58145ba171c0
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Nov 12 16:08:56 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Nov 14 11:53:21 2025 +0100

    android: Drop two TouchEventHandler members that are always false
    
    As is more obvious since previous commit
    
        Change-Id: I406a5e4116aaefa673a68257a51a6ae7af8b046c
        Author: Michael Weghorn <[email protected]>
        Date:   Wed Nov 12 16:00:50 2025 +0100
    
            android: Drop unused TouchEventHandler.setWaitForTouchListeners
    
    , TouchEventHandler.mWaitForTouchListeners is always false,
    since that's the default boolean value it gets implicitly
    initialized with, and it never gets assigned any other value.
    
    As a consequence, the same is true for
    TouchEventHandler.mHoldInQueue as well.
    
    Therefore, drop these two members and all dead code
    that would only be executed if one of them were
    true.
    
    Change-Id: I145531e23f9d076f79bdb6c0d886f33e05d818f9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193898
    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 438c6801f65b..6e8b46cdc1ce 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/TouchEventHandler.java
@@ -62,15 +62,6 @@ public final class TouchEventHandler {
     private final Queue<MotionEvent> mEventQueue;
     private final ListenerTimeoutProcessor mListenerTimeoutProcessor;
 
-    // whether or not we should wait for touch listeners to respond (this 
state is
-    // per-tab and is updated when we switch tabs).
-    private boolean mWaitForTouchListeners;
-
-    // true if we should hold incoming events in our queue. this is re-set for 
every
-    // block of events, this is cleared once we find out if the block has been
-    // default-prevented or not (or we time out waiting for that).
-    private boolean mHoldInQueue;
-
     // 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
@@ -137,41 +128,29 @@ public final class TouchEventHandler {
     public boolean handleEvent(MotionEvent event) {
         if (isDownEvent(event)) {
             // this is the start of a new block of events! whee!
-            mHoldInQueue = mWaitForTouchListeners;
 
             // 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;
-            if (mHoldInQueue) {
-                // if the new block we are starting is the current block (i.e. 
there are no
-                // other blocks waiting in the queue, then we should let the 
pan/zoom controller
-                // know we are waiting for the touch listeners to run
-                if (mEventQueue.isEmpty()) {
-                    mPanZoomController.startingNewEventBlock(event, true);
-                }
-            } else {
-                // 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
-                // the queue as a placeholder for a block of events that has 
already been dispatched.
-                mEventQueue.add(null);
-                mPanZoomController.startingNewEventBlock(event, false);
-            }
+
+            // 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
+            // the queue as a placeholder for a block of events that has 
already been dispatched.
+            mEventQueue.add(null);
+            mPanZoomController.startingNewEventBlock(event, false);
 
             // set the timeout so that we dispatch these events and update 
mProcessingBalance
             // if we don't get a default-prevented notification
             mView.postDelayed(mListenerTimeoutProcessor, 
EVENT_LISTENER_TIMEOUT);
         }
 
-        // if we need to hold the events, add it to the queue. if we need to 
dispatch
-        // it directly, do that. it is possible that both mHoldInQueue and 
mDispatchEvents
-        // are false, in which case we are processing a block of events that 
we know
+        // 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 (mHoldInQueue) {
-            mEventQueue.add(MotionEvent.obtain(event));
-        } else if (mDispatchEvents) {
+        if (mDispatchEvents) {
             dispatchEvent(event);
         } else if (touchFinished(event)) {
             mPanZoomController.preventedTouchFinished();
@@ -242,11 +221,10 @@ public final class TouchEventHandler {
             }
             if (mEventQueue.isEmpty()) {
                 // we have processed the backlog of events, and are all caught 
up.
-                // now we can set clear the hold flag and set the dispatch 
flag so
+                // 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.
-                mHoldInQueue = false;
                 mDispatchEvents = allowDefaultAction;
                 break;
             }

Reply via email to