-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add retry for hit tests with expired epoch in result #37085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cbc82a5 to
ce8f9c6
Compare
afcd497 to
747726a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder should we retry all failed hit tests (the epoch may be mismatch but there is no item in the result to check)?
yezhizhen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hit tests with expired epoch mean it is too early to perform the hit test.
I think it means "too late" instead "too early"? If we retry, we are essentially hit-test against the new display list. It may work well with WebDriver as it is fairly static, but may introduce weird experience for real browsing..
cc @jdm
If two events occur in sequence, their effects should be applied sequentially. |
|
I'm not sure a "retry" approach is the right one here. It feels like putting a bandaid over the real problem which is that hit testing needs to be done synchronously with script. 🫤 |
We can think retry and synchronization are similar terms here because we pick a specific point to retry. |
Maybe it leads to the problem of notify new epoch to compositor. |
759c376 to
9ced3cd
Compare
CMIIW but I think the situation is inevitable as long as we have compositor and script running on different threads, and possible solutions are:
Here 1 seems to be the easiest fix. 2 is much more complicated and may cause a bigger performance hit, and I don't see much benefits in there. However, my favorite is 3, and I would like to try it later in the year https://github.com/servo/servo/wiki/Roadmap#architecture later |
dce9c69 to
aa68ffd
Compare
2d09697 to
6da22fe
Compare
5c762c6 to
b68f5b1
Compare
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
8c69528 to
0d02b61
Compare
| return false; | ||
| }, | ||
| _ => { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, may also need to retry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just keeps the default logic, you can add a retry here with a proper reason.
I'm just curious, if so, basically we retry all failed hit test?
| .borrow() | ||
| .hit_test_at_point(point, get_pipeline_details) | ||
| else { | ||
| // Don't need to process pending input events in this frame any more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On some complex pages, such as https://m.huaweimossel.com, a retry failure may occur once.
For touchmove, failure only affects one swipe, which has a minor impact.
However, for touchdown and touchup, a retry failure has a significant impact on the application.
A touchdown failure will prevent the subsequent touchmove or click events from being completed.
A touchup failure will prevent the click event from being triggered. Additionally, the number of active_points saved in the script thread is incorrect. When the next touchdown is triggered, the application will receive two Touch messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a retry failure has a significant impact on the application
If we don't retry touch events, there is no impact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The touchdown and touchup events exist in pairs. If touchdown is successful and touchup fails, the application's JavaScript will consider there to be a touchpoint present. When touchdown is triggered again, the number of touchpoints becomes 2.
When this situation occurs on the https://m.huaweimossel.com/ website, the carousel will not be able to slide. This is because the developer has checked the size of e.touches.length in the JavaScript code. This is the issue I have discovered so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your details. As my understanding, the problem occurs because of hit test failings. Since the retry keeps the order of events, it doesn't play a role here.
Anyway, retry is just an improvement, not a final fix.
We can wait for this: #37085 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the problem found now, should we first solve it by increasing the number of retries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increase amount of retry may lead to a scenario in which, 1 event takes several frames to be processed.
I'm thinking of retrying touch events as pairs of down and up, how do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that if either down or up fails, everything will be retried?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes both must succeed or fail together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there could be two touchdowns, and then two touchups. Or more.

Follow up to hit_test failed occasionally when the touch event is sent and #36676 (comment), this PR adds a retry for hit tests with expired epoch in result.
Hit tests with outdated epoch mean it is too early to perform the hit test.
Solution: retry hit test for the event on the next webrender frame.
The retry should guarantee that:
Test cases:
./mach test-wpt --product servodriver -r tests\wpt\tests\webdriver\tests\classic\element_click\events.pycc: @xiaochengh , @yezhizhen