Skip to content

hit_test failed occasionally when the touch event is sent. #35788

Closed

Description

@kongbai1996

Describe the bug:
hit_test failed occasionally when the touch event is sent.

To Reproduce:

  1. open page: https://m.huaweimossel.com/#/
  2. Sliding Carousel Picture

Platform:
ohos

log:

on_touch_up current_sequence_id:TouchSequenceId(101)
hit_test_at_point_with_flags_and_pipeline item:HitTestResultItem { pipeline: PipelineId(1, 3), tag: (753, 2152), animation_id: 0, point_in_viewport: (305.53848, 332.6154), point_relative_to_item: (305.53848, 332.6154) } pipeline_id:(1,3)
return None epoch epoch:2153 tag:2152
send_touch_event hit_test_at_point failed event:TouchEvent { event_type: Up, id: TouchId(0), point: (993.0, 1081.0), cancelable: true, sequence_id: None }

Activity

  1. added
    C-untriaged
    on Mar 4, 2025
  2. kongbai1996 commented on Mar 4, 2025

    @kongbai1996
    ContributorAuthor

    reson:
    When you slide the carousel image, a new displaylist is generated continuously. The epoch will self-increase. However, the hit_test result may still be the previous epoch, resulting in a matching failure.

  3. kongbai1996 commented on Mar 4, 2025

    @kongbai1996
    ContributorAuthor

    match details.most_recent_display_list_epoch {
    Some(epoch) if epoch.as_u16() == item.tag.1 => {},
    _ => return None,
    }

  4. kongbai1996 commented on Mar 4, 2025

    @kongbai1996
    ContributorAuthor

    Some(epoch) if epoch.as_u16() == item.tag.1 => {},

    Maybe we shouldn't have this check?

  5. mrobinson commented on Mar 4, 2025

    @mrobinson
    Member

    We cannot remove this check as it means that the hit testing tree is out of date with the DOM and the node addresses are more likely to be invalid. The ultimate solution here is to move hit testing to layout / script.

  6. kongbai1996 commented on Mar 4, 2025

    @kongbai1996
    ContributorAuthor

    We cannot remove this check as it means that the hit testing tree is out of date with the DOM and the node addresses are more likely to be invalid. The ultimate solution here is to move hit testing to layout / script.

    It's a big job. I'll try it.

  7. kongbai1996 commented on Mar 4, 2025

    @kongbai1996
    ContributorAuthor

    Do you have any more detailed suggestions?

  8. kongbai1996 commented on Mar 4, 2025

    @kongbai1996
    ContributorAuthor

    The ultimate solution here is to move hit testing to layout / script.

    Is this check also required if moving to script. There will be the same issue because the epoch was changed in layout2020.

  9. kongbai1996 commented on Mar 5, 2025

    @kongbai1996
    ContributorAuthor

    Image

  10. kongbai1996 commented on Mar 5, 2025

    @kongbai1996
    ContributorAuthor

    Image

    Timeline:
    A touchevent is triggered.
    In step 2, hittest is triggered.
    When the eventhandler is executed in step 3, the layout is triggered and the display list of the last name is generated.
    In step 5, the display list is sent to the compositor and most_recent_display_list_epoch is updated.
    Then send it to the webrender and rebuild the scene in step 6.
    At this time, another touchevent is triggered. Most_recent_display_list_epoch has been updated, but the seventh step of the rebuild scene process has not been reached. Therefore, the scene is old and cannot match the current epoch. The hittest fails.The event is not sent to the script.

  11. kongbai1996 commented on Mar 5, 2025

    @kongbai1996
    ContributorAuthor

    We cannot remove this check as it means that the hit testing tree is out of date with the DOM and the node addresses are more likely to be invalid.

    Although the display list is outdated at this time, the new display list is not updated, and the compositor NewWebRenderFrameReady is not notified, and the repaint is not performed.
    Are outdated hit test results really invalid? This is the hit test result of the current page content.

  12. kongbai1996 commented on Jun 5, 2025

    @kongbai1996
    ContributorAuthor

    This issue has been resolved by retrying hittest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions