Closed Bug 1835712 Opened 3 years ago Closed 3 years ago

Fix a race condition that non-preventDefaulted info from the parent process reaches to APZ first in cases where 0-difference touchmove events

Categories

(Core :: Panning and Zooming, defect, P3)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

Details

Attachments

(1 external file)

On the main-thread in TouchManager::PreHandleEvent if the incoming touchmove event is same as the previous one we do skip handling the event, which means we do skip sending the event into the content processes. So there's a scenario where preventDefaulted info in the content process is not properly used in APZ. The scenario is; given that there's a touchmove event listener doing preventDefault() in a content

  1. a touchmove event is delivered to the content process
  2. while waiting for the response for the touchmove event, there's a new touchmove event equals to the previous one
  3. PreHandleEvent() returns false for the new event, thus we don't send the event to the content
  4. as a result of 3), InputAPZContent::sRoutedToChildProcess doesn't become true since we don't call BrowserParent::SendRealTouchEvent
  5. thus we fall into this if (mAPZC && !InputAPZContext::WasRoutedToChildProcess() && inputBlockId) branch unfortunately and the info (we didn't handle the event, i.e. eIgnore) is delivered to APZ via this ProcessTouchEvent call

Due to this bug the mochitest I wrote for bug 1719855 sometimes fails. And I noticed that disabling android.touch_resampling.enabled makes the test stable, I suppose touch resampling often generates 0-difference touchmove events.

I don't have any idea to solve this issue, so I am going to set android.touch_resampling.enabled=false for the mochitest in bug 1719855.

Maybe we can set a new flag, InputAPZContext::WasDropped(), in this case, and add !WasDropped() to the condition for handling the event with the parent-process APZEventState?

Oh yeah, that will work. Thanks!

I was concerned that even if the event WasDropped() there's a case where we need to send the info to APZ if there's no waiting-response events. But the WasDropped() never becomes true for the first touchmove event, it shouldn't be a matter. APZ will eventually get the proper response.

And use it to tell whether it's safe to inform the handled result to APZ.

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED
Pushed by hikezoe.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5fb45c52d01e Add a new flag to InputAPZContext to indicate the state we didn't handle the event on the main-thread. r=botond
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: